+ ErrorFeedback.show("Execution of " + processNode + " failed", e);
+ }
+ }
+
+ void kill() {
+ processController.kill(processNode);
+ }
+
+ /** Opens a new editor with a copy of this process */
+ void relaunch() {
+ try {
+ Node duplicatedNode = duplicateProcess();
+ IWorkbenchPage activePage = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage();
+ activePage.openEditor(
+ new ProcessEditorInput(duplicatedNode.getPath()),
+ ProcessEditor.ID);
+ close(false);
+ } catch (Exception e1) {
+ throw new SlcException("Cannot relaunch " + processNode, e1);
+ }
+ }
+
+ /** Duplicates the process */
+ protected Node duplicateProcess() {
+ try {
+ Session session = processNode.getSession();
+ String uuid = UUID.randomUUID().toString();
+ String destPath = SlcJcrUtils.createExecutionProcessPath(uuid);
+ Node newNode = JcrUtils.mkdirs(session, destPath,
+ SlcTypes.SLC_PROCESS);
+
+ Node rootRealizedFlowNode = newNode.addNode(SLC_FLOW);
+ // copy node
+ JcrUtils.copy(processNode.getNode(SLC_FLOW), rootRealizedFlowNode);
+
+ newNode.setProperty(SLC_UUID, uuid);
+ newNode.setProperty(SLC_STATUS, ExecutionProcess.INITIALIZED);
+
+ // reset realized flow status
+ // we just manage one level for the time being
+ NodeIterator nit = rootRealizedFlowNode.getNodes(SLC_FLOW);
+ while (nit.hasNext()) {
+ nit.nextNode().setProperty(SLC_STATUS,
+ ExecutionProcess.INITIALIZED);
+ }
+
+ session.save();
+ return newNode;
+ } catch (RepositoryException e) {
+ throw new SlcException("Cannot duplicate process", e);