use of org.knime.core.ui.node.workflow.NodeContainerUI in project knime-core by knime.
the class NodeContainerEditPart method updateJobManagerIcon.
private void updateJobManagerIcon() {
NodeContainerUI nc = getNodeContainer();
NodeExecutionJobManager jobManager = nc.getJobManager();
URL iconURL;
if (jobManager != null) {
iconURL = jobManager.getIcon();
} else {
NodeExecutionJobManager parentJobManager = nc.findJobManager();
if (parentJobManager instanceof AbstractNodeExecutionJobManager) {
if (Wrapper.wraps(nc, NodeContainer.class)) {
iconURL = ((AbstractNodeExecutionJobManager) parentJobManager).getIconForChild(Wrapper.unwrapNC(nc));
} else {
iconURL = null;
}
} else {
iconURL = null;
}
}
Image icon = null;
if (iconURL != null) {
icon = ImageDescriptor.createFromURL(iconURL).createImage();
}
((NodeContainerFigure) getFigure()).setJobExecutorIcon(icon);
}
use of org.knime.core.ui.node.workflow.NodeContainerUI in project knime-core by knime.
the class NodeContainerEditPart method checkNodeLockIcon.
private void checkNodeLockIcon() {
NodeContainerUI nc = getNodeContainer();
Image i;
StringBuilder toolTip = new StringBuilder();
// node is considered being locked if it is either lock from being reseted, it's not deletable, or the dialog is locked
if (nc.getNodeLocks().hasResetLock() || nc.getNodeLocks().hasDeleteLock() || nc.getNodeLocks().hasConfigureLock()) {
toolTip.append("Node Locked (");
i = NODE_LOCK_ICON;
if (nc.getNodeLocks().hasResetLock()) {
toolTip.append("Reset, ");
}
if (nc.getNodeLocks().hasDeleteLock()) {
toolTip.append("Delete, ");
}
if (nc.getNodeLocks().hasConfigureLock()) {
toolTip.append("Configure, ");
}
toolTip.setLength(toolTip.length() - 2);
toolTip.append(")");
} else {
i = null;
}
NodeContainerFigure fig = (NodeContainerFigure) getFigure();
fig.setNodeLockIcon(i, toolTip.toString());
}
use of org.knime.core.ui.node.workflow.NodeContainerUI in project knime-core by knime.
the class KnimeResourceContentProvider method hasChildren.
/**
* {@inheritDoc}
*/
@Override
public boolean hasChildren(final Object element) {
if (element instanceof IFile) {
return false;
}
if (isKNIMEWorkflow(element)) {
IContainer project = (IContainer) element;
NodeContainerUI workflow = ProjectWorkflowMap.getWorkflowUI(project.getLocationURI());
if (workflow != null) {
// the number of contained nodes is returned
return ((WorkflowManagerUI) workflow).getNodeContainers().size() > 0;
}
} else if (element instanceof WorkflowManagerUI) {
return ((WorkflowManagerUI) element).getNodeContainers().size() > 0;
}
// then it is a node and has no children
if (element instanceof IContainer) {
IContainer container = (IContainer) element;
if (isKNIMEWorkflow(container.getParent())) {
return false;
}
}
return getFolders(element).length > 0;
}
use of org.knime.core.ui.node.workflow.NodeContainerUI in project knime-core by knime.
the class ProjectWorkflowMap method putWorkflowUI.
/**
* Adds a {@link WorkflowManagerUI} of an opened workflow with the URI of
* the workflow directory to the map. Used by the WorkflowEditor.
*
* @param path URI of the directory containing the workflow.knime file
* @param manager {@link WorkflowManagerUI} in memory holding the workflow
*/
public static void putWorkflowUI(final URI path, final WorkflowManagerUI manager) {
MapWFKey p = new MapWFKey(path);
// in case the manager is replaced
// -> unregister listeners from the old one
NodeContainerUI oldOne = PROJECTS.get(p);
if (oldOne != null) {
oldOne.removeNodeStateChangeListener(NSC_LISTENER);
((WorkflowManagerUI) oldOne).removeListener(WF_LISTENER);
oldOne.removeNodeMessageListener(MSG_LISTENER);
oldOne.removeNodePropertyChangedListener(NODE_PROP_LISTENER);
}
PROJECTS.put(p, manager);
manager.addNodeStateChangeListener(NSC_LISTENER);
manager.addListener(WF_LISTENER);
manager.addNodeMessageListener(MSG_LISTENER);
manager.addNodePropertyChangedListener(NODE_PROP_LISTENER);
// with WorkflowManagerUI instances, too!
if (Wrapper.wraps(manager, WorkflowManager.class)) {
WF_LISTENER.workflowChanged(new WorkflowEvent(WorkflowEvent.Type.NODE_ADDED, manager.getID(), null, Wrapper.unwrapWFM(manager)));
}
}
Aggregations