Search in sources :

Example 1 with UpdateMetaNodeTemplateRunnable

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

the class UpdateMetaNodeLinkCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute() {
    UpdateMetaNodeTemplateRunnable updateRunner = null;
    try {
        IWorkbench wb = PlatformUI.getWorkbench();
        IProgressService ps = wb.getProgressService();
        WorkflowManager hostWFM = getHostWFM();
        updateRunner = new UpdateMetaNodeTemplateRunnable(hostWFM, m_ids);
        ps.busyCursorWhile(updateRunner);
        m_newIDs = updateRunner.getNewIDs();
        m_undoPersistors = updateRunner.getUndoPersistors();
        assert m_newIDs.size() == m_undoPersistors.size();
    } catch (Exception ex) {
        // if fails notify the user
        LOGGER.debug("Node cannot be created.", ex);
        MessageDialog.openWarning(Display.getDefault().getActiveShell(), "Node cannot be created.", "The selected node could not be created " + "due to the following reason:\n" + ex.getMessage());
        return;
    } finally {
        if (updateRunner != null) {
            updateRunner.discard();
        }
    }
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) UpdateMetaNodeTemplateRunnable(org.knime.workbench.editor2.UpdateMetaNodeTemplateRunnable) IProgressService(org.eclipse.ui.progress.IProgressService) WorkflowManager(org.knime.core.node.workflow.WorkflowManager)

Aggregations

IWorkbench (org.eclipse.ui.IWorkbench)1 IProgressService (org.eclipse.ui.progress.IProgressService)1 WorkflowManager (org.knime.core.node.workflow.WorkflowManager)1 UpdateMetaNodeTemplateRunnable (org.knime.workbench.editor2.UpdateMetaNodeTemplateRunnable)1