01: package newprocess.diagram.edit.commands;
02:
03: import newprocess.NewprocessPackage;
04: import newprocess.SyncActivity;
05:
06: import org.eclipse.emf.ecore.EClass;
07: import org.eclipse.emf.ecore.EObject;
08:
09: import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
10:
11: import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
12:
13: import org.eclipse.gmf.runtime.notation.View;
14:
15: /**
16: * @generated
17: */
18: public class ExpressionCreateCommand extends CreateElementCommand {
19:
20: /**
21: * @generated
22: */
23: public ExpressionCreateCommand(CreateElementRequest req) {
24: super (req);
25: }
26:
27: /**
28: * @generated
29: */
30: protected EClass getEClassToEdit() {
31: return NewprocessPackage.eINSTANCE.getSyncActivity();
32: };
33:
34: /**
35: * @generated
36: */
37: protected EObject getElementToEdit() {
38: EObject container = ((CreateElementRequest) getRequest())
39: .getContainer();
40: if (container instanceof View) {
41: container = ((View) container).getElement();
42: }
43: return container;
44: }
45:
46: /**
47: * @generated
48: */
49: public boolean canExecute() {
50: SyncActivity container = (SyncActivity) getElementToEdit();
51: if (container.getHasPrecondition() != null) {
52: return false;
53: }
54: return true;
55: }
56:
57: }
|