Search in sources :

Example 86 with WorkflowManager

use of org.knime.core.node.workflow.WorkflowManager in project knime-core by knime.

the class SetupSubnodeWizard method addPages.

/**
 * {@inheritDoc}
 */
@Override
public void addPages() {
    setWindowTitle("Setup Wrapped Metanode Wizard");
    setDefaultPageImageDescriptor(ImageDescriptor.createFromImage(ImageRepository.getImage(KNIMEEditorPlugin.PLUGIN_ID, "icons/meta/meta_node_wizard2.png")));
    WorkflowManager wfManager = m_subNode.getWorkflowManager();
    Map<NodeID, NodeModel> allNodes = wfManager.findNodes(NodeModel.class, false);
    LinkedHashMap<NodeID, NodeModel> usageNodes = new LinkedHashMap<NodeID, NodeModel>();
    List<NodeID> nodeIDs = new ArrayList<NodeID>();
    nodeIDs.addAll(allNodes.keySet());
    Collections.sort(nodeIDs);
    for (NodeID id : nodeIDs) {
        NodeModel model = allNodes.get(id);
        if (considerNodeForUsage(model)) {
            usageNodes.put(id, model);
        }
    }
    m_portsPage = new ConfigureMetaNodePortsPage("Change the Wrapped Metanode configuration");
    m_portsPage.setSubNode(m_subNode);
    m_portsPage.setTemplate(null);
    addPage(m_portsPage);
}
Also used : NodeModel(org.knime.core.node.NodeModel) WorkflowManager(org.knime.core.node.workflow.WorkflowManager) NodeID(org.knime.core.node.workflow.NodeID) ArrayList(java.util.ArrayList) ConfigureMetaNodePortsPage(org.knime.workbench.editor2.meta.ConfigureMetaNodePortsPage) LinkedHashMap(java.util.LinkedHashMap)

Example 87 with WorkflowManager

use of org.knime.core.node.workflow.WorkflowManager in project knime-core by knime.

the class WFShowJobMgrViewAction method run.

/**
 * {@inheritDoc}
 */
@Override
public void run() {
    final WorkflowManager workflow = getWorkflow();
    final Rectangle knimeWindowBounds = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().getBounds();
    Runnable runner = new Runnable() {

        @Override
        public void run() {
            java.awt.Rectangle bounds = new java.awt.Rectangle(knimeWindowBounds.x, knimeWindowBounds.y, knimeWindowBounds.width, knimeWindowBounds.height);
            Node.invokeOpenView(workflow.getJobManager().getView(workflow), workflow.getNameWithID(), bounds);
        }
    };
    SwingUtilities.invokeLater(runner);
}
Also used : WorkflowManager(org.knime.core.node.workflow.WorkflowManager) Rectangle(org.eclipse.swt.graphics.Rectangle)

Example 88 with WorkflowManager

use of org.knime.core.node.workflow.WorkflowManager in project knime-core by knime.

the class FileUtil method getWorkflowTempDir.

/**
 * Reads the temporary directory associated with the current workflow (set in the {@link WorkflowContext}), or - if
 * that is <code>null</code> - the global temp dir (see {@link KNIMEConstants#getKNIMETempPath()}).
 *
 * @return the temp dir of the current {@link WorkflowContext} or the standard temp dir, if no context is set.
 * @since 3.5
 */
public static File getWorkflowTempDir() {
    final File fallbackDir = KNIMEConstants.getKNIMETempPath().toFile();
    NodeContext nodeContext = NodeContext.getContext();
    if (nodeContext == null) {
        return fallbackDir;
    }
    WorkflowManager wfm = nodeContext.getWorkflowManager();
    if (wfm == null) {
        return fallbackDir;
    }
    WorkflowContext workflowContext = wfm.getContext();
    if (workflowContext == null) {
        return fallbackDir;
    }
    if (!workflowContext.getTempLocation().isDirectory()) {
        LOGGER.error("Temp folder \"" + workflowContext.getTempLocation().getAbsolutePath() + "\" does not exist (associated with node context \"" + nodeContext + "\") - using fallback temp folder (\"" + fallbackDir.getAbsolutePath() + "\"");
        return fallbackDir;
    } else {
        return workflowContext.getTempLocation();
    }
}
Also used : NodeContext(org.knime.core.node.workflow.NodeContext) WorkflowManager(org.knime.core.node.workflow.WorkflowManager) WorkflowContext(org.knime.core.node.workflow.WorkflowContext) File(java.io.File)

Aggregations

WorkflowManager (org.knime.core.node.workflow.WorkflowManager)88 NodeID (org.knime.core.node.workflow.NodeID)31 NodeContainer (org.knime.core.node.workflow.NodeContainer)20 SubNodeContainer (org.knime.core.node.workflow.SubNodeContainer)15 NodeContainerEditPart (org.knime.workbench.editor2.editparts.NodeContainerEditPart)15 File (java.io.File)12 ConnectionContainer (org.knime.core.node.workflow.ConnectionContainer)12 NativeNodeContainer (org.knime.core.node.workflow.NativeNodeContainer)10 ArrayList (java.util.ArrayList)9 MessageBox (org.eclipse.swt.widgets.MessageBox)9 SingleNodeContainer (org.knime.core.node.workflow.SingleNodeContainer)9 NodeContainerUI (org.knime.core.ui.node.workflow.NodeContainerUI)9 IOException (java.io.IOException)8 WorkflowAnnotation (org.knime.core.node.workflow.WorkflowAnnotation)8 Map (java.util.Map)7 ExecutionMonitor (org.knime.core.node.ExecutionMonitor)7 NodeUIInformation (org.knime.core.node.workflow.NodeUIInformation)7 WorkflowContext (org.knime.core.node.workflow.WorkflowContext)7 WorkflowCopyContent (org.knime.core.node.workflow.WorkflowCopyContent)7 WorkflowRootEditPart (org.knime.workbench.editor2.editparts.WorkflowRootEditPart)6