| 1 | /* |
| 2 | *Copyright 2006 SDQ Research Group, University of Karlsruhe (TH) |
| 3 | */ |
| 4 | package de.uka.ipd.sdq.pcm.gmf.seff.edit.policies; |
| 5 | |
| 6 | import org.eclipse.emf.transaction.TransactionalEditingDomain; |
| 7 | import org.eclipse.gef.commands.Command; |
| 8 | import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; |
| 9 | import org.eclipse.gmf.runtime.emf.commands.core.commands.DuplicateEObjectsCommand; |
| 10 | import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; |
| 11 | import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest; |
| 12 | |
| 13 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.commands.AcquireActionCreateCommand; |
| 14 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.commands.BranchActionCreateCommand; |
| 15 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.commands.CollectionIteratorActionCreateCommand; |
| 16 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.commands.EmitEventActionCreateCommand; |
| 17 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.commands.ExternalCallActionCreateCommand; |
| 18 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.commands.ForkActionCreateCommand; |
| 19 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.commands.InternalActionCreateCommand; |
| 20 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.commands.LoopActionCreateCommand; |
| 21 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.commands.RecoveryActionCreateCommand; |
| 22 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.commands.ReleaseActionCreateCommand; |
| 23 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.commands.SetVariableActionCreateCommand; |
| 24 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.commands.StartActionCreateCommand; |
| 25 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.commands.StopActionCreateCommand; |
| 26 | import de.uka.ipd.sdq.pcm.gmf.seff.providers.PalladioComponentModelElementTypes; |
| 27 | |
| 28 | /** |
| 29 | * @generated |
| 30 | */ |
| 31 | public class ResourceDemandingSEFFItemSemanticEditPolicy extends |
| 32 | PalladioComponentModelBaseItemSemanticEditPolicy { |
| 33 | |
| 34 | /** |
| 35 | * @generated |
| 36 | */ |
| 37 | public ResourceDemandingSEFFItemSemanticEditPolicy() { |
| 38 | super(PalladioComponentModelElementTypes.ResourceDemandingSEFF_1000); |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * @generated |
| 43 | */ |
| 44 | protected Command getCreateCommand(CreateElementRequest req) { |
| 45 | if (PalladioComponentModelElementTypes.StartAction_2001 == req |
| 46 | .getElementType()) { |
| 47 | return getGEFWrapper(new StartActionCreateCommand(req)); |
| 48 | } |
| 49 | if (PalladioComponentModelElementTypes.StopAction_2002 == req |
| 50 | .getElementType()) { |
| 51 | return getGEFWrapper(new StopActionCreateCommand(req)); |
| 52 | } |
| 53 | if (PalladioComponentModelElementTypes.ExternalCallAction_2003 == req |
| 54 | .getElementType()) { |
| 55 | return getGEFWrapper(new ExternalCallActionCreateCommand(req)); |
| 56 | } |
| 57 | if (PalladioComponentModelElementTypes.EmitEventAction_2013 == req |
| 58 | .getElementType()) { |
| 59 | return getGEFWrapper(new EmitEventActionCreateCommand(req)); |
| 60 | } |
| 61 | if (PalladioComponentModelElementTypes.LoopAction_2004 == req |
| 62 | .getElementType()) { |
| 63 | return getGEFWrapper(new LoopActionCreateCommand(req)); |
| 64 | } |
| 65 | if (PalladioComponentModelElementTypes.BranchAction_2005 == req |
| 66 | .getElementType()) { |
| 67 | return getGEFWrapper(new BranchActionCreateCommand(req)); |
| 68 | } |
| 69 | if (PalladioComponentModelElementTypes.InternalAction_2006 == req |
| 70 | .getElementType()) { |
| 71 | return getGEFWrapper(new InternalActionCreateCommand(req)); |
| 72 | } |
| 73 | if (PalladioComponentModelElementTypes.CollectionIteratorAction_2007 == req |
| 74 | .getElementType()) { |
| 75 | return getGEFWrapper(new CollectionIteratorActionCreateCommand(req)); |
| 76 | } |
| 77 | if (PalladioComponentModelElementTypes.SetVariableAction_2008 == req |
| 78 | .getElementType()) { |
| 79 | return getGEFWrapper(new SetVariableActionCreateCommand(req)); |
| 80 | } |
| 81 | if (PalladioComponentModelElementTypes.AcquireAction_2012 == req |
| 82 | .getElementType()) { |
| 83 | return getGEFWrapper(new AcquireActionCreateCommand(req)); |
| 84 | } |
| 85 | if (PalladioComponentModelElementTypes.ReleaseAction_2010 == req |
| 86 | .getElementType()) { |
| 87 | return getGEFWrapper(new ReleaseActionCreateCommand(req)); |
| 88 | } |
| 89 | if (PalladioComponentModelElementTypes.ForkAction_2011 == req |
| 90 | .getElementType()) { |
| 91 | return getGEFWrapper(new ForkActionCreateCommand(req)); |
| 92 | } |
| 93 | if (PalladioComponentModelElementTypes.RecoveryAction_2016 == req |
| 94 | .getElementType()) { |
| 95 | return getGEFWrapper(new RecoveryActionCreateCommand(req)); |
| 96 | } |
| 97 | return super.getCreateCommand(req); |
| 98 | } |
| 99 | |
| 100 | /** |
| 101 | * @generated |
| 102 | */ |
| 103 | protected Command getDuplicateCommand(DuplicateElementsRequest req) { |
| 104 | TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()) |
| 105 | .getEditingDomain(); |
| 106 | return getGEFWrapper(new DuplicateAnythingCommand(editingDomain, req)); |
| 107 | } |
| 108 | |
| 109 | /** |
| 110 | * @generated |
| 111 | */ |
| 112 | private static class DuplicateAnythingCommand extends |
| 113 | DuplicateEObjectsCommand { |
| 114 | |
| 115 | /** |
| 116 | * @generated |
| 117 | */ |
| 118 | public DuplicateAnythingCommand( |
| 119 | TransactionalEditingDomain editingDomain, |
| 120 | DuplicateElementsRequest req) { |
| 121 | super(editingDomain, req.getLabel(), req |
| 122 | .getElementsToBeDuplicated(), req |
| 123 | .getAllDuplicatedElementsMap()); |
| 124 | } |
| 125 | } |
| 126 | } |