public void checkUnLoadedNodeForProcess(JobEditorInput fileEditorInput) { if (fileEditorInput == null || fileEditorInput.getLoadedProcess() == null) { return; } IProcess2 loadedProcess = fileEditorInput.getLoadedProcess(); List<NodeType> unloadedNode = loadedProcess.getUnloadedNode(); if (unloadedNode != null && !unloadedNode.isEmpty()) { String message = "Some Component are not loaded:\n"; for (int i = 0; i < unloadedNode.size(); i++) { message = message + unloadedNode.get(i).getComponentName() + "\n"; } if (!CommonsPlugin.isHeadless() && PlatformUI.isWorkbenchRunning()) { Display display = Display.getCurrent(); if (display == null) { display = Display.getDefault(); } if (display != null) { final Display tmpDis = display; final String tmpMess = message; display.syncExec( new Runnable() { public void run() { Shell shell = null; final IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (activeWorkbenchWindow != null) { shell = activeWorkbenchWindow.getShell(); } else { if (tmpDis != null) { shell = tmpDis.getActiveShell(); } else { shell = new Shell(); } } MessageDialog.openWarning(shell, "Warning", tmpMess); } }); } } } }
@Override public void run() { SaveAsRoutesWizard processWizard = new SaveAsRoutesWizard((JobEditorInput) editorPart.getEditorInput()); WizardDialog dlg = new WizardDialog(editorPart.getSite().getShell(), processWizard); if (dlg.open() == Window.OK) { try { // Set readonly to false since created routes will always be editable. JobEditorInput newRoutesEditorInput = new CamelProcessEditorInput(processWizard.getProcess(), true, true, false); IWorkbenchPage page = editorPart.getSite().getPage(); IRepositoryNode repositoryNode = RepositorySeekerManager.getInstance() .searchRepoViewNode(newRoutesEditorInput.getItem().getProperty().getId(), false); newRoutesEditorInput.setRepositoryNode(repositoryNode); // close the old editor page.closeEditor(editorPart, false); // open the new editor, because at the same time, there will update the routes view page.openEditor(newRoutesEditorInput, CamelMultiPageTalendEditor.ID, true); } catch (Exception e) { MessageDialog.openError( editorPart.getSite().getShell(), "Error", "Routes could not be saved" + " : " + e.getMessage()); ExceptionHandler.process(e); } } }