| 1 | /* |
| 2 | *Copyright 2007, SDQ, IPD, University of Karlsruhe |
| 3 | */ |
| 4 | package de.uka.ipd.sdq.pcm.gmf.usage.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.usage.edit.commands.UsageScenarioCreateCommand; |
| 14 | import de.uka.ipd.sdq.pcm.gmf.usage.providers.PalladioComponentModelElementTypes; |
| 15 | |
| 16 | /** |
| 17 | * @generated |
| 18 | */ |
| 19 | public class UsageScenarioItemSemanticEditPolicy extends |
| 20 | PalladioComponentModelBaseItemSemanticEditPolicy { |
| 21 | |
| 22 | /** |
| 23 | * @generated |
| 24 | */ |
| 25 | public UsageScenarioItemSemanticEditPolicy() { |
| 26 | super(PalladioComponentModelElementTypes.UsageModel_1000); |
| 27 | } |
| 28 | |
| 29 | /** |
| 30 | * @generated |
| 31 | */ |
| 32 | protected Command getCreateCommand(CreateElementRequest req) { |
| 33 | if (PalladioComponentModelElementTypes.UsageScenario_2004 == req |
| 34 | .getElementType()) { |
| 35 | return getGEFWrapper(new UsageScenarioCreateCommand(req)); |
| 36 | } |
| 37 | return super.getCreateCommand(req); |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * @generated |
| 42 | */ |
| 43 | protected Command getDuplicateCommand(DuplicateElementsRequest req) { |
| 44 | TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()) |
| 45 | .getEditingDomain(); |
| 46 | return getGEFWrapper(new DuplicateAnythingCommand(editingDomain, req)); |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * @generated |
| 51 | */ |
| 52 | private static class DuplicateAnythingCommand extends |
| 53 | DuplicateEObjectsCommand { |
| 54 | |
| 55 | /** |
| 56 | * @generated |
| 57 | */ |
| 58 | public DuplicateAnythingCommand( |
| 59 | TransactionalEditingDomain editingDomain, |
| 60 | DuplicateElementsRequest req) { |
| 61 | super(editingDomain, req.getLabel(), req |
| 62 | .getElementsToBeDuplicated(), req |
| 63 | .getAllDuplicatedElementsMap()); |
| 64 | } |
| 65 | } |
| 66 | } |