use of org.knime.core.node.workflow.LoopEndNode in project knime-core by knime.
the class StepLoopAction 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)) {
// either the node is paused...
return true;
}
WorkflowManager wm = getEditor().getWorkflowManager().get();
if (wm.canExecuteNodeDirectly(nc.getID())) {
// ...or we can execute it (then this will be the first step)
return true;
}
}
return false;
}
use of org.knime.core.node.workflow.LoopEndNode in project knime-core by knime.
the class NodeModel method continueLoop.
// ////////////////////////////////////////
// Loop Support...
//
// TODO: maybe all of this should be moved into an adaptor class
// "LoopNodeModelAdapter" which keeps the node's role and all of
// the loop specific stuff? Later...
//
// ////////////////////////////////////////
/**
* Informs WorkflowManager after execute to continue the loop.
* Call by the end of the loop! This will result in both
* this Node as well as the creator of the FlowLoopContext to be
* queued for execution once again. In this case the node can return
* an empty table after execution.
*
* Called on LoopTail Node's only.
*/
protected final void continueLoop() {
if (!(this instanceof LoopEndNode)) {
throw new IllegalStateException("continueLoop called from non-end node (Coding Error)!");
}
FlowLoopContext slc = m_flowObjectStack.peek(FlowLoopContext.class);
if (slc != null && slc.isInactiveScope()) {
m_logger.coding("Encountered an inactive FlowLoopContext in continueLoop.");
// continue with historically "correct" solution:
slc = m_flowObjectStack.peekScopeContext(FlowLoopContext.class, false);
}
if (slc == null) {
// wrong wiring of the pipeline: head seems to be missing!
throw new IllegalStateException("Missing Loop Start in Pipeline!");
}
m_loopContext = slc;
// note that the WFM will set the tail ID so we can retrieve it
// in the head node!
}
use of org.knime.core.node.workflow.LoopEndNode 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;
}
Aggregations