use of org.knime.workbench.editor2.editparts.NodeContainerEditPart in project knime-core by knime.
the class PauseLoopExecutionAction method runOnNodes.
/**
* Pause Execution on all selected nodes.
*
* {@inheritDoc}
*/
@Override
public void runOnNodes(final NodeContainerEditPart[] nodeParts) {
LOGGER.debug("Creating 'Pause Execution' job for " + nodeParts.length + " node(s)...");
WorkflowManager manager = getManager();
for (NodeContainerEditPart p : nodeParts) {
manager.pauseLoopExecution(Wrapper.unwrapNC(p.getNodeContainer()));
}
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.workbench.editor2.editparts.NodeContainerEditPart in project knime-core by knime.
the class ResumeLoopAction method internalCalculateEnabled.
/**
* @return <code>true</code>, if just one loop end node part is selected
* which is executable and a loop is in progress.
*
* @see org.eclipse.gef.ui.actions.WorkbenchPartAction#calculateEnabled()
*/
@Override
protected boolean internalCalculateEnabled() {
NodeContainerEditPart[] parts = getSelectedParts(NodeContainerEditPart.class);
if (parts.length != 1) {
return false;
}
// enabled if the one selected node is a configured and "in progress"
// LoopEndNode
NodeContainerUI nc = parts[0].getNodeContainer();
if (Wrapper.wraps(nc, NativeNodeContainer.class)) {
NativeNodeContainer nnc = Wrapper.unwrap(nc, NativeNodeContainer.class);
if (nnc.isModelCompatibleTo(LoopEndNode.class) && nnc.getLoopStatus().equals(LoopStatus.PAUSED)) {
return true;
}
}
return false;
}
use of org.knime.workbench.editor2.editparts.NodeContainerEditPart in project knime-core by knime.
the class SaveAsMetaNodeTemplateAction method internalCalculateEnabled.
/**
* @return true, if underlying model instance of
* <code>WorkflowManager</code> and there is no link associated
* with it, otherwise false
*/
@Override
protected boolean internalCalculateEnabled() {
if (getManager().isWriteProtected()) {
return false;
}
NodeContainerEditPart[] nodes = getSelectedParts(NodeContainerEditPart.class);
if (nodes.length != 1) {
return false;
}
Object model = nodes[0].getModel();
if (model instanceof WorkflowManagerUI) {
WorkflowManagerUI wm = (WorkflowManagerUI) model;
switch(Wrapper.unwrapWFM(wm).getTemplateInformation().getRole()) {
case None:
break;
default:
return false;
}
for (AbstractContentProvider p : ExplorerMountTable.getMountedContent().values()) {
if (p.canHostMetaNodeTemplates()) {
return true;
}
}
}
return false;
}
use of org.knime.workbench.editor2.editparts.NodeContainerEditPart in project knime-core by knime.
the class SelectLoopAction method internalCalculateEnabled.
/**
* @return <code>true</code> if at we have a single node which has a
* dialog
* @see org.eclipse.gef.ui.actions.WorkbenchPartAction#calculateEnabled()
*/
@Override
protected boolean internalCalculateEnabled() {
NodeContainerEditPart[] selected = getSelectedParts(NodeContainerEditPart.class);
if (selected.length != 1) {
return false;
}
NodeContainerUI node = selected[0].getNodeContainer();
if (!(node instanceof SingleNodeContainerUI)) {
return false;
}
if (((SingleNodeContainerUI) node).isMemberOfScope()) {
return true;
}
return false;
}
use of org.knime.workbench.editor2.editparts.NodeContainerEditPart in project knime-core by knime.
the class SaveAsSubNodeTemplateAction method internalCalculateEnabled.
/**
* @return true, if underlying model instance of
* <code>SubNodeContainer</code> and there is no link associated
* with it, otherwise false
*/
@Override
protected boolean internalCalculateEnabled() {
if (getManager().isWriteProtected()) {
return false;
}
NodeContainerEditPart[] nodes = getSelectedParts(NodeContainerEditPart.class);
if (nodes.length != 1) {
return false;
}
Object model = nodes[0].getModel();
if (Wrapper.wraps(model, SubNodeContainer.class)) {
SubNodeContainer snc = unwrap((UI) model, SubNodeContainer.class);
switch(snc.getTemplateInformation().getRole()) {
case None:
break;
default:
return false;
}
for (AbstractContentProvider p : ExplorerMountTable.getMountedContent().values()) {
if (p.canHostMetaNodeTemplates()) {
return true;
}
}
}
return false;
}
Aggregations