01: /**
02: *
03: */package newprocess.diagram.cust.annotations.commands;
04:
05: import newprocess.Actor;
06: import newprocess.AsyncActivity;
07: import newprocess.Conclusion;
08: import newprocess.Condition;
09: import newprocess.Event;
10: import newprocess.Expansion;
11: import newprocess.Listener;
12: import newprocess.Loader;
13: import newprocess.Message;
14: import newprocess.SyncActivity;
15: import newprocess.diagram.edit.parts.ActorEditPart;
16: import newprocess.diagram.edit.parts.AsyncActivity2EditPart;
17: import newprocess.diagram.edit.parts.AsyncActivityEditPart;
18: import newprocess.diagram.edit.parts.ConclusionEditPart;
19: import newprocess.diagram.edit.parts.ConditionEditPart;
20: import newprocess.diagram.edit.parts.EventEditPart;
21: import newprocess.diagram.edit.parts.ExpansionEditPart;
22: import newprocess.diagram.edit.parts.ListenerEditPart;
23: import newprocess.diagram.edit.parts.LoaderEditPart;
24: import newprocess.diagram.edit.parts.MessageEditPart;
25: import newprocess.diagram.edit.parts.ProcessEditPart;
26: import newprocess.diagram.edit.parts.SyncActivityEditPart;
27:
28: import org.eclipse.emf.common.util.EList;
29: import org.eclipse.gef.EditPart;
30: import org.eclipse.gmf.runtime.notation.Diagram;
31: import org.eclipse.gmf.runtime.notation.Node;
32:
33: /**
34: * @author sh
35: *
36: */
37: public class ReadCommand {
38: /**
39: * Constructor
40: */
41: public ReadCommand() {
42: }
43:
44: /**
45: * Returns the list of urls for the given EditPart
46: * @param selectedEditPart
47: * @return
48: */
49: public EList getValues(EditPart selectedEditPart) {
50: if (selectedEditPart instanceof ProcessEditPart)
51: return ((newprocess.Process) ((Diagram) selectedEditPart
52: .getModel()).getElement()).getUrl();
53: if (selectedEditPart instanceof MessageEditPart)
54: return ((Message) ((Node) selectedEditPart.getModel())
55: .getElement()).getUrl();
56: if (selectedEditPart instanceof LoaderEditPart)
57: return ((Loader) ((Node) selectedEditPart.getModel())
58: .getElement()).getUrl();
59: if (selectedEditPart instanceof ActorEditPart)
60: return ((Actor) ((Node) selectedEditPart.getModel())
61: .getElement()).getUrl();
62: if (selectedEditPart instanceof ConditionEditPart)
63: return ((Condition) ((Node) selectedEditPart.getModel())
64: .getElement()).getUrl();
65: if (selectedEditPart instanceof SyncActivityEditPart)
66: return ((SyncActivity) ((Node) selectedEditPart.getModel())
67: .getElement()).getUrl();
68: if (selectedEditPart instanceof AsyncActivityEditPart
69: || selectedEditPart instanceof AsyncActivity2EditPart)
70: return ((AsyncActivity) ((Node) selectedEditPart.getModel())
71: .getElement()).getUrl();
72: if (selectedEditPart instanceof EventEditPart)
73: return ((Event) ((Node) selectedEditPart.getModel())
74: .getElement()).getUrl();
75: if (selectedEditPart instanceof ListenerEditPart)
76: return ((Listener) ((Node) selectedEditPart.getModel())
77: .getElement()).getUrl();
78: if (selectedEditPart instanceof ConclusionEditPart)
79: return ((Conclusion) ((Node) selectedEditPart.getModel())
80: .getElement()).getUrl();
81: if (selectedEditPart instanceof ExpansionEditPart)
82: return ((Expansion) ((Node) selectedEditPart.getModel())
83: .getElement()).getUrl();
84: return null;
85: }
86: }
|