Search in sources :

Example 1 with AbstractNodeAction

use of org.knime.workbench.editor2.actions.AbstractNodeAction in project knime-core by knime.

the class ShowNodeIdsEditorAction method createAction.

/**
 * {@inheritDoc}
 */
@Override
protected AbstractNodeAction createAction(final WorkflowEditor editor) {
    WorkflowRootEditPart part = (WorkflowRootEditPart) ((editor).getViewer().getRootEditPart().getChildren().get(0));
    ShowNodeIdsAction showNodeIdsAction = new ShowNodeIdsAction(editor);
    showNodeIdsAction.setChecked(part.showNodeId());
    return showNodeIdsAction;
}
Also used : ShowNodeIdsAction(org.knime.workbench.editor2.actions.ShowNodeIdsAction) WorkflowRootEditPart(org.knime.workbench.editor2.editparts.WorkflowRootEditPart)

Example 2 with AbstractNodeAction

use of org.knime.workbench.editor2.actions.AbstractNodeAction in project knime-core by knime.

the class WorkflowContextMenuProvider method buildContextMenu.

/**
 * {@inheritDoc}
 */
@Override
public void buildContextMenu(final IMenuManager manager) {
    final String FLOW_VAR_PORT_GRP = "Flow Variable Ports";
    // add the groups (grouped by separators) in their order first
    manager.add(new Separator(IWorkbenchActionConstants.GROUP_APP));
    manager.add(new Separator(FLOW_VAR_PORT_GRP));
    GEFActionConstants.addStandardActionGroups(manager);
    IAction action;
    action = m_actionRegistry.getAction("cut");
    manager.appendToGroup(GEFActionConstants.GROUP_EDIT, action);
    ((UpdateAction) action).update();
    action = m_actionRegistry.getAction("copy");
    manager.appendToGroup(GEFActionConstants.GROUP_EDIT, action);
    ((UpdateAction) action).update();
    action = m_actionRegistry.getAction(PasteActionContextMenu.ID);
    manager.appendToGroup(GEFActionConstants.GROUP_EDIT, action);
    ((UpdateAction) action).update();
    action = m_actionRegistry.getAction("undo");
    manager.appendToGroup(GEFActionConstants.GROUP_EDIT, action);
    ((UpdateAction) action).update();
    action = m_actionRegistry.getAction("redo");
    manager.appendToGroup(GEFActionConstants.GROUP_EDIT, action);
    ((UpdateAction) action).update();
    action = m_actionRegistry.getAction("delete");
    manager.appendToGroup(GEFActionConstants.GROUP_EDIT, action);
    ((UpdateAction) action).update();
    // Add (some) available actions from the registry to the context menu
    // manager
    // openDialog
    action = m_actionRegistry.getAction(OpenDialogAction.ID);
    manager.appendToGroup(IWorkbenchActionConstants.GROUP_APP, action);
    ((AbstractNodeAction) action).update();
    // execute
    action = m_actionRegistry.getAction(ExecuteAction.ID);
    manager.appendToGroup(IWorkbenchActionConstants.GROUP_APP, action);
    ((AbstractNodeAction) action).update();
    // execute and open first view
    action = m_actionRegistry.getAction(ExecuteAndOpenViewAction.ID);
    manager.appendToGroup(IWorkbenchActionConstants.GROUP_APP, action);
    ((AbstractNodeAction) action).update();
    // cancel execution
    action = m_actionRegistry.getAction(CancelAction.ID);
    manager.appendToGroup(IWorkbenchActionConstants.GROUP_APP, action);
    ((AbstractNodeAction) action).update();
    // show some menu items on LoopEndNodes only
    List parts = m_viewer.getSelectedEditParts();
    if (parts.size() == 1) {
        EditPart p = (EditPart) parts.get(0);
        if (p instanceof NodeContainerEditPart) {
            NodeContainerUI container = (NodeContainerUI) ((NodeContainerEditPart) p).getModel();
            if (container instanceof SingleNodeContainerUI) {
                SingleNodeContainerUI snc = (SingleNodeContainerUI) container;
                Wrapper.unwrapOptional(snc, SingleNodeContainer.class).ifPresent(sncImpl -> {
                    if (sncImpl.isModelCompatibleTo(LoopEndNode.class)) {
                        // pause loop execution
                        IAction loopAction;
                        loopAction = m_actionRegistry.getAction(PauseLoopExecutionAction.ID);
                        manager.appendToGroup(IWorkbenchActionConstants.GROUP_APP, loopAction);
                        ((AbstractNodeAction) loopAction).update();
                        // step loop execution
                        loopAction = m_actionRegistry.getAction(StepLoopAction.ID);
                        manager.appendToGroup(IWorkbenchActionConstants.GROUP_APP, loopAction);
                        ((AbstractNodeAction) loopAction).update();
                        // resume loop execution
                        loopAction = m_actionRegistry.getAction(ResumeLoopAction.ID);
                        manager.appendToGroup(IWorkbenchActionConstants.GROUP_APP, loopAction);
                        ((AbstractNodeAction) loopAction).update();
                    }
                });
            }
        }
    }
    // reset
    action = m_actionRegistry.getAction(ResetAction.ID);
    manager.appendToGroup(IWorkbenchActionConstants.GROUP_APP, action);
    ((AbstractNodeAction) action).update();
    // set name and description
    action = m_actionRegistry.getAction(SetNodeDescriptionAction.ID);
    manager.appendToGroup(IWorkbenchActionConstants.GROUP_APP, action);
    ((AbstractNodeAction) action).update();
    // add workflow annotation
    action = m_actionRegistry.getAction(AddAnnotationAction.ID);
    AddAnnotationAction aaa = (AddAnnotationAction) action;
    aaa.setLocation(m_lastLocation.x, m_lastLocation.y);
    manager.appendToGroup(IWorkbenchActionConstants.GROUP_APP, action);
    ((AbstractNodeAction) action).update();
    // collapse metanodes
    action = m_actionRegistry.getAction(CollapseMetaNodeAction.ID);
    manager.appendToGroup(IWorkbenchActionConstants.GROUP_APP, action);
    ((AbstractNodeAction) action).update();
    action = m_actionRegistry.getAction(EncapsulateSubNodeAction.ID);
    manager.appendToGroup(IWorkbenchActionConstants.GROUP_APP, action);
    ((AbstractNodeAction) action).update();
    // insert "select loop" if loop nodes are selected
    boolean addSelectLoop = true;
    for (Object p : parts) {
        if (!(p instanceof NodeContainerEditPart)) {
            addSelectLoop = false;
            break;
        }
        NodeContainerUI nc = ((NodeContainerEditPart) p).getNodeContainer();
        if (!(nc instanceof SingleNodeContainerUI)) {
            addSelectLoop = false;
            break;
        }
        if (!((SingleNodeContainerUI) nc).isMemberOfScope()) {
            addSelectLoop = false;
            break;
        }
    }
    if (addSelectLoop) {
        action = m_actionRegistry.getAction(SelectLoopAction.ID);
        manager.appendToGroup(IWorkbenchActionConstants.GROUP_APP, action);
        ((AbstractNodeAction) action).update();
    }
    IMenuManager metanodeMenuMgr = null;
    IMenuManager subnodeMenuMgr = null;
    IMenuManager subnodeViewMgr = null;
    // depending on the current selection: add the actions for the port
    // views and the node views
    // also check whether this node part is a meta-node
    // if so offer the "edit meta-node" option
    // all these feature are only offered if exactly 1 part is selected
    parts = m_viewer.getSelectedEditParts();
    // by now, we only support one part...
    if (parts.size() == 1) {
        EditPart p = (EditPart) parts.get(0);
        if (p instanceof WorkflowInPortBarEditPart) {
            WorkflowInPortBarEditPart root = (WorkflowInPortBarEditPart) p;
            manager.add(new Separator("outPortViews"));
            for (Object o : p.getChildren()) {
                EditPart child = (EditPart) o;
                if (child instanceof WorkflowInPortEditPart && ((WorkflowInPortEditPart) child).isSelected()) {
                    final WorkflowManager wm = Wrapper.unwrapWFM(((WorkflowPortBar) root.getModel()).getWorkflowManager());
                    action = new OpenWorkflowPortViewAction(wm, ((WorkflowInPortEditPart) child).getIndex(), wm.getNrInPorts());
                    manager.appendToGroup("outPortViews", action);
                    ((WorkflowInPortEditPart) child).setSelected(false);
                }
            }
        }
        if (p instanceof NodeContainerEditPart) {
            NodeContainerUI container = null;
            container = (NodeContainerUI) ((NodeContainerEditPart) p).getModel();
            if (!(container instanceof WorkflowManagerUI)) {
                action = m_actionRegistry.getAction(ToggleFlowVarPortsAction.ID);
                manager.appendToGroup(FLOW_VAR_PORT_GRP, action);
                ((AbstractNodeAction) action).update();
            }
            // add for node views option if applicable
            int numNodeViews = container.getNrViews();
            for (int i = 0; i < numNodeViews; i++) {
                action = new OpenViewAction(unwrapNC(container), i);
                manager.appendToGroup(IWorkbenchActionConstants.GROUP_APP, action);
            }
            // add interactive view options
            if (container.hasInteractiveView()) {
                action = new OpenInteractiveViewAction(unwrapNC(container));
                manager.appendToGroup(IWorkbenchActionConstants.GROUP_APP, action);
            } else {
                // TODO for subnodes move to submenu?
                if (wraps(container, NativeNodeContainer.class)) {
                    InteractiveWebViewsResult interactiveWebViewsResult = unwrapNC(container).getInteractiveWebViews();
                    for (int i = 0; i < interactiveWebViewsResult.size(); i++) {
                        action = new OpenInteractiveWebViewAction(unwrapNC(container), interactiveWebViewsResult.get(i));
                        manager.appendToGroup(IWorkbenchActionConstants.GROUP_APP, action);
                    }
                }
            }
            if (container instanceof WorkflowManagerUI) {
                metanodeMenuMgr = getMetaNodeMenuManager(metanodeMenuMgr, manager);
                // OPEN META NODE
                action = new OpenSubworkflowEditorAction((NodeContainerEditPart) p);
                metanodeMenuMgr.appendToGroup(GROUP_METANODE, action);
                // EXPAND META NODE
                action = m_actionRegistry.getAction(ExpandMetaNodeAction.ID);
                metanodeMenuMgr.appendToGroup(GROUP_METANODE, action);
                ((AbstractNodeAction) action).update();
                // RECONFIGURE META NODE
                if (parts.size() == 1) {
                    action = m_actionRegistry.getAction(MetaNodeReconfigureAction.ID);
                    metanodeMenuMgr.appendToGroup(GROUP_METANODE, action);
                    ((AbstractNodeAction) action).update();
                }
                // WRAP
                action = m_actionRegistry.getAction(ConvertMetaNodeToSubNodeAction.ID);
                metanodeMenuMgr.appendToGroup(GROUP_METANODE, action);
                ((AbstractNodeAction) action).update();
            }
            // SUBNODE
            if (container instanceof SubNodeContainerUI) {
                subnodeMenuMgr = getSubNodeMenuManager(subnodeMenuMgr, manager);
                // OPEN SUBNODE
                action = new OpenSubNodeEditorAction((NodeContainerEditPart) p);
                subnodeMenuMgr.appendToGroup(GROUP_SUBNODE, action);
                // EXPAND SUBNODE
                action = m_actionRegistry.getAction(ExpandSubNodeAction.ID);
                subnodeMenuMgr.appendToGroup(GROUP_SUBNODE, action);
                ((AbstractNodeAction) action).update();
                // RECONFIGURE SUBNODE
                action = m_actionRegistry.getAction(SubNodeReconfigureAction.ID);
                subnodeMenuMgr.appendToGroup(GROUP_SUBNODE, action);
                ((AbstractNodeAction) action).update();
                // UNWRAP
                action = m_actionRegistry.getAction(ConvertSubNodeToMetaNodeAction.ID);
                subnodeMenuMgr.appendToGroup(GROUP_SUBNODE, action);
                ((AbstractNodeAction) action).update();
                if (wraps(container, SubNodeContainer.class)) {
                    InteractiveWebViewsResult interactiveWebViewsResult = unwrapNC(container).getInteractiveWebViews();
                    if (interactiveWebViewsResult.size() > 0) {
                        subnodeViewMgr = getSingleSubNodeViewsMenuManager(subnodeViewMgr, subnodeMenuMgr);
                        for (int i = 0; i < interactiveWebViewsResult.size(); i++) {
                            action = new OpenInteractiveWebViewAction(unwrapNC(container), interactiveWebViewsResult.get(i));
                            subnodeViewMgr.appendToGroup(GROUP_SUBNODE_VIEWS, action);
                        }
                    }
                    action = new OpenSubnodeWebViewAction(Wrapper.unwrap(container, SubNodeContainer.class));
                    manager.appendToGroup(IWorkbenchActionConstants.GROUP_APP, action);
                }
            }
            // add port views
            manager.add(new Separator("outPortViews"));
            int numOutPorts = container.getNrOutPorts();
            for (int i = 0; i < numOutPorts; i++) {
                if (i == 0 && !(container instanceof WorkflowManagerUI)) {
                    // skip the implicit flow var ports on "normal" nodes
                    continue;
                }
                if (wraps(container, NodeContainer.class)) {
                    action = new OpenPortViewAction(unwrapNC(container), i, numOutPorts);
                    manager.appendToGroup("outPortViews", action);
                }
            }
        }
    }
    boolean addMetaNodeActions = false;
    boolean addSubNodeActions = false;
    for (Object p : parts) {
        if (p instanceof NodeContainerEditPart) {
            NodeContainerUI model = ((NodeContainerEditPart) p).getNodeContainer();
            if (model instanceof WorkflowManagerUI) {
                addMetaNodeActions = true;
            } else if (model instanceof SubNodeContainerUI) {
                addSubNodeActions = true;
            }
        }
    }
    if (addMetaNodeActions) {
        metanodeMenuMgr = getMetaNodeMenuManager(metanodeMenuMgr, manager);
        // SAVE AS TEMPLATE
        action = m_actionRegistry.getAction(SaveAsMetaNodeTemplateAction.ID);
        metanodeMenuMgr.appendToGroup(GROUP_METANODE_LINKS, action);
        ((AbstractNodeAction) action).update();
        // CHECK UPDATE
        action = m_actionRegistry.getAction(CheckUpdateMetaNodeLinkAction.ID);
        metanodeMenuMgr.appendToGroup(GROUP_METANODE_LINKS, action);
        ((AbstractNodeAction) action).update();
        // DISCONNECT
        action = m_actionRegistry.getAction(DisconnectMetaNodeLinkAction.ID);
        metanodeMenuMgr.appendToGroup(GROUP_METANODE_LINKS, action);
        ((AbstractNodeAction) action).update();
        // LINK TYPE
        action = m_actionRegistry.getAction(ChangeMetaNodeLinkAction.ID);
        metanodeMenuMgr.appendToGroup(GROUP_METANODE_LINKS, action);
        ((AbstractNodeAction) action).update();
        // REVEAL TEMPLATE
        action = m_actionRegistry.getAction(RevealMetaNodeTemplateAction.ID);
        metanodeMenuMgr.appendToGroup(GROUP_METANODE_LINKS, action);
        ((AbstractNodeAction) action).update();
        // LOCK
        if (Boolean.getBoolean(KNIMEConstants.PROPERTY_SHOW_METANODE_LOCK_ACTION)) {
            action = m_actionRegistry.getAction(LockMetaNodeAction.ID);
            metanodeMenuMgr.appendToGroup(GROUP_METANODE, action);
            ((AbstractNodeAction) action).update();
        }
    }
    if (addSubNodeActions) {
        subnodeMenuMgr = getSubNodeMenuManager(subnodeMenuMgr, manager);
        // SAVE AS TEMPLATE (SUBNODE)
        action = m_actionRegistry.getAction(SaveAsSubNodeTemplateAction.ID);
        subnodeMenuMgr.appendToGroup(GROUP_SUBNODE_LINKS, action);
        ((AbstractNodeAction) action).update();
        // CHECK UPDATE (SUBNODE)
        action = m_actionRegistry.getAction(CheckUpdateMetaNodeLinkAction.ID);
        subnodeMenuMgr.appendToGroup(GROUP_SUBNODE_LINKS, action);
        ((AbstractNodeAction) action).update();
        // DISCONNECT LINK (SUBNODE)
        action = m_actionRegistry.getAction(DisconnectSubNodeLinkAction.ID);
        subnodeMenuMgr.appendToGroup(GROUP_SUBNODE_LINKS, action);
        ((AbstractNodeAction) action).update();
        // CHANGE LINK (SUBNODE)
        action = m_actionRegistry.getAction(ChangeSubNodeLinkAction.ID);
        subnodeMenuMgr.appendToGroup(GROUP_SUBNODE_LINKS, action);
        ((AbstractNodeAction) action).update();
        // REVEAL TEMPLATE (SUBNODE)
        action = m_actionRegistry.getAction(RevealSubNodeTemplateAction.ID);
        subnodeMenuMgr.appendToGroup(GROUP_SUBNODE_LINKS, action);
        ((AbstractNodeAction) action).update();
        // LOCK SUBNODE
        if (Boolean.getBoolean(KNIMEConstants.PROPERTY_SHOW_METANODE_LOCK_ACTION)) {
            action = m_actionRegistry.getAction(LockSubNodeAction.ID);
            subnodeMenuMgr.appendToGroup(GROUP_SUBNODE, action);
            ((AbstractNodeAction) action).update();
        }
    }
    manager.updateAll(true);
}
Also used : NodeContainerUI(org.knime.core.ui.node.workflow.NodeContainerUI) SubNodeContainerUI(org.knime.core.ui.node.workflow.SubNodeContainerUI) SingleNodeContainerUI(org.knime.core.ui.node.workflow.SingleNodeContainerUI) SingleNodeContainerUI(org.knime.core.ui.node.workflow.SingleNodeContainerUI) WorkflowManager(org.knime.core.node.workflow.WorkflowManager) ExecuteAndOpenViewAction(org.knime.workbench.editor2.actions.ExecuteAndOpenViewAction) OpenViewAction(org.knime.workbench.editor2.actions.OpenViewAction) OpenInteractiveWebViewAction(org.knime.workbench.editor2.actions.OpenInteractiveWebViewAction) AddAnnotationAction(org.knime.workbench.editor2.actions.AddAnnotationAction) WorkflowInPortBarEditPart(org.knime.workbench.editor2.editparts.WorkflowInPortBarEditPart) NodeContainerEditPart(org.knime.workbench.editor2.editparts.NodeContainerEditPart) OpenPortViewAction(org.knime.workbench.editor2.actions.OpenPortViewAction) AbstractNodeAction(org.knime.workbench.editor2.actions.AbstractNodeAction) OpenSubNodeEditorAction(org.knime.workbench.editor2.actions.OpenSubNodeEditorAction) List(java.util.List) WorkflowInPortEditPart(org.knime.workbench.editor2.editparts.WorkflowInPortEditPart) SingleNodeContainer(org.knime.core.node.workflow.SingleNodeContainer) IAction(org.eclipse.jface.action.IAction) OpenSubworkflowEditorAction(org.knime.workbench.editor2.actions.OpenSubworkflowEditorAction) UpdateAction(org.eclipse.gef.ui.actions.UpdateAction) OpenInteractiveViewAction(org.knime.workbench.editor2.actions.OpenInteractiveViewAction) WorkflowInPortBarEditPart(org.knime.workbench.editor2.editparts.WorkflowInPortBarEditPart) EditPart(org.eclipse.gef.EditPart) WorkflowInPortEditPart(org.knime.workbench.editor2.editparts.WorkflowInPortEditPart) NodeContainerEditPart(org.knime.workbench.editor2.editparts.NodeContainerEditPart) WorkflowManagerUI(org.knime.core.ui.node.workflow.WorkflowManagerUI) SubNodeContainerUI(org.knime.core.ui.node.workflow.SubNodeContainerUI) Point(org.eclipse.swt.graphics.Point) OpenSubnodeWebViewAction(org.knime.workbench.editor2.actions.OpenSubnodeWebViewAction) OpenWorkflowPortViewAction(org.knime.workbench.editor2.actions.OpenWorkflowPortViewAction) IMenuManager(org.eclipse.jface.action.IMenuManager) InteractiveWebViewsResult(org.knime.core.node.workflow.action.InteractiveWebViewsResult) Separator(org.eclipse.jface.action.Separator)

Example 3 with AbstractNodeAction

use of org.knime.workbench.editor2.actions.AbstractNodeAction in project knime-core by knime.

the class WorkflowEditor method createActions.

/**
 * Creates the editor actions.
 *
 * @see org.eclipse.gef.ui.parts.GraphicalEditor#createActions()
 */
@Override
protected void createActions() {
    LOGGER.debug("creating editor actions...");
    // super already does something for us...
    super.createActions();
    // Stack actions
    StackAction undo = new UndoAction(this);
    StackAction redo = new RedoAction(this);
    // Editor Actions
    WorkbenchPartAction delete = new NodeConnectionContainerDeleteAction(this);
    WorkbenchPartAction save = new SaveAction(this);
    WorkbenchPartAction saveAs = new SaveAsAction(this);
    WorkbenchPartAction print = new PrintAction(this);
    WorkbenchPartAction hideNodeName = new HideNodeNamesAction(this);
    WorkbenchPartAction showNodeIdAction = new ShowNodeIdsAction(this);
    // node actions
    // 
    AbstractNodeAction openDialog = new OpenDialogAction(this);
    AbstractNodeAction execute = new ExecuteAction(this);
    AbstractNodeAction executeAll = new ExecuteAllAction(this);
    AbstractNodeAction cancelAll = new CancelAllAction(this);
    AbstractNodeAction cancel = new CancelAction(this);
    AbstractNodeAction pause = new PauseLoopExecutionAction(this);
    AbstractNodeAction step = new StepLoopAction(this);
    AbstractNodeAction resume = new ResumeLoopAction(this);
    AbstractNodeAction executeAndView = new ExecuteAndOpenViewAction(this);
    AbstractNodeAction reset = new ResetAction(this);
    AbstractNodeAction selectScope = new SelectLoopAction(this);
    AbstractNodeAction setNameAndDescription = new SetNodeDescriptionAction(this);
    AbstractNodeAction toggleFlowVarPorts = new ToggleFlowVarPortsAction(this);
    AbstractNodeAction defaultOpenView = new DefaultOpenViewAction(this);
    AbstractNodeAction metaNodeReConfigure = new MetaNodeReconfigureAction(this);
    AbstractNodeAction metaNodeChangeLink = new ChangeMetaNodeLinkAction(this);
    AbstractNodeAction defineMetaNodeTemplate = new SaveAsMetaNodeTemplateAction(this);
    AbstractNodeAction checkUpdateMetaNodeLink = new CheckUpdateMetaNodeLinkAction(this);
    AbstractNodeAction revealMetaNodeTemplate = new RevealMetaNodeTemplateAction(this);
    AbstractNodeAction disconnectMetaNodeLink = new DisconnectMetaNodeLinkAction(this);
    AbstractNodeAction lockMetaLink = new LockMetaNodeAction(this);
    AbstractNodeAction subNodeReConfigure = new SubNodeReconfigureAction(this);
    AbstractNodeAction subNodeChangeLink = new ChangeSubNodeLinkAction(this);
    AbstractNodeAction defineSubNodeTemplate = new SaveAsSubNodeTemplateAction(this);
    AbstractNodeAction checkUpdateSubNodeLink = new CheckUpdateMetaNodeLinkAction(this);
    AbstractNodeAction revealSubNodeTemplate = new RevealSubNodeTemplateAction(this);
    AbstractNodeAction disconnectSubNodeLink = new DisconnectSubNodeLinkAction(this);
    AbstractNodeAction lockSubLink = new LockSubNodeAction(this);
    // new annotation action
    AddAnnotationAction annotation = new AddAnnotationAction(this);
    // copy / cut / paste action
    CopyAction copy = new CopyAction(this);
    CutAction cut = new CutAction(this);
    PasteAction paste = new PasteAction(this);
    PasteActionContextMenu pasteContext = new PasteActionContextMenu(this);
    CollapseMetaNodeAction collapse = new CollapseMetaNodeAction(this);
    EncapsulateSubNodeAction encapsulate = new EncapsulateSubNodeAction(this);
    ExpandMetaNodeAction expand = new ExpandMetaNodeAction(this);
    ExpandSubNodeAction expandSub = new ExpandSubNodeAction(this);
    ConvertMetaNodeToSubNodeAction wrap = new ConvertMetaNodeToSubNodeAction(this);
    ConvertSubNodeToMetaNodeAction unWrap = new ConvertSubNodeToMetaNodeAction(this);
    // register the actions
    m_actionRegistry.registerAction(undo);
    m_actionRegistry.registerAction(redo);
    m_actionRegistry.registerAction(delete);
    m_actionRegistry.registerAction(save);
    m_actionRegistry.registerAction(saveAs);
    m_actionRegistry.registerAction(print);
    m_actionRegistry.registerAction(openDialog);
    m_actionRegistry.registerAction(execute);
    m_actionRegistry.registerAction(executeAll);
    m_actionRegistry.registerAction(cancelAll);
    m_actionRegistry.registerAction(cancel);
    m_actionRegistry.registerAction(pause);
    m_actionRegistry.registerAction(step);
    m_actionRegistry.registerAction(resume);
    m_actionRegistry.registerAction(executeAndView);
    m_actionRegistry.registerAction(reset);
    m_actionRegistry.registerAction(selectScope);
    m_actionRegistry.registerAction(toggleFlowVarPorts);
    m_actionRegistry.registerAction(setNameAndDescription);
    m_actionRegistry.registerAction(defaultOpenView);
    m_actionRegistry.registerAction(copy);
    m_actionRegistry.registerAction(cut);
    m_actionRegistry.registerAction(paste);
    m_actionRegistry.registerAction(pasteContext);
    m_actionRegistry.registerAction(hideNodeName);
    m_actionRegistry.registerAction(showNodeIdAction);
    m_actionRegistry.registerAction(collapse);
    m_actionRegistry.registerAction(encapsulate);
    m_actionRegistry.registerAction(expand);
    m_actionRegistry.registerAction(expandSub);
    m_actionRegistry.registerAction(wrap);
    m_actionRegistry.registerAction(unWrap);
    m_actionRegistry.registerAction(metaNodeReConfigure);
    m_actionRegistry.registerAction(metaNodeChangeLink);
    m_actionRegistry.registerAction(defineMetaNodeTemplate);
    m_actionRegistry.registerAction(checkUpdateMetaNodeLink);
    m_actionRegistry.registerAction(revealMetaNodeTemplate);
    m_actionRegistry.registerAction(disconnectMetaNodeLink);
    m_actionRegistry.registerAction(lockMetaLink);
    m_actionRegistry.registerAction(subNodeReConfigure);
    m_actionRegistry.registerAction(subNodeChangeLink);
    m_actionRegistry.registerAction(defineSubNodeTemplate);
    m_actionRegistry.registerAction(checkUpdateSubNodeLink);
    m_actionRegistry.registerAction(revealSubNodeTemplate);
    m_actionRegistry.registerAction(disconnectSubNodeLink);
    m_actionRegistry.registerAction(lockSubLink);
    m_actionRegistry.registerAction(annotation);
    // remember ids for later updates via 'updateActions'
    m_editorActions = new ArrayList<String>();
    m_editorActions.add(undo.getId());
    m_editorActions.add(redo.getId());
    m_editorActions.add(delete.getId());
    m_editorActions.add(save.getId());
    m_editorActions.add(saveAs.getId());
    m_editorActions.add(openDialog.getId());
    m_editorActions.add(execute.getId());
    m_editorActions.add(executeAll.getId());
    m_editorActions.add(cancelAll.getId());
    m_editorActions.add(executeAndView.getId());
    m_editorActions.add(reset.getId());
    m_editorActions.add(setNameAndDescription.getId());
    m_editorActions.add(toggleFlowVarPorts.getId());
    m_editorActions.add(defaultOpenView.getId());
    m_editorActions.add(hideNodeName.getId());
    m_editorActions.add(showNodeIdAction.getId());
    m_editorActions.add(collapse.getId());
    m_editorActions.add(expand.getId());
    m_editorActions.add(unWrap.getId());
    m_editorActions.add(copy.getId());
    m_editorActions.add(cut.getId());
    m_editorActions.add(paste.getId());
    m_editorActions.add(metaNodeReConfigure.getId());
    m_editorActions.add(subNodeReConfigure.getId());
    m_editorActions.add(metaNodeChangeLink.getId());
    m_editorActions.add(defineMetaNodeTemplate.getId());
    m_editorActions.add(checkUpdateMetaNodeLink.getId());
    m_editorActions.add(annotation.getId());
}
Also used : StackAction(org.eclipse.gef.ui.actions.StackAction) SaveAsAction(org.knime.workbench.editor2.actions.SaveAsAction) DisconnectMetaNodeLinkAction(org.knime.workbench.editor2.actions.DisconnectMetaNodeLinkAction) HideNodeNamesAction(org.knime.workbench.editor2.actions.HideNodeNamesAction) RedoAction(org.eclipse.gef.ui.actions.RedoAction) AbstractNodeAction(org.knime.workbench.editor2.actions.AbstractNodeAction) ExecuteAndOpenViewAction(org.knime.workbench.editor2.actions.ExecuteAndOpenViewAction) ChangeMetaNodeLinkAction(org.knime.workbench.editor2.actions.ChangeMetaNodeLinkAction) ExecuteAction(org.knime.workbench.editor2.actions.ExecuteAction) CheckUpdateMetaNodeLinkAction(org.knime.workbench.editor2.actions.CheckUpdateMetaNodeLinkAction) SetNodeDescriptionAction(org.knime.workbench.editor2.actions.SetNodeDescriptionAction) ExpandMetaNodeAction(org.knime.workbench.editor2.actions.ExpandMetaNodeAction) ToggleFlowVarPortsAction(org.knime.workbench.editor2.actions.ToggleFlowVarPortsAction) SubNodeReconfigureAction(org.knime.workbench.editor2.actions.SubNodeReconfigureAction) MetaNodeReconfigureAction(org.knime.workbench.editor2.actions.MetaNodeReconfigureAction) DefaultOpenViewAction(org.knime.workbench.editor2.actions.DefaultOpenViewAction) PauseLoopExecutionAction(org.knime.workbench.editor2.actions.PauseLoopExecutionAction) ResumeLoopAction(org.knime.workbench.editor2.actions.ResumeLoopAction) WorkbenchPartAction(org.eclipse.gef.ui.actions.WorkbenchPartAction) SaveAction(org.eclipse.gef.ui.actions.SaveAction) CutAction(org.knime.workbench.editor2.actions.CutAction) ShowNodeIdsAction(org.knime.workbench.editor2.actions.ShowNodeIdsAction) PrintAction(org.eclipse.gef.ui.actions.PrintAction) CancelAction(org.knime.workbench.editor2.actions.CancelAction) CollapseMetaNodeAction(org.knime.workbench.editor2.actions.CollapseMetaNodeAction) AddAnnotationAction(org.knime.workbench.editor2.actions.AddAnnotationAction) StepLoopAction(org.knime.workbench.editor2.actions.StepLoopAction) ExecuteAllAction(org.knime.workbench.editor2.actions.ExecuteAllAction) DisconnectSubNodeLinkAction(org.knime.workbench.editor2.actions.DisconnectSubNodeLinkAction) RevealSubNodeTemplateAction(org.knime.workbench.editor2.actions.RevealSubNodeTemplateAction) NodeConnectionContainerDeleteAction(org.knime.workbench.editor2.actions.NodeConnectionContainerDeleteAction) SaveAsMetaNodeTemplateAction(org.knime.workbench.editor2.actions.SaveAsMetaNodeTemplateAction) ConvertMetaNodeToSubNodeAction(org.knime.workbench.editor2.actions.ConvertMetaNodeToSubNodeAction) ConvertSubNodeToMetaNodeAction(org.knime.workbench.editor2.actions.ConvertSubNodeToMetaNodeAction) CopyAction(org.knime.workbench.editor2.actions.CopyAction) LockMetaNodeAction(org.knime.workbench.editor2.actions.LockMetaNodeAction) PasteActionContextMenu(org.knime.workbench.editor2.actions.PasteActionContextMenu) SelectLoopAction(org.knime.workbench.editor2.actions.SelectLoopAction) RevealMetaNodeTemplateAction(org.knime.workbench.editor2.actions.RevealMetaNodeTemplateAction) EncapsulateSubNodeAction(org.knime.workbench.editor2.actions.EncapsulateSubNodeAction) ExpandSubNodeAction(org.knime.workbench.editor2.actions.ExpandSubNodeAction) PasteAction(org.knime.workbench.editor2.actions.PasteAction) ResetAction(org.knime.workbench.editor2.actions.ResetAction) LockSubNodeAction(org.knime.workbench.editor2.actions.LockSubNodeAction) ChangeSubNodeLinkAction(org.knime.workbench.editor2.actions.ChangeSubNodeLinkAction) SaveAsSubNodeTemplateAction(org.knime.workbench.editor2.actions.SaveAsSubNodeTemplateAction) UndoAction(org.eclipse.gef.ui.actions.UndoAction) CancelAllAction(org.knime.workbench.editor2.actions.CancelAllAction) OpenDialogAction(org.knime.workbench.editor2.actions.OpenDialogAction)

Example 4 with AbstractNodeAction

use of org.knime.workbench.editor2.actions.AbstractNodeAction in project knime-core by knime.

the class HideNodeNamesEditorAction method createAction.

/**
 * {@inheritDoc}
 */
@Override
protected AbstractNodeAction createAction(final WorkflowEditor editor) {
    WorkflowRootEditPart part = (WorkflowRootEditPart) ((editor).getViewer().getRootEditPart().getChildren().get(0));
    HideNodeNamesAction hideNodeIdsAction = new HideNodeNamesAction(editor);
    hideNodeIdsAction.setChecked(part.hideNodeNames());
    return hideNodeIdsAction;
}
Also used : HideNodeNamesAction(org.knime.workbench.editor2.actions.HideNodeNamesAction) WorkflowRootEditPart(org.knime.workbench.editor2.editparts.WorkflowRootEditPart)

Aggregations

AbstractNodeAction (org.knime.workbench.editor2.actions.AbstractNodeAction)2 AddAnnotationAction (org.knime.workbench.editor2.actions.AddAnnotationAction)2 ExecuteAndOpenViewAction (org.knime.workbench.editor2.actions.ExecuteAndOpenViewAction)2 HideNodeNamesAction (org.knime.workbench.editor2.actions.HideNodeNamesAction)2 List (java.util.List)1 EditPart (org.eclipse.gef.EditPart)1 PrintAction (org.eclipse.gef.ui.actions.PrintAction)1 RedoAction (org.eclipse.gef.ui.actions.RedoAction)1 SaveAction (org.eclipse.gef.ui.actions.SaveAction)1 StackAction (org.eclipse.gef.ui.actions.StackAction)1 UndoAction (org.eclipse.gef.ui.actions.UndoAction)1 UpdateAction (org.eclipse.gef.ui.actions.UpdateAction)1 WorkbenchPartAction (org.eclipse.gef.ui.actions.WorkbenchPartAction)1 IAction (org.eclipse.jface.action.IAction)1 IMenuManager (org.eclipse.jface.action.IMenuManager)1 Separator (org.eclipse.jface.action.Separator)1 Point (org.eclipse.swt.graphics.Point)1 SingleNodeContainer (org.knime.core.node.workflow.SingleNodeContainer)1 WorkflowManager (org.knime.core.node.workflow.WorkflowManager)1 InteractiveWebViewsResult (org.knime.core.node.workflow.action.InteractiveWebViewsResult)1