Search in sources :

Example 26 with SubNodeContainer

use of org.knime.core.node.workflow.SubNodeContainer in project knime-core by knime.

the class ReconfigureMetaNodeCommand method canExecute.

/**
 * {@inheritDoc}
 */
@Override
public boolean canExecute() {
    if (!super.canExecute()) {
        return false;
    }
    if (m_metanodeID == null) {
        return false;
    }
    NodeContainer nc = getHostWFM().getNodeContainer(m_metanodeID);
    boolean isWriteProtected;
    if (nc instanceof WorkflowManager) {
        isWriteProtected = ((WorkflowManager) nc).isWriteProtected();
    } else if (nc instanceof SubNodeContainer) {
        isWriteProtected = ((SubNodeContainer) nc).isWriteProtected();
    } else {
        return false;
    }
    if (!(nc instanceof WorkflowManager) && !(nc instanceof SubNodeContainer)) {
        return false;
    }
    if (isWriteProtected) {
        return false;
    }
    // at least one thing to change should be set
    return (m_inPorts != null || m_outPorts != null || m_name != null);
}
Also used : SubNodeContainer(org.knime.core.node.workflow.SubNodeContainer) WorkflowManager(org.knime.core.node.workflow.WorkflowManager) NodeContainer(org.knime.core.node.workflow.NodeContainer) SubNodeContainer(org.knime.core.node.workflow.SubNodeContainer)

Aggregations

SubNodeContainer (org.knime.core.node.workflow.SubNodeContainer)26 NodeContainer (org.knime.core.node.workflow.NodeContainer)12 WorkflowManager (org.knime.core.node.workflow.WorkflowManager)12 NodeContainerEditPart (org.knime.workbench.editor2.editparts.NodeContainerEditPart)8 NodeID (org.knime.core.node.workflow.NodeID)7 MetaNodeTemplateInformation (org.knime.core.node.workflow.MetaNodeTemplateInformation)6 IOException (java.io.IOException)4 ArrayList (java.util.ArrayList)4 NativeNodeContainer (org.knime.core.node.workflow.NativeNodeContainer)4 File (java.io.File)3 MessageBox (org.eclipse.swt.widgets.MessageBox)3 AbstractExplorerFileStore (org.knime.workbench.explorer.filesystem.AbstractExplorerFileStore)3 AbstractContentProvider (org.knime.workbench.explorer.view.AbstractContentProvider)3 URI (java.net.URI)2 Map (java.util.Map)2 IAction (org.eclipse.jface.action.IAction)2 ConnectionContainer (org.knime.core.node.workflow.ConnectionContainer)2 ConnectionID (org.knime.core.node.workflow.ConnectionID)2 WorkflowContext (org.knime.core.node.workflow.WorkflowContext)2 GUIWorkflowCipherPrompt (org.knime.workbench.editor2.editparts.GUIWorkflowCipherPrompt)2