| 1 | /* |
| 2 | *Copyright 2007, SDQ, IPD, U KA |
| 3 | */ |
| 4 | package de.uka.ipd.sdq.pcm.gmf.allocation.edit.policies; |
| 5 | |
| 6 | import de.uka.ipd.sdq.pcm.allocation.Allocation; |
| 7 | import de.uka.ipd.sdq.pcm.allocation.AllocationPackage; |
| 8 | |
| 9 | import de.uka.ipd.sdq.pcm.gmf.allocation.edit.commands.AllocationContextCreateCommand; |
| 10 | |
| 11 | import de.uka.ipd.sdq.pcm.gmf.allocation.providers.PalladioComponentModelElementTypes; |
| 12 | |
| 13 | import org.eclipse.gef.commands.Command; |
| 14 | |
| 15 | import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; |
| 16 | import org.eclipse.gmf.runtime.notation.View; |
| 17 | |
| 18 | /** |
| 19 | * @generated |
| 20 | */ |
| 21 | public class ResourceContainerAllocationCompartmentItemSemanticEditPolicy |
| 22 | extends PalladioComponentModelBaseItemSemanticEditPolicy { |
| 23 | |
| 24 | /** |
| 25 | * @generated not |
| 26 | */ |
| 27 | protected Command getCreateCommand(CreateElementRequest req) { |
| 28 | if (PalladioComponentModelElementTypes.AllocationContext_3001 == req |
| 29 | .getElementType()) { |
| 30 | if (req.getContainmentFeature() == null) { |
| 31 | req.setContainmentFeature(AllocationPackage.eINSTANCE |
| 32 | .getAllocation_AllocationContexts_Allocation()); |
| 33 | } |
| 34 | Allocation a = (Allocation) ((View) getHost().getParent() |
| 35 | .getParent().getModel()).getElement(); |
| 36 | return getMSLWrapper(new AllocationContextCreateCommand(req, a)); |
| 37 | } |
| 38 | return super.getCreateCommand(req); |
| 39 | } |
| 40 | } |