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