01: package newprocess.diagram.edit.policies;
02:
03: import newprocess.diagram.cust.operation.SyncActivityDeleteOperation;
04:
05: import org.eclipse.emf.ecore.EAnnotation;
06: import org.eclipse.emf.ecore.EObject;
07: import org.eclipse.gef.commands.Command;
08: import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
09: import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
10: import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
11: import org.eclipse.gmf.runtime.notation.View;
12:
13: /**
14: * @generated
15: */
16: public class SyncActivityItemSemanticEditPolicy extends
17: New_processBaseItemSemanticEditPolicy {
18:
19: /**
20: * @generated NOT
21: * @author sh
22: */
23: protected Command getDestroyElementCommand(DestroyElementRequest req) {
24: return getMSLWrapper(new DestroyElementCommand(req) {
25:
26: protected EObject getElementToDestroy() {
27: View view = (View) getHost().getModel();
28: EAnnotation annotation = view
29: .getEAnnotation("Shortcut"); //$NON-NLS-1$
30: if (annotation != null) {
31: return view;
32: }
33:
34: // if the activity should be deleted, also delete all linked terms
35: SyncActivityDeleteOperation deleteOperation = new SyncActivityDeleteOperation();
36: deleteOperation.doExecute(getHost());
37:
38: return super .getElementToDestroy();
39: }
40:
41: });
42: }
43:
44: /**
45: * @generated
46: */
47: protected Command getCreateRelationshipCommand(
48: CreateRelationshipRequest req) {
49: return super.getCreateRelationshipCommand(req);
50: }
51: }
|