use of org.knime.core.node.workflow.MetaNodeTemplateInformation in project knime-core by knime.
the class DisconnectMetaNodeLinkCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute() {
m_changedIDs = new ArrayList<NodeID>();
m_oldTemplInfos = new ArrayList<MetaNodeTemplateInformation>();
WorkflowManager hostWFM = getHostWFM();
for (NodeID id : m_ids) {
NodeContainer nc = hostWFM.getNodeContainer(id);
if (nc instanceof WorkflowManager) {
WorkflowManager wm = (WorkflowManager) nc;
MetaNodeTemplateInformation lI = wm.getTemplateInformation();
if (Role.Link.equals(lI.getRole())) {
MetaNodeTemplateInformation old = hostWFM.setTemplateInformation(id, MetaNodeTemplateInformation.NONE);
RECENTLY_USED_URIS.put(wm.getID(), old.getSourceURI());
m_changedIDs.add(id);
m_oldTemplInfos.add(old);
}
}
}
}
use of org.knime.core.node.workflow.MetaNodeTemplateInformation in project knime-core by knime.
the class DisconnectSubNodeLinkCommand method canExecute.
/**
* We can execute, if all components were 'non-null' in the constructor.
* {@inheritDoc}
*/
@Override
public boolean canExecute() {
if (!super.canExecute()) {
return false;
}
if (m_ids == null) {
return false;
}
for (NodeID id : m_ids) {
NodeContainer nc = getHostWFM().getNodeContainer(id);
if (nc instanceof SubNodeContainer) {
SubNodeContainer snc = (SubNodeContainer) nc;
MetaNodeTemplateInformation lI = snc.getTemplateInformation();
if (Role.Link.equals(lI.getRole())) {
return true;
}
}
}
return false;
}
use of org.knime.core.node.workflow.MetaNodeTemplateInformation in project knime-core by knime.
the class DisconnectSubNodeLinkCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute() {
m_changedIDs = new ArrayList<NodeID>();
m_oldTemplInfos = new ArrayList<MetaNodeTemplateInformation>();
WorkflowManager hostWFM = getHostWFM();
for (NodeID id : m_ids) {
NodeContainer nc = hostWFM.getNodeContainer(id);
if (nc instanceof SubNodeContainer) {
SubNodeContainer snc = (SubNodeContainer) nc;
MetaNodeTemplateInformation lI = snc.getTemplateInformation();
if (Role.Link.equals(lI.getRole())) {
MetaNodeTemplateInformation old = hostWFM.setTemplateInformation(id, MetaNodeTemplateInformation.NONE);
RECENTLY_USED_URIS.put(snc.getID(), old.getSourceURI());
m_changedIDs.add(id);
m_oldTemplInfos.add(old);
}
}
}
}
use of org.knime.core.node.workflow.MetaNodeTemplateInformation in project knime-core by knime.
the class DisconnectMetaNodeLinkAction method internalCalculateEnabled.
/**
* @return true, if underlying model instance of
* <code>WorkflowManager</code>, otherwise false
*/
@Override
protected boolean internalCalculateEnabled() {
if (getManager().isWriteProtected()) {
return false;
}
NodeContainerEditPart[] nodes = getSelectedParts(NodeContainerEditPart.class);
for (NodeContainerEditPart p : nodes) {
Object model = p.getModel();
if (model instanceof WorkflowManagerUI) {
WorkflowManagerUI wm = (WorkflowManagerUI) model;
MetaNodeTemplateInformation i = unwrapWFM(wm).getTemplateInformation();
if (Role.Link.equals(i.getRole())) {
return true;
}
}
}
return false;
}
use of org.knime.core.node.workflow.MetaNodeTemplateInformation in project knime-core by knime.
the class DisconnectMetaNodeLinkAction method runOnNodes.
/**
* {@inheritDoc}
*/
@Override
public void runOnNodes(final NodeContainerEditPart[] nodeParts) {
List<NodeID> idList = new ArrayList<NodeID>();
for (NodeContainerEditPart p : nodeParts) {
Object model = p.getModel();
if (model instanceof WorkflowManagerUI) {
WorkflowManagerUI wm = (WorkflowManagerUI) model;
MetaNodeTemplateInformation i = unwrapWFM(wm).getTemplateInformation();
if (Role.Link.equals(i.getRole())) {
idList.add(wm.getID());
}
}
}
NodeID[] ids = idList.toArray(new NodeID[idList.size()]);
DisconnectMetaNodeLinkCommand disCmd = new DisconnectMetaNodeLinkCommand(getManager(), ids);
execute(disCmd);
}
Aggregations