Search in sources :

Example 1 with WorkflowManagerInput

use of org.knime.workbench.editor2.WorkflowManagerInput in project knime-core by knime.

the class NodeContainerEditPart method openSubWorkflowEditor.

public void openSubWorkflowEditor() {
    WorkflowCipherPrompt prompt = new GUIWorkflowCipherPrompt();
    Object obj = getModel();
    WorkflowManagerUI wm;
    if (obj instanceof WorkflowManagerUI) {
        wm = (WorkflowManagerUI) getModel();
    } else if (obj instanceof SubNodeContainerUI) {
        wm = ((SubNodeContainerUI) obj).getWorkflowManager();
    } else {
        return;
    }
    // if workflow manager is encrypted, try unlocking it
    if (wm.isEncrypted()) {
        if (!Wrapper.unwrapWFM(wm).unlock(prompt)) {
            return;
        }
    }
    // open new editor for subworkflow
    LOGGER.debug("opening new editor for sub-workflow");
    try {
        final WorkflowEditor parent = (WorkflowEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
        WorkflowManagerInput input = new WorkflowManagerInput(wm, parent);
        PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(input, "org.knime.workbench.editor.WorkflowEditor");
    } catch (PartInitException e) {
        LOGGER.error("Error while opening new editor", e);
    }
    return;
}
Also used : WorkflowEditor(org.knime.workbench.editor2.WorkflowEditor) WorkflowCipherPrompt(org.knime.core.node.workflow.WorkflowCipherPrompt) WorkflowManagerInput(org.knime.workbench.editor2.WorkflowManagerInput) WorkflowManagerUI(org.knime.core.ui.node.workflow.WorkflowManagerUI) SubNodeContainerUI(org.knime.core.ui.node.workflow.SubNodeContainerUI) PartInitException(org.eclipse.ui.PartInitException)

Aggregations

PartInitException (org.eclipse.ui.PartInitException)1 WorkflowCipherPrompt (org.knime.core.node.workflow.WorkflowCipherPrompt)1 SubNodeContainerUI (org.knime.core.ui.node.workflow.SubNodeContainerUI)1 WorkflowManagerUI (org.knime.core.ui.node.workflow.WorkflowManagerUI)1 WorkflowEditor (org.knime.workbench.editor2.WorkflowEditor)1 WorkflowManagerInput (org.knime.workbench.editor2.WorkflowManagerInput)1