KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > jawe > actions > MakeCopyOfProcess


1 /*
2  * Authors:
3  * Stefanovic Nenad chupo@iis.ns.ac.yu
4  * Bojanic Sasa sasaboy@neobee.net
5  * Puskas Vladimir vpuskas@eunet.yu
6  * Pilipovic Goran zboniek@uns.ac.yu
7  *
8  */

9
10 package org.enhydra.jawe.actions;
11
12 import java.awt.Window JavaDoc;
13 import java.awt.event.ActionEvent JavaDoc;
14 import org.enhydra.jawe.AbstractGraph;
15 import org.enhydra.jawe.JaWE;
16 import org.enhydra.jawe.PackageEditor;
17 import org.enhydra.jawe.PackageGraph;
18 import org.enhydra.jawe.ProcessEditor;
19 import org.enhydra.jawe.xml.elements.WorkflowProcess;
20
21 /**
22  * Makes a copy of selected process.
23  */

24 public class MakeCopyOfProcess extends ActionBase {
25
26    public MakeCopyOfProcess (PackageEditor pe) {
27       super(pe);
28    }
29
30    public void actionPerformed(ActionEvent JavaDoc e) {
31       PackageGraph graph=(PackageGraph)editor.getGraph();
32       Object JavaDoc cell=graph.getSelectionCell();
33       if(!graph.isCellEditable(cell)) return;
34       Window JavaDoc parentW=graph.getEditor().getWindow();
35       if (cell instanceof org.enhydra.jawe.graph.Process) {
36          org.enhydra.jawe.graph.Process wf=(org.enhydra.jawe.graph.Process)cell;
37          WorkflowProcess wp=(WorkflowProcess)wf.getPropertyObject();
38
39          ProcessEditor pe=(ProcessEditor)((PackageEditor)editor).getProcessObject(wp).getImplementationEditor();
40          Save.updateExtendedAttributesForWorkflowProcess(wp,pe);
41          org.enhydra.jawe.xml.elements.WorkflowProcesses wps=
42             (org.enhydra.jawe.xml.elements.WorkflowProcesses)
43             JaWE.getInstance().getRealXMLPackage().get("WorkflowProcesses");
44          org.enhydra.jawe.xml.elements.WorkflowProcess wpCopy=
45             wps.createCopyOfWorkflowProcess(wp,true);
46
47          // if something went wrong
48
if (wpCopy==null) return;
49
50          graph.createWorkflowObject(editor.getWindow(),wpCopy);
51
52          if (wpCopy==null) return;
53          wps.decrementID();
54          graph.repaint();
55       }
56    }
57
58 }
59
Popular Tags