use of org.knime.core.ui.node.workflow.NodeContainerUI in project knime-core by knime.
the class WorkflowSelectionDragEditPartsTracker method handleDoubleClick.
/**
* {@inheritDoc}
*/
@Override
protected boolean handleDoubleClick(final int button) {
EditPart part = getSourceEditPart();
if (part instanceof NodeContainerEditPart && getCurrentInput().isModKeyDown(SWT.MOD1)) {
NodeContainerEditPart ncPart = ((NodeContainerEditPart) part);
NodeContainerUI container = (NodeContainerUI) ncPart.getModel();
if (container instanceof SubNodeContainerUI) {
ncPart.openSubWorkflowEditor();
return false;
}
}
return super.handleDoubleClick(button);
}
use of org.knime.core.ui.node.workflow.NodeContainerUI in project knime-core by knime.
the class CancelAction method internalCalculateEnabled.
/**
* @return true if at least one selected node is executing or queued
* @see org.eclipse.gef.ui.actions.WorkbenchPartAction#calculateEnabled()
*/
@Override
protected boolean internalCalculateEnabled() {
NodeContainerEditPart[] parts = getSelectedParts(NodeContainerEditPart.class);
// enable if we have at least one executing or queued node in our
// selection
WorkflowManager wm = getEditor().getWorkflowManager().get();
for (int i = 0; i < parts.length; i++) {
// bugfix 1478
NodeContainerUI nc = parts[i].getNodeContainer();
if (wm.canCancelNode(nc.getID())) {
return true;
}
}
return false;
}
use of org.knime.core.ui.node.workflow.NodeContainerUI in project knime-core by knime.
the class ChangeMetaNodeLinkAction method internalCalculateEnabled.
/**
* @return true, if underlying model instance of <code>WorkflowManager</code>, otherwise false
*/
@Override
protected boolean internalCalculateEnabled() {
NodeContainerEditPart[] nodes = getSelectedParts(NodeContainerEditPart.class);
if (nodes.length != 1) {
return false;
}
NodeContainerUI nc = nodes[0].getNodeContainer();
if (!(nc instanceof WorkflowManagerUI)) {
return false;
}
WorkflowManagerUI metaNode = (WorkflowManagerUI) nc;
if (!Role.Link.equals(unwrapWFM(metaNode).getTemplateInformation().getRole()) || metaNode.getParent().isWriteProtected()) {
// metanode must be linked and parent must not forbid the change
return false;
}
// we can reconfigure the template link - but only if template and flow are in the same mountpoint
URI targetURI = unwrapWFM(metaNode).getTemplateInformation().getSourceURI();
try {
if (ResolverUtil.isMountpointRelativeURL(targetURI) || ResolverUtil.isWorkflowRelativeURL(targetURI)) {
return true;
}
} catch (IOException e) {
return false;
}
// we can change absolute links if the mount points of flow and template are the same
AbstractContentProvider workflowMountPoint = null;
WorkflowContext wfc = metaNode.getProjectWFM().getContext();
LocalExplorerFileStore fs = ExplorerFileSystem.INSTANCE.fromLocalFile(wfc.getMountpointRoot());
if (fs != null) {
workflowMountPoint = fs.getContentProvider();
}
if (workflowMountPoint == null) {
return false;
}
AbstractExplorerFileStore targetfs = ExplorerFileSystem.INSTANCE.getStore(targetURI);
if (targetfs == null) {
return false;
}
return workflowMountPoint.equals(targetfs.getContentProvider());
}
use of org.knime.core.ui.node.workflow.NodeContainerUI in project knime-core by knime.
the class CheckUpdateMetaNodeLinkAction method getMetaNodesToCheck.
protected List<NodeID> getMetaNodesToCheck() {
List<NodeID> list = new ArrayList<NodeID>();
for (NodeContainerEditPart p : getSelectedParts(NodeContainerEditPart.class)) {
NodeContainerUI model = p.getNodeContainer();
if (Wrapper.wraps(model, NodeContainerTemplate.class)) {
NodeContainerTemplate tnc = Wrapper.unwrap(model, NodeContainerTemplate.class);
if (tnc.getTemplateInformation().getRole().equals(Role.Link)) {
if (!getManager().canUpdateMetaNodeLink(tnc.getID())) {
return Collections.emptyList();
}
list.add(tnc.getID());
}
list.addAll(getNCTemplatesToCheck(tnc));
}
}
return list;
}
use of org.knime.core.ui.node.workflow.NodeContainerUI in project knime-core by knime.
the class NodeContainerEditPart method deactivate.
/**
* {@inheritDoc}
*/
@Override
public void deactivate() {
NodeContainerUI nc = getNodeContainer();
IPreferenceStore store = KNIMEUIPlugin.getDefault().getPreferenceStore();
store.removePropertyChangeListener(this);
nc.removeNodeStateChangeListener(this);
nc.removeNodeMessageListener(this);
nc.removeNodeProgressListener(this);
nc.removeUIInformationListener(this);
nc.removeNodePropertyChangedListener(this);
removeEditPartListener(this);
for (Object o : getChildren()) {
EditPart editPart = (EditPart) o;
editPart.deactivate();
}
EditPolicyIterator editPolicyIterator = getEditPolicyIterator();
while (editPolicyIterator.hasNext()) {
editPolicyIterator.next().deactivate();
}
super.deactivate();
}
Aggregations