use of org.knime.core.node.workflow.SubNodeContainer in project knime-core by knime.
the class LockSubNodeAction method internalCalculateEnabled.
/**
* @return true, if underlying model instance of
* <code>SubNodeContainer</code>, 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 = Wrapper.unwrap((UI) model, SubNodeContainer.class);
if (snc.isWriteProtected()) {
return false;
}
return true;
} else {
return false;
}
}
use of org.knime.core.node.workflow.SubNodeContainer 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;
}
use of org.knime.core.node.workflow.SubNodeContainer in project knime-core by knime.
the class SubNodeReconfigureAction 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;
}
NodeContainer nc = Wrapper.unwrapOptionalNC(nodes[0].getNodeContainer()).orElse(null);
if (nc instanceof SubNodeContainer) {
return !((SubNodeContainer) nc).isWriteProtected();
}
return false;
}
use of org.knime.core.node.workflow.SubNodeContainer in project knime-core by knime.
the class SubnodeLayoutAction method runOnNodes.
/**
* {@inheritDoc}
*/
@Override
public void runOnNodes(final NodeContainerEditPart[] nodeParts) {
WorkflowManager manager = getManager();
SubNodeContainer subnode = (SubNodeContainer) manager.getDirectNCParent();
SubnodeLayoutWizard wizard = new SubnodeLayoutWizard(subnode);
WizardDialog dlg = new WizardDialog(Display.getCurrent().getActiveShell(), wizard);
dlg.create();
dlg.open();
}
use of org.knime.core.node.workflow.SubNodeContainer in project knime-core by knime.
the class ChangeSubNodeLinkCommand method setLink.
private boolean setLink(final URI link) {
NodeContainer subNode = getHostWFM().getNodeContainer(m_subNodeID);
if (!(subNode instanceof SubNodeContainer)) {
LOGGER.error("Command failed: Specified node is not a Wrapped Metanode");
return false;
}
MetaNodeTemplateInformation templateInfo = ((SubNodeContainer) subNode).getTemplateInformation();
MetaNodeTemplateInformation newInfo;
try {
newInfo = templateInfo.createLinkWithUpdatedSource(m_newLink);
} catch (InvalidSettingsException e1) {
// will not happen.
LOGGER.error("Command failed: Specified node is not a Wrapped Metanode with a link." + e1.getMessage(), e1);
return false;
}
getHostWFM().setTemplateInformation(m_subNodeID, newInfo);
return true;
}
Aggregations