1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
package org.argouml.model.euml; |
15 | |
|
16 | |
import java.util.Collection; |
17 | |
|
18 | |
import org.argouml.model.AbstractModelFactory; |
19 | |
import org.argouml.model.ExtensionMechanismsFactory; |
20 | |
import org.eclipse.emf.edit.domain.EditingDomain; |
21 | |
import org.eclipse.uml2.uml.Namespace; |
22 | |
import org.eclipse.uml2.uml.Package; |
23 | |
import org.eclipse.uml2.uml.Stereotype; |
24 | |
import org.eclipse.uml2.uml.UMLFactory; |
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | 0 | class ExtensionMechanismsFactoryEUMLImpl implements |
30 | |
ExtensionMechanismsFactory, AbstractModelFactory { |
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
private EUMLModelImplementation modelImpl; |
36 | |
private EditingDomain editingDomain; |
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
public ExtensionMechanismsFactoryEUMLImpl( |
46 | 0 | EUMLModelImplementation implementation) { |
47 | 0 | modelImpl = implementation; |
48 | 0 | editingDomain = implementation.getEditingDomain(); |
49 | 0 | } |
50 | |
|
51 | |
public Stereotype buildStereotype(Object element, Object name, |
52 | |
Object namespace) { |
53 | 0 | Stereotype stereo = buildStereotype((String) name, |
54 | |
(Namespace) namespace); |
55 | |
|
56 | |
|
57 | |
|
58 | |
|
59 | |
|
60 | |
|
61 | 0 | return stereo; |
62 | |
} |
63 | |
|
64 | |
public Object buildStereotype(Object element, String name, |
65 | |
Object model, Collection models) { |
66 | |
|
67 | 0 | return null; |
68 | |
} |
69 | |
|
70 | |
public Stereotype buildStereotype(final String name, final Object namespace) { |
71 | 0 | RunnableClass run = new RunnableClass() { |
72 | |
public void run() { |
73 | 0 | Stereotype stereo = createStereotype(); |
74 | 0 | stereo.setName(name); |
75 | 0 | if (namespace instanceof Package) { |
76 | 0 | stereo.setPackage((Package) namespace); |
77 | |
} |
78 | 0 | getParams().add(stereo); |
79 | 0 | } |
80 | |
}; |
81 | 0 | ChangeCommand cmd = new ChangeCommand( |
82 | |
modelImpl, run, |
83 | |
"Build a stereotype"); |
84 | 0 | editingDomain.getCommandStack().execute(cmd); |
85 | |
|
86 | 0 | return (Stereotype) run.getParams().get(0); |
87 | |
} |
88 | |
|
89 | |
public Object buildTagDefinition(String name, Object stereotype, Object ns) { |
90 | |
|
91 | 0 | return null; |
92 | |
} |
93 | |
|
94 | |
public Object buildTagDefinition(String name, Object stereotype, |
95 | |
Object namespace, String tagType) { |
96 | |
|
97 | 0 | return null; |
98 | |
} |
99 | |
|
100 | |
@Deprecated |
101 | |
public Object buildTaggedValue(String tag, String value) { |
102 | |
|
103 | 0 | return null; |
104 | |
} |
105 | |
|
106 | |
public Object buildTaggedValue(Object type, String[] value) { |
107 | |
|
108 | 0 | return null; |
109 | |
} |
110 | |
|
111 | |
public Stereotype copyStereotype(Object source, Object ns) { |
112 | |
|
113 | 0 | return null; |
114 | |
} |
115 | |
|
116 | |
public Object copyTagDefinition(Object aTd, Object aNs) { |
117 | |
|
118 | 0 | return null; |
119 | |
} |
120 | |
|
121 | |
public void copyTaggedValues(Object source, Object target) { |
122 | |
|
123 | |
|
124 | 0 | } |
125 | |
|
126 | |
public Stereotype createStereotype() { |
127 | 0 | RunnableClass run = new RunnableClass() { |
128 | |
public void run() { |
129 | 0 | getParams().add(UMLFactory.eINSTANCE.createStereotype()); |
130 | 0 | } |
131 | |
}; |
132 | 0 | ChangeCommand cmd = new ChangeCommand( |
133 | |
modelImpl, run, |
134 | |
"Create a stereotype"); |
135 | 0 | editingDomain.getCommandStack().execute(cmd); |
136 | |
|
137 | 0 | return (Stereotype) run.getParams().get(0); |
138 | |
} |
139 | |
|
140 | |
public Object createTagDefinition() { |
141 | 0 | return UMLFactory.eINSTANCE.createProperty(); |
142 | |
} |
143 | |
|
144 | |
public Object createTaggedValue() { |
145 | |
|
146 | 0 | return null; |
147 | |
} |
148 | |
} |