37 |
|
|
38 |
package nongnu.cashews.eclipse.composer.commands; |
package nongnu.cashews.eclipse.composer.commands; |
39 |
|
|
40 |
|
import java.util.Iterator; |
41 |
|
import java.util.Vector; |
42 |
|
|
43 |
import nongnu.cashews.eclipse.composer.model.Diagram; |
import nongnu.cashews.eclipse.composer.model.Diagram; |
44 |
import nongnu.cashews.eclipse.composer.model.Node; |
import nongnu.cashews.eclipse.composer.model.Node; |
45 |
import nongnu.cashews.eclipse.composer.model.RectangleNode; |
import nongnu.cashews.eclipse.composer.wizards.ProcessData; |
46 |
|
import nongnu.cashews.eclipse.composer.wizards.ProcessDefine; |
47 |
|
|
48 |
import org.eclipse.draw2d.geometry.Point; |
import org.eclipse.draw2d.geometry.Point; |
49 |
import org.eclipse.gef.commands.Command; |
import org.eclipse.gef.commands.Command; |
50 |
|
import org.eclipse.jface.window.ApplicationWindow; |
51 |
|
import org.eclipse.jface.wizard.WizardDialog; |
52 |
|
import org.eclipse.ui.dialogs.FileSelectionDialog; |
53 |
|
import org.eclipse.ui.dialogs.FileSystemElement; |
54 |
|
|
55 |
public class CreateNodeCommand |
public class CreateNodeCommand |
56 |
extends Command |
extends Command |
61 |
private Node node; |
private Node node; |
62 |
|
|
63 |
private Point location; |
private Point location; |
64 |
|
|
65 |
|
public String pName,oName; |
66 |
|
|
67 |
|
public Vector names; |
68 |
|
|
69 |
|
//ProcessData data = new ProcessData(); |
70 |
public CreateNodeCommand() |
public CreateNodeCommand() |
71 |
{ |
{ |
|
node = new RectangleNode("Fred"); |
|
72 |
} |
} |
73 |
|
|
74 |
// setters |
// setters |
76 |
public void setDiagram(Diagram diagram) |
public void setDiagram(Diagram diagram) |
77 |
{ |
{ |
78 |
this.diagram = diagram; |
this.diagram = diagram; |
79 |
|
DiagramSingleton ds = DiagramSingleton.getInstance(); |
80 |
|
ds.setDiagram(diagram); |
81 |
} |
} |
82 |
|
|
83 |
public void setNode(Node node) |
public void setNode(Node node) |
89 |
{ |
{ |
90 |
this.location = location; |
this.location = location; |
91 |
} |
} |
92 |
|
|
93 |
|
public void setName(String name){ |
94 |
|
this.pName = name; |
95 |
|
System.out.println("ccc" + pName); |
96 |
|
} |
97 |
// ------------------------------------------------------------------------ |
// ------------------------------------------------------------------------ |
98 |
// Overridden from Command |
// Overridden from Command |
99 |
|
|
103 |
} |
} |
104 |
|
|
105 |
public void execute() |
public void execute() |
106 |
{ |
|
107 |
|
{ ProcessDefine pd = new ProcessDefine(null); |
108 |
|
pd.run(); |
109 |
|
pName = pd.getPerformanceName(); |
110 |
|
oName = pd.getOperationName(); |
111 |
|
//System.out.println("data" + data); |
112 |
|
if (pd.status.equals("OK")){ |
113 |
|
|
114 |
if (location != null) |
if (location != null) |
115 |
{ |
{ |
116 |
|
System.out.println(pName); |
117 |
|
if (pName != null){ |
118 |
|
node.setName(pName + ":" + oName);} |
119 |
node.setLocation(location); |
node.setLocation(location); |
120 |
} |
} |
121 |
diagram.addNode(node); |
diagram.addNode(node); } |
122 |
|
else{ |
123 |
|
return; |
124 |
|
} |
125 |
} |
} |
126 |
|
|
127 |
public void undo() |
public void undo() |