Search in sources :

Example 1 with EditMetaInfoAction

use of org.knime.workbench.ui.navigator.actions.EditMetaInfoAction 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]);
    }
}
Also used : EditMetaInfoAction(org.knime.workbench.ui.navigator.actions.EditMetaInfoAction) IContributionItem(org.eclipse.jface.action.IContributionItem) CancelWorkflowAction(org.knime.workbench.ui.navigator.actions.CancelWorkflowAction) GoIntoAction(org.eclipse.ui.views.framelist.GoIntoAction) OpenInNewWindowAction(org.eclipse.ui.actions.OpenInNewWindowAction) WFShowJobMgrViewAction(org.knime.workbench.ui.navigator.actions.WFShowJobMgrViewAction) ExportKnimeWorkflowAction(org.knime.workbench.ui.navigator.actions.ExportKnimeWorkflowAction) ResetWorkflowAction(org.knime.workbench.ui.navigator.actions.ResetWorkflowAction) ImportKnimeWorkflowAction(org.knime.workbench.ui.navigator.actions.ImportKnimeWorkflowAction) ExecuteWorkflowAction(org.knime.workbench.ui.navigator.actions.ExecuteWorkflowAction) ActionContributionItem(org.eclipse.jface.action.ActionContributionItem) MoveWorkflowAction(org.knime.workbench.ui.navigator.actions.MoveWorkflowAction) ConfigureWorkflowAction(org.knime.workbench.ui.navigator.actions.ConfigureWorkflowAction) OpenCredentialVariablesDialogAction(org.knime.workbench.ui.navigator.actions.OpenCredentialVariablesDialogAction) OpenWorkflowVariablesDialogAction(org.knime.workbench.ui.navigator.actions.OpenWorkflowVariablesDialogAction) GroupMarker(org.eclipse.jface.action.GroupMarker) CreateWorkflowGroupAction(org.knime.workbench.ui.navigator.actions.CreateWorkflowGroupAction) Separator(org.eclipse.jface.action.Separator) CloseUnrelatedProjectsAction(org.eclipse.ui.actions.CloseUnrelatedProjectsAction)

Aggregations

ActionContributionItem (org.eclipse.jface.action.ActionContributionItem)1 GroupMarker (org.eclipse.jface.action.GroupMarker)1 IContributionItem (org.eclipse.jface.action.IContributionItem)1 Separator (org.eclipse.jface.action.Separator)1 CloseUnrelatedProjectsAction (org.eclipse.ui.actions.CloseUnrelatedProjectsAction)1 OpenInNewWindowAction (org.eclipse.ui.actions.OpenInNewWindowAction)1 GoIntoAction (org.eclipse.ui.views.framelist.GoIntoAction)1 CancelWorkflowAction (org.knime.workbench.ui.navigator.actions.CancelWorkflowAction)1 ConfigureWorkflowAction (org.knime.workbench.ui.navigator.actions.ConfigureWorkflowAction)1 CreateWorkflowGroupAction (org.knime.workbench.ui.navigator.actions.CreateWorkflowGroupAction)1 EditMetaInfoAction (org.knime.workbench.ui.navigator.actions.EditMetaInfoAction)1 ExecuteWorkflowAction (org.knime.workbench.ui.navigator.actions.ExecuteWorkflowAction)1 ExportKnimeWorkflowAction (org.knime.workbench.ui.navigator.actions.ExportKnimeWorkflowAction)1 ImportKnimeWorkflowAction (org.knime.workbench.ui.navigator.actions.ImportKnimeWorkflowAction)1 MoveWorkflowAction (org.knime.workbench.ui.navigator.actions.MoveWorkflowAction)1 OpenCredentialVariablesDialogAction (org.knime.workbench.ui.navigator.actions.OpenCredentialVariablesDialogAction)1 OpenWorkflowVariablesDialogAction (org.knime.workbench.ui.navigator.actions.OpenWorkflowVariablesDialogAction)1 ResetWorkflowAction (org.knime.workbench.ui.navigator.actions.ResetWorkflowAction)1 WFShowJobMgrViewAction (org.knime.workbench.ui.navigator.actions.WFShowJobMgrViewAction)1