| 1 | /* |
| 2 | *Copyright 2007, SDQ, IPD, U KA |
| 3 | */ |
| 4 | package de.uka.ipd.sdq.pcm.gmf.allocation.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.DuplicateElementsRequest; |
| 11 | import de.uka.ipd.sdq.pcm.gmf.allocation.edit.commands.ResourceContainerCreateCommand; |
| 12 | |
| 13 | import de.uka.ipd.sdq.pcm.gmf.allocation.providers.PalladioComponentModelElementTypes; |
| 14 | |
| 15 | import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; |
| 16 | |
| 17 | /** |
| 18 | * @generated |
| 19 | */ |
| 20 | public class AllocationItemSemanticEditPolicy extends |
| 21 | PalladioComponentModelBaseItemSemanticEditPolicy { |
| 22 | |
| 23 | /** |
| 24 | * @generated |
| 25 | */ |
| 26 | protected Command getCreateCommand(CreateElementRequest req) { |
| 27 | if (PalladioComponentModelElementTypes.ResourceContainer_2002 == req |
| 28 | .getElementType()) { |
| 29 | return getGEFWrapper(new ResourceContainerCreateCommand(req)); |
| 30 | } |
| 31 | return super.getCreateCommand(req); |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * @generated |
| 36 | */ |
| 37 | protected Command getDuplicateCommand(DuplicateElementsRequest req) { |
| 38 | TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()) |
| 39 | .getEditingDomain(); |
| 40 | return getGEFWrapper(new DuplicateAnythingCommand(editingDomain, req)); |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * @generated |
| 45 | */ |
| 46 | private static class DuplicateAnythingCommand extends |
| 47 | DuplicateEObjectsCommand { |
| 48 | |
| 49 | /** |
| 50 | * @generated |
| 51 | */ |
| 52 | public DuplicateAnythingCommand( |
| 53 | TransactionalEditingDomain editingDomain, |
| 54 | DuplicateElementsRequest req) { |
| 55 | super(editingDomain, req.getLabel(), req |
| 56 | .getElementsToBeDuplicated(), req |
| 57 | .getAllDuplicatedElementsMap()); |
| 58 | } |
| 59 | } |
| 60 | } |