01: /**
02: *
03: */package newprocess.diagram.cust.annotations.utils;
04:
05: import newprocess.NewprocessPackage;
06: import newprocess.diagram.edit.parts.ActorEditPart;
07: import newprocess.diagram.edit.parts.AsyncActivity2EditPart;
08: import newprocess.diagram.edit.parts.AsyncActivityEditPart;
09: import newprocess.diagram.edit.parts.ConclusionEditPart;
10: import newprocess.diagram.edit.parts.ConditionEditPart;
11: import newprocess.diagram.edit.parts.EventEditPart;
12: import newprocess.diagram.edit.parts.ExpansionEditPart;
13: import newprocess.diagram.edit.parts.ListenerEditPart;
14: import newprocess.diagram.edit.parts.LoaderEditPart;
15: import newprocess.diagram.edit.parts.MessageEditPart;
16: import newprocess.diagram.edit.parts.ProcessEditPart;
17: import newprocess.diagram.edit.parts.SyncActivityEditPart;
18:
19: import org.eclipse.emf.ecore.EAttribute;
20: import org.eclipse.gef.EditPart;
21:
22: /**
23: * @author sh
24: *
25: */
26: public class FeatureUtil {
27: /**
28: * Constructor
29: */
30: public FeatureUtil() {
31: }
32:
33: /**
34: * This method is used by Commands and fetchs the right
35: * structural feature which value is to be set
36: */
37: public EAttribute getFeature(EditPart editPart) {
38: if (editPart instanceof ProcessEditPart)
39: return NewprocessPackage.eINSTANCE.getElement_Url();
40: if (editPart instanceof MessageEditPart)
41: return NewprocessPackage.eINSTANCE.getElement_Url();
42: if (editPart instanceof LoaderEditPart)
43: return NewprocessPackage.eINSTANCE.getElement_Url();
44: if (editPart instanceof ActorEditPart)
45: return NewprocessPackage.eINSTANCE.getElement_Url();
46: if (editPart instanceof ConditionEditPart)
47: return NewprocessPackage.eINSTANCE.getElement_Url();
48: if (editPart instanceof SyncActivityEditPart)
49: return NewprocessPackage.eINSTANCE.getElement_Url();
50: if (editPart instanceof AsyncActivityEditPart
51: || editPart instanceof AsyncActivity2EditPart)
52: return NewprocessPackage.eINSTANCE.getElement_Url();
53: if (editPart instanceof EventEditPart)
54: return NewprocessPackage.eINSTANCE.getElement_Url();
55: if (editPart instanceof ListenerEditPart)
56: return NewprocessPackage.eINSTANCE.getElement_Url();
57: if (editPart instanceof ConclusionEditPart)
58: return NewprocessPackage.eINSTANCE.getElement_Url();
59: if (editPart instanceof ExpansionEditPart)
60: return NewprocessPackage.eINSTANCE.getElement_Url();
61: return null;
62: }
63:
64: /**
65: * This method checks if the given EditPart supports
66: * Annotations.
67: */
68: public boolean isAttributeSupported(EditPart editPart) {
69: if (editPart instanceof ProcessEditPart
70: || editPart instanceof MessageEditPart
71: || editPart instanceof LoaderEditPart
72: || editPart instanceof ActorEditPart
73: || editPart instanceof ConditionEditPart
74: || editPart instanceof SyncActivityEditPart
75: || editPart instanceof AsyncActivityEditPart
76: || editPart instanceof AsyncActivity2EditPart
77: || editPart instanceof EventEditPart
78: || editPart instanceof ListenerEditPart
79: || editPart instanceof ConclusionEditPart
80: || editPart instanceof ExpansionEditPart)
81: return true;
82: return false;
83: }
84: }
|