use of org.eclipse.ui.views.framelist.GoIntoAction in project knime-core by knime.
the class KnimeResourceNavigator method fillContextMenu.
/**
* Fills the context menu with the actions contained in this group and its
* subgroups. Additionally the close project item is removed as not intended
* for the knime projects. Note: Projects which are closed in the default
* navigator are not shown in the knime navigator any more.
*
* @param menu the context menu
*/
@Override
public void fillContextMenu(final IMenuManager menu) {
// fill the menu
super.fillContextMenu(menu);
// remove the close project item
menu.remove(CloseResourceAction.ID);
// items do not have an id
for (IContributionItem item : menu.getItems()) {
if (item instanceof ActionContributionItem) {
ActionContributionItem aItem = (ActionContributionItem) item;
// remove the gointo item
if (aItem.getAction() instanceof GoIntoAction) {
menu.remove(aItem);
} else if (aItem.getAction() instanceof OpenInNewWindowAction) {
menu.remove(aItem);
} else if (aItem.getAction() instanceof CloseUnrelatedProjectsAction) {
menu.remove(aItem);
}
}
}
// move must be our own action (due to workflow locks)
if (menu.find(MoveResourceAction.ID) != null) {
menu.insertBefore(MoveResourceAction.ID, new MoveWorkflowAction(getTreeViewer()));
menu.remove(MoveResourceAction.ID);
}
// remove the default import export actions to store the own one
// that invokes the knime export wizard directly
menu.remove("import");
menu.insertBefore("export", new ImportKnimeWorkflowAction(PlatformUI.getWorkbench().getActiveWorkbenchWindow()));
menu.remove("export");
menu.insertAfter(ImportKnimeWorkflowAction.ID, new ExportKnimeWorkflowAction(PlatformUI.getWorkbench().getActiveWorkbenchWindow()));
String id = ImportKnimeWorkflowAction.ID;
// add an open action which is not listed as the project is normally
// not openable.
menu.insertBefore(id, new Separator());
menu.insertBefore(id, new OpenKnimeProjectAction(this));
menu.insertAfter(ExportKnimeWorkflowAction.ID, new Separator());
menu.insertAfter(ExportKnimeWorkflowAction.ID, new EditMetaInfoAction());
menu.insertAfter(ExportKnimeWorkflowAction.ID, new Separator());
if (NodeExecutionJobManagerPool.getNumberOfJobManagersFactories() > 1) {
menu.insertAfter(ExportKnimeWorkflowAction.ID, new WFShowJobMgrViewAction());
}
menu.insertAfter(ExportKnimeWorkflowAction.ID, new ResetWorkflowAction());
menu.insertAfter(ExportKnimeWorkflowAction.ID, new CancelWorkflowAction());
menu.insertAfter(ExportKnimeWorkflowAction.ID, new ExecuteWorkflowAction());
menu.insertAfter(ExportKnimeWorkflowAction.ID, new ConfigureWorkflowAction());
menu.insertAfter(ExportKnimeWorkflowAction.ID, new Separator());
menu.insertAfter(ExportKnimeWorkflowAction.ID, new OpenCredentialVariablesDialogAction());
menu.insertAfter(ExportKnimeWorkflowAction.ID, new OpenWorkflowVariablesDialogAction());
menu.insertAfter(ExportKnimeWorkflowAction.ID, new Separator());
menu.insertBefore(RefreshAction.ID, new GroupMarker(KNIME_ADDITIONS));
menu.insertBefore(RefreshAction.ID, new Separator());
menu.insertBefore(id, new Separator());
// another bad workaround to replace the first "New" menu manager
// with the "Create New Workflow" action
// store all items, remove all, add the action and then
// add all but the first one
IContributionItem[] items = menu.getItems();
for (IContributionItem item : items) {
menu.remove(item);
}
menu.add(new NewKnimeWorkflowAction(PlatformUI.getWorkbench().getActiveWorkbenchWindow()));
menu.add(new CreateWorkflowGroupAction());
for (int i = 1; i < items.length; i++) {
menu.add(items[i]);
}
}
Aggregations