1 | /* |
2 | *Copyright 2007, SDQ, IPD, Uni Karlsruhe (TH) |
3 | */ |
4 | package de.uka.ipd.sdq.pcm.gmf.composite.edit.commands; |
5 | |
6 | import org.eclipse.emf.ecore.EClass; |
7 | import org.eclipse.emf.ecore.EObject; |
8 | import org.eclipse.gmf.runtime.emf.type.core.commands.CreateRelationshipCommand; |
9 | import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; |
10 | |
11 | import de.uka.ipd.sdq.pcm.core.composition.AssemblyConnector; |
12 | import de.uka.ipd.sdq.pcm.core.composition.AssemblyContext; |
13 | import de.uka.ipd.sdq.pcm.core.composition.ComposedStructure; |
14 | import de.uka.ipd.sdq.pcm.core.composition.CompositionPackage; |
15 | import de.uka.ipd.sdq.pcm.repository.OperationProvidedRole; |
16 | import de.uka.ipd.sdq.pcm.repository.OperationRequiredRole; |
17 | |
18 | /** |
19 | * @generated |
20 | */ |
21 | public class AssemblyConnectorTypeLinkCreateCommand extends |
22 | CreateRelationshipCommand { |
23 | |
24 | /** |
25 | * @generated |
26 | */ |
27 | private ComposedStructure myContainer; |
28 | |
29 | /** |
30 | * @generated |
31 | */ |
32 | private OperationRequiredRole mySource; |
33 | |
34 | /** |
35 | * @generated |
36 | */ |
37 | private OperationProvidedRole myTarget; |
38 | |
39 | /** |
40 | * @generated |
41 | */ |
42 | public AssemblyConnectorTypeLinkCreateCommand( |
43 | CreateRelationshipRequest req, ComposedStructure container, |
44 | OperationRequiredRole source, OperationProvidedRole target) { |
45 | super(req); |
46 | super.setElementToEdit(container); |
47 | myContainer = container; |
48 | mySource = source; |
49 | myTarget = target; |
50 | } |
51 | |
52 | /** |
53 | * @generated |
54 | */ |
55 | public ComposedStructure getContainer() { |
56 | return myContainer; |
57 | } |
58 | |
59 | /** |
60 | * @generated |
61 | */ |
62 | public EObject getSource() { |
63 | return mySource; |
64 | } |
65 | |
66 | /** |
67 | * @generated |
68 | */ |
69 | public EObject getTarget() { |
70 | return myTarget; |
71 | } |
72 | |
73 | /** |
74 | * @generated |
75 | */ |
76 | protected EClass getEClassToEdit() { |
77 | return CompositionPackage.eINSTANCE.getComposedStructure(); |
78 | } |
79 | |
80 | /** |
81 | * @generated |
82 | */ |
83 | protected void setElementToEdit(EObject element) { |
84 | throw new UnsupportedOperationException(); |
85 | } |
86 | |
87 | /** |
88 | * @generated not |
89 | */ |
90 | protected EObject doDefaultElementCreation() { |
91 | AssemblyConnector newElement = (AssemblyConnector) super |
92 | .doDefaultElementCreation(); |
93 | if (newElement != null) { |
94 | newElement.setProvidedRole_AssemblyConnector(myTarget); |
95 | newElement.setRequiredRole_AssemblyConnector(mySource); |
96 | CreateRelationshipRequest req = (CreateRelationshipRequest) this.getRequest(); |
97 | newElement.setRequiringAssemblyContext_AssemblyConnector((AssemblyContext) req.getParameter("REQ_CHILD_CONTEXT")); |
98 | newElement.setProvidingAssemblyContext_AssemblyConnector((AssemblyContext) req.getParameter("PROV_CHILD_CONTEXT")); |
99 | } |
100 | return newElement; |
101 | } |
102 | |
103 | } |