Search in sources :

Example 6 with NodeContainer

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

the class ExecuteAndOpenViewAction method getToolTipText.

/**
 * {@inheritDoc}
 */
@Override
public String getToolTipText() {
    String tooltip = "Execute the selected node";
    NodeContainerEditPart[] parts = getSelectedParts(NodeContainerEditPart.class);
    if (parts.length == 1) {
        NodeContainer nc = Wrapper.unwrapNC(parts[0].getNodeContainer());
        if (nc.hasInteractiveView() || nc.getInteractiveWebViews().size() > 0) {
            return tooltip + " and open interactive view.";
        }
    } else {
        tooltip += "s";
    }
    return tooltip + " and open first view.";
}
Also used : NodeContainerEditPart(org.knime.workbench.editor2.editparts.NodeContainerEditPart) SubNodeContainer(org.knime.core.node.workflow.SubNodeContainer) NodeContainer(org.knime.core.node.workflow.NodeContainer)

Example 7 with NodeContainer

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

the class ExecuteAndOpenViewAction method runOnNodes.

/**
 * Execute all selected nodes and open their first view (if available).
 *
 * {@inheritDoc}
 */
@Override
public void runOnNodes(final NodeContainerEditPart[] nodeParts) {
    LOGGER.debug("Creating 'Execute and Open Views' job for " + nodeParts.length + " node(s)...");
    for (NodeContainerEditPart p : nodeParts) {
        final NodeContainer cont = unwrapNC(p.getNodeContainer());
        executeAndOpen(cont);
    }
    try {
        // Give focus to the editor again. Otherwise the actions (selection)
        // is not updated correctly.
        getWorkbenchPart().getSite().getPage().activate(getWorkbenchPart());
    } catch (Exception e) {
    // ignore
    }
}
Also used : NodeContainerEditPart(org.knime.workbench.editor2.editparts.NodeContainerEditPart) SubNodeContainer(org.knime.core.node.workflow.SubNodeContainer) NodeContainer(org.knime.core.node.workflow.NodeContainer)

Example 8 with NodeContainer

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

the class SelectLoopAction method runOnNodes.

/**
 * {@inheritDoc}
 */
@Override
public void runOnNodes(final NodeContainerEditPart[] nodeParts) {
    WorkflowManager wfm = getManager();
    for (NodeContainerEditPart selNode : nodeParts) {
        NodeContainerUI selNC = selNode.getNodeContainer();
        if (selNC instanceof SingleNodeContainerUI) {
            EditPartViewer viewer = selNode.getViewer();
            List<NodeContainer> loopNodes = wfm.getNodesInScope(Wrapper.unwrap(selNC, SingleNodeContainer.class));
            for (NodeContainer nc : loopNodes) {
                NodeContainerEditPart sel = (NodeContainerEditPart) viewer.getEditPartRegistry().get(NodeContainerWrapper.wrap(nc));
                viewer.appendSelection(sel);
            }
        }
    }
    try {
        // Give focus to the editor again. Otherwise the actions (selection)
        // is not updated correctly.
        getWorkbenchPart().getSite().getPage().activate(getWorkbenchPart());
    } catch (Exception e) {
    // ignore
    }
}
Also used : NodeContainerUI(org.knime.core.ui.node.workflow.NodeContainerUI) SingleNodeContainerUI(org.knime.core.ui.node.workflow.SingleNodeContainerUI) SingleNodeContainerUI(org.knime.core.ui.node.workflow.SingleNodeContainerUI) NodeContainerEditPart(org.knime.workbench.editor2.editparts.NodeContainerEditPart) WorkflowManager(org.knime.core.node.workflow.WorkflowManager) EditPartViewer(org.eclipse.gef.EditPartViewer) NodeContainer(org.knime.core.node.workflow.NodeContainer) SingleNodeContainer(org.knime.core.node.workflow.SingleNodeContainer) SingleNodeContainer(org.knime.core.node.workflow.SingleNodeContainer)

Example 9 with NodeContainer

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

the class AddNewMetaNodeCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute() {
    m_metanodeID = getHostWFM().createAndAddSubWorkflow(m_inPorts, m_outPorts, m_name).getID();
    // create extra info and set it
    NodeContainer cont = getHostWFM().getNodeContainer(m_metanodeID);
    NodeUIInformation.Builder infoBuilder = NodeUIInformation.builder().setNodeLocation(m_location.x, m_location.y, -1, -1);
    if (WorkflowEditor.getActiveEditorSnapToGrid()) {
        infoBuilder.setSnapToGrid(true);
    }
    cont.setUIInformation(infoBuilder.build());
}
Also used : NodeUIInformation(org.knime.core.node.workflow.NodeUIInformation) NodeContainer(org.knime.core.node.workflow.NodeContainer)

Example 10 with NodeContainer

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

the class ChangeNodeBoundsCommand method execute.

/**
 * Sets the new bounds.
 *
 * @see org.eclipse.gef.commands.Command#execute()
 */
@Override
public void execute() {
    if (!Arrays.equals(m_oldBounds, m_newBounds)) {
        WorkflowManager wm = getHostWFM();
        NodeUIInformation information = NodeUIInformation.builder().setNodeLocation(m_newBounds[0], m_newBounds[1], m_newBounds[2], m_newBounds[3]).build();
        NodeContainer container = wm.getNodeContainer(m_nodeID);
        // must set explicitly so that event is fired by container
        container.setUIInformation(information);
    }
}
Also used : NodeUIInformation(org.knime.core.node.workflow.NodeUIInformation) WorkflowManager(org.knime.core.node.workflow.WorkflowManager) NodeContainer(org.knime.core.node.workflow.NodeContainer)

Aggregations

NodeContainer (org.knime.core.node.workflow.NodeContainer)51 WorkflowManager (org.knime.core.node.workflow.WorkflowManager)21 SubNodeContainer (org.knime.core.node.workflow.SubNodeContainer)20 NodeID (org.knime.core.node.workflow.NodeID)18 NativeNodeContainer (org.knime.core.node.workflow.NativeNodeContainer)13 SingleNodeContainer (org.knime.core.node.workflow.SingleNodeContainer)11 ConnectionContainer (org.knime.core.node.workflow.ConnectionContainer)9 NodeContainerEditPart (org.knime.workbench.editor2.editparts.NodeContainerEditPart)9 Map (java.util.Map)8 NodeUIInformation (org.knime.core.node.workflow.NodeUIInformation)8 ArrayList (java.util.ArrayList)7 IOException (java.io.IOException)6 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)6 ConnectionID (org.knime.core.node.workflow.ConnectionID)6 MetaNodeTemplateInformation (org.knime.core.node.workflow.MetaNodeTemplateInformation)6 File (java.io.File)5 List (java.util.List)5 GridData (org.eclipse.swt.layout.GridData)5 ReferencedFile (org.knime.core.internal.ReferencedFile)5 WorkflowContext (org.knime.core.node.workflow.WorkflowContext)5