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.";
}
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
}
}
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
}
}
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());
}
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);
}
}
Aggregations