{
MenuManager markMenu = new MenuManager("Mark", "mark");
manager.add(markMenu);
/* Mark as Read */
IAction action = new MarkNewsReadAction(selection);
action.setEnabled(!selection.isEmpty());
markMenu.add(action);
/* Mark All Read */
action = new MarkAllNewsReadAction();
action.setEnabled(activeFeedView != null);
markMenu.add(action);
/* Sticky */
markMenu.add(new Separator());
action = new MakeNewsStickyAction(selection);
action.setEnabled(!selection.isEmpty());
markMenu.add(action);
}
/* Label */
{
Collection<ILabel> labels = DynamicDAO.loadAll(ILabel.class);
MenuManager labelMenu = new MenuManager("Label");
manager.add(labelMenu);
/* Retrieve Labels that all selected News contain */
Set<ILabel> selectedLabels = ModelUtils.getLabelsForAll(selection);
IAction removeAllLabels = new Action("Remove All Labels") {
@Override
public void run() {
Collection<ILabel> labels = DynamicDAO.loadAll(ILabel.class);
new LabelAction(labels, selection, false).run();
}
};
removeAllLabels.setEnabled(!labels.isEmpty());
labelMenu.add(removeAllLabels);
labelMenu.add(new Separator());
for (final ILabel label : labels) {
IAction labelAction = new Action(label.getName(), IAction.AS_CHECK_BOX) {
@Override
public void run() {
Set<ILabel> labels = new HashSet<ILabel>(1);
labels.add(label);
new LabelAction(labels, selection, isChecked()).run();
}
};
labelAction.setChecked(selectedLabels.contains(label));
labelMenu.add(labelAction);
}
labelMenu.add(new Separator());
labelMenu.add(new Action("Organize...") {
@Override
public void run() {
PreferencesUtil.createPreferenceDialogOn(getActionBarConfigurer().getWindowConfigurer().getWindow().getShell(), ManageLabelsPreferencePage.ID, null, null).open();
}
});
}
}
/* Edit */
{
manager.add(new Separator("edit"));
/* Copy Link */
manager.add(new Action("Copy Link") {
@Override
public void run() {
IActionDelegate action = new CopyLinkAction();
action.selectionChanged(null, selection);
action.run(null);
}
@Override
public boolean isEnabled() {
return !selection.isEmpty();
}
});
/* Send Link */
manager.add(new Action("Send Link") {
@Override
public void run() {
IActionDelegate action = new SendLinkAction();
action.selectionChanged(null, selection);
action.run(null);
}
@Override
public boolean isEnabled() {
return !selection.isEmpty();
}
});
}
/* Update */
{
manager.add(new Separator("reload"));
/* Update */
manager.add(new Action("Update") {
@Override
public void run() {
IActionDelegate action = new ReloadTypesAction();
action.selectionChanged(null, selection);
action.run(null);
}
@Override
public ImageDescriptor getImageDescriptor() {
return OwlUI.getImageDescriptor("icons/elcl16/reload.gif");