01: package newprocess.diagram.edit.policies;
02:
03: import newprocess.NewprocessPackage;
04: import newprocess.diagram.edit.commands.ConditionTermCreateCommand;
05: import newprocess.diagram.edit.commands.RootCreateCommand;
06: import newprocess.diagram.providers.New_processElementTypes;
07:
08: import org.eclipse.emf.ecore.EAnnotation;
09: import org.eclipse.emf.ecore.EObject;
10: import org.eclipse.gef.commands.Command;
11: import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
12: import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
13: import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
14: import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
15: import org.eclipse.gmf.runtime.notation.View;
16:
17: /**
18: * @generated
19: */
20: public class Expression6ItemSemanticEditPolicy extends
21: New_processBaseItemSemanticEditPolicy {
22:
23: /**
24: * @generated
25: */
26: protected Command getCreateCommand(CreateElementRequest req) {
27: if (New_processElementTypes.Root_3002 == req.getElementType()) {
28: if (req.getContainmentFeature() == null) {
29: req.setContainmentFeature(NewprocessPackage.eINSTANCE
30: .getExpression_HasRoot());
31: }
32: return getMSLWrapper(new RootCreateCommand(req));
33: }
34: if (New_processElementTypes.ConditionTerm_3005 == req
35: .getElementType()) {
36: if (req.getContainmentFeature() == null) {
37: req.setContainmentFeature(NewprocessPackage.eINSTANCE
38: .getExpression_HasTerms());
39: }
40: return getMSLWrapper(new ConditionTermCreateCommand(req));
41: }
42: return super .getCreateCommand(req);
43: }
44:
45: /**
46: * @generated
47: */
48: protected Command getDestroyElementCommand(DestroyElementRequest req) {
49: return getMSLWrapper(new DestroyElementCommand(req) {
50:
51: protected EObject getElementToDestroy() {
52: View view = (View) getHost().getModel();
53: EAnnotation annotation = view
54: .getEAnnotation("Shortcut"); //$NON-NLS-1$
55: if (annotation != null) {
56: return view;
57: }
58: return super .getElementToDestroy();
59: }
60:
61: });
62: }
63:
64: /**
65: * @generated
66: */
67: protected Command getCreateRelationshipCommand(
68: CreateRelationshipRequest req) {
69: return super.getCreateRelationshipCommand(req);
70: }
71: }
|