001: package newprocess.diagram.edit.policies;
002:
003: import org.eclipse.emf.transaction.TransactionalEditingDomain;
004: import org.eclipse.gef.commands.Command;
005: import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
006: import org.eclipse.gmf.runtime.emf.commands.core.commands.DuplicateEObjectsCommand;
007: import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest;
008: import newprocess.NewprocessPackage;
009:
010: import newprocess.diagram.edit.commands.ActorCreateCommand;
011: import newprocess.diagram.edit.commands.AsyncActivity2CreateCommand;
012: import newprocess.diagram.edit.commands.AsyncActivityCreateCommand;
013: import newprocess.diagram.edit.commands.ConclusionCreateCommand;
014: import newprocess.diagram.edit.commands.ConditionProxyCreateCommand;
015: import newprocess.diagram.edit.commands.EventCreateCommand;
016: import newprocess.diagram.edit.commands.ExpansionCreateCommand;
017: import newprocess.diagram.edit.commands.GlobalsCreateCommand;
018: import newprocess.diagram.edit.commands.ListenerCreateCommand;
019: import newprocess.diagram.edit.commands.MessageCreateCommand;
020: import newprocess.diagram.edit.commands.SyncActivityCreateCommand;
021:
022: import newprocess.diagram.providers.New_processElementTypes;
023:
024: import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
025:
026: /**
027: * @generated
028: */
029: public class ProcessItemSemanticEditPolicy extends
030: New_processBaseItemSemanticEditPolicy {
031:
032: /**
033: * @generated
034: */
035: protected Command getCreateCommand(CreateElementRequest req) {
036: if (New_processElementTypes.SyncActivity_2001 == req
037: .getElementType()) {
038: if (req.getContainmentFeature() == null) {
039: req.setContainmentFeature(NewprocessPackage.eINSTANCE
040: .getProcess_HasSyncActivities());
041: }
042: return getMSLWrapper(new SyncActivityCreateCommand(req));
043: }
044: if (New_processElementTypes.Listener_2002 == req
045: .getElementType()) {
046: if (req.getContainmentFeature() == null) {
047: req.setContainmentFeature(NewprocessPackage.eINSTANCE
048: .getProcess_HasListeners());
049: }
050: return getMSLWrapper(new ListenerCreateCommand(req));
051: }
052: if (New_processElementTypes.AsyncActivity_2003 == req
053: .getElementType()) {
054: if (req.getContainmentFeature() == null) {
055: req.setContainmentFeature(NewprocessPackage.eINSTANCE
056: .getProcess_HasAsyncActivities());
057: }
058: return getMSLWrapper(new AsyncActivityCreateCommand(req));
059: }
060: if (New_processElementTypes.Event_2005 == req.getElementType()) {
061: if (req.getContainmentFeature() == null) {
062: req.setContainmentFeature(NewprocessPackage.eINSTANCE
063: .getProcess_HasEvents());
064: }
065: return getMSLWrapper(new EventCreateCommand(req));
066: }
067: if (New_processElementTypes.ConditionProxy_2006 == req
068: .getElementType()) {
069: if (req.getContainmentFeature() == null) {
070: req.setContainmentFeature(NewprocessPackage.eINSTANCE
071: .getProcess_HasConditionProxy());
072: }
073: return getMSLWrapper(new ConditionProxyCreateCommand(req));
074: }
075: if (New_processElementTypes.Actor_2007 == req.getElementType()) {
076: if (req.getContainmentFeature() == null) {
077: req.setContainmentFeature(NewprocessPackage.eINSTANCE
078: .getProcess_HasActors());
079: }
080: return getMSLWrapper(new ActorCreateCommand(req));
081: }
082: if (New_processElementTypes.Message_2008 == req
083: .getElementType()) {
084: if (req.getContainmentFeature() == null) {
085: req.setContainmentFeature(NewprocessPackage.eINSTANCE
086: .getProcess_HasMessages());
087: }
088: return getMSLWrapper(new MessageCreateCommand(req));
089: }
090: if (New_processElementTypes.Expansion_2009 == req
091: .getElementType()) {
092: if (req.getContainmentFeature() == null) {
093: req.setContainmentFeature(NewprocessPackage.eINSTANCE
094: .getProcess_HasExpansions());
095: }
096: return getMSLWrapper(new ExpansionCreateCommand(req));
097: }
098: if (New_processElementTypes.Conclusion_2010 == req
099: .getElementType()) {
100: if (req.getContainmentFeature() == null) {
101: req.setContainmentFeature(NewprocessPackage.eINSTANCE
102: .getProcess_HasConclusions());
103: }
104: return getMSLWrapper(new ConclusionCreateCommand(req));
105: }
106: if (New_processElementTypes.Globals_2011 == req
107: .getElementType()) {
108: if (req.getContainmentFeature() == null) {
109: req.setContainmentFeature(NewprocessPackage.eINSTANCE
110: .getProcess_HasGlobals());
111: }
112: return getMSLWrapper(new GlobalsCreateCommand(req));
113: }
114: return super .getCreateCommand(req);
115: }
116:
117: /**
118: * @generated
119: */
120: protected Command getDuplicateCommand(DuplicateElementsRequest req) {
121: TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost())
122: .getEditingDomain();
123: return getMSLWrapper(new DuplicateAnythingCommand(
124: editingDomain, req));
125: }
126:
127: /**
128: * @generated
129: */
130: private static class DuplicateAnythingCommand extends
131: DuplicateEObjectsCommand {
132:
133: /**
134: * @generated
135: */
136: public DuplicateAnythingCommand(
137: TransactionalEditingDomain editingDomain,
138: DuplicateElementsRequest req) {
139: super(editingDomain, req.getLabel(), req
140: .getElementsToBeDuplicated(), req
141: .getAllDuplicatedElementsMap());
142: }
143: }
144: }
|