{
MenuManager markMenu = new MenuManager(Messages.ApplicationActionBarAdvisor_MARK, "mark"); //$NON-NLS-1$
manager.add(markMenu);
/* Mark as Read */
IAction action = new ToggleReadStateAction(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 */
fillLabelMenu(manager, selection, getActionBarConfigurer().getWindowConfigurer().getWindow(), false);
}
/* Move To / Copy To */
if (!selection.isEmpty()) {
manager.add(new Separator("movecopy")); //$NON-NLS-1$
/* Load all news bins and sort by name */
List<INewsBin> newsbins = new ArrayList<INewsBin>(DynamicDAO.loadAll(INewsBin.class));
Comparator<INewsBin> comparator = new Comparator<INewsBin>() {
public int compare(INewsBin o1, INewsBin o2) {
return o1.getName().compareTo(o2.getName());
};
};
Collections.sort(newsbins, comparator);
/* Move To */
MenuManager moveMenu = new MenuManager(Messages.ApplicationActionBarAdvisor_MOVE_TO, "moveto"); //$NON-NLS-1$
manager.add(moveMenu);
for (INewsBin bin : newsbins) {
if (activeInput != null && activeInput.getMark().equals(bin))
continue;
moveMenu.add(new MoveCopyNewsToBinAction(selection, bin, true));
}
moveMenu.add(new MoveCopyNewsToBinAction(selection, null, true));
moveMenu.add(new Separator());
moveMenu.add(new AutomateFilterAction(PresetAction.MOVE, selection));
/* Copy To */
MenuManager copyMenu = new MenuManager(Messages.ApplicationActionBarAdvisor_COPY_TO, "copyto"); //$NON-NLS-1$
manager.add(copyMenu);
for (INewsBin bin : newsbins) {
if (activeInput != null && activeInput.getMark().equals(bin))
continue;
copyMenu.add(new MoveCopyNewsToBinAction(selection, bin, false));
}
copyMenu.add(new MoveCopyNewsToBinAction(selection, null, false));
copyMenu.add(new Separator());
copyMenu.add(new AutomateFilterAction(PresetAction.COPY, selection));
}
/* Share */
fillShareMenu(manager, selection, getActionBarConfigurer().getWindowConfigurer().getWindow(), false);
/* Filter */
if (!selection.isEmpty()) {
manager.add(new Separator("filter")); //$NON-NLS-1$
/* Create Filter */
manager.add(new Action(Messages.ApplicationActionBarAdvisor_CREATE_FILTER) {
@Override
public void run() {
CreateFilterAction action = new CreateFilterAction();
action.selectionChanged(null, selection);
action.run(null);
}
@Override
public ImageDescriptor getImageDescriptor() {
return OwlUI.FILTER;
}
@Override
public String getActionDefinitionId() {
return CreateFilterAction.ID;
};
@Override
public String getId() {
return CreateFilterAction.ID;
};
});
}
/* Update */
{
manager.add(new Separator("reload")); //$NON-NLS-1$
/* Update */
manager.add(new Action(Messages.ApplicationActionBarAdvisor_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"); //$NON-NLS-1$