use of org.knime.core.ui.node.workflow.WorkflowManagerUI 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);
}
use of org.knime.core.ui.node.workflow.WorkflowManagerUI in project knime-core by knime.
the class MetaNodeReconfigureAction 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) {
WorkflowManagerUI metaNode = (WorkflowManagerUI) nc;
return !metaNode.isWriteProtected();
}
return false;
}
use of org.knime.core.ui.node.workflow.WorkflowManagerUI in project knime-core by knime.
the class LockMetaNodeAction method runOnNodes.
/**
* {@inheritDoc}
*/
@Override
public void runOnNodes(final NodeContainerEditPart[] nodes) {
if (nodes.length != 1) {
return;
}
Object model = nodes[0].getModel();
if (!(model instanceof WorkflowManagerUI)) {
return;
}
WorkflowManagerUI metaNodeWFM = (WorkflowManagerUI) model;
final Shell shell = Display.getCurrent().getActiveShell();
if (!unwrapWFM(metaNodeWFM).unlock(new GUIWorkflowCipherPrompt())) {
return;
}
LockMetaNodeDialog lockDialog = new LockMetaNodeDialog(shell, unwrapWFM(metaNodeWFM));
if (lockDialog.open() != Window.OK) {
return;
}
String password = lockDialog.getPassword();
String hint = lockDialog.getPasswordHint();
try {
metaNodeWFM.setWorkflowPassword(password, hint);
} catch (NoSuchAlgorithmException e) {
String msg = "Unable to encrypt metanode: " + e.getMessage();
LOGGER.error(msg, e);
MessageDialog.openError(shell, "Metanode encrypt", msg);
}
}
use of org.knime.core.ui.node.workflow.WorkflowManagerUI in project knime-core by knime.
the class OpenMultiDialogAction method runOnNodes.
/**
* {@inheritDoc}
*/
@Override
public void runOnNodes(final NodeContainerEditPart[] nodeParts) {
NodeID[] nodes = new NodeID[nodeParts.length];
SplitType splitType = SplitType.USER;
for (int i = 0; i < nodeParts.length; i++) {
NodeContainerUI nc = nodeParts[i].getNodeContainer();
nodes[i] = nc.getID();
if (nc instanceof WorkflowManagerUI) {
// one metanode disables splitting
splitType = SplitType.DISALLOWED;
}
}
WrappedMultipleNodeDialog dlg = new WrappedMultipleNodeDialog(Display.getCurrent().getActiveShell(), getManager(), splitType, nodes);
// the dialog applies new settings on OK
dlg.open();
}
use of org.knime.core.ui.node.workflow.WorkflowManagerUI in project knime-core by knime.
the class RevealMetaNodeTemplateAction method runOnNodes.
/**
* {@inheritDoc}
*/
@Override
public void runOnNodes(final NodeContainerEditPart[] nodes) {
List<NodeID> candidateList = new ArrayList<NodeID>();
List<AbstractExplorerFileStore> templates = new ArrayList<AbstractExplorerFileStore>();
for (NodeContainerEditPart p : nodes) {
Object model = p.getModel();
if (model instanceof WorkflowManagerUI) {
NodeContext.pushContext(Wrapper.unwrapNC(p.getNodeContainer()));
try {
WorkflowManager wm = Wrapper.unwrapWFM((UI) model);
MetaNodeTemplateInformation i = wm.getTemplateInformation();
if (Role.Link.equals(i.getRole())) {
candidateList.add(wm.getID());
AbstractExplorerFileStore template = ExplorerFileSystem.INSTANCE.getStore(i.getSourceURI());
if (template != null) {
templates.add(template);
}
}
} finally {
NodeContext.removeLastContext();
}
}
}
List<Object> treeObjects = ContentDelegator.getTreeObjectList(templates);
if (treeObjects != null && treeObjects.size() > 0) {
IViewReference[] views = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getViewReferences();
for (IViewReference view : views) {
if (ExplorerView.ID.equals(view.getId())) {
ExplorerView explorerView = (ExplorerView) view.getView(true);
explorerView.getViewer().setSelection(new StructuredSelection(treeObjects), true);
}
}
}
}
Aggregations