1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.argouml.model.euml; |
17 | |
|
18 | |
import java.util.List; |
19 | |
|
20 | |
import org.argouml.model.AbstractModelFactory; |
21 | |
import org.argouml.model.CoreFactory; |
22 | |
import org.argouml.model.NotImplementedException; |
23 | |
import org.eclipse.emf.edit.domain.EditingDomain; |
24 | |
import org.eclipse.uml2.uml.Abstraction; |
25 | |
import org.eclipse.uml2.uml.AggregationKind; |
26 | |
import org.eclipse.uml2.uml.Artifact; |
27 | |
import org.eclipse.uml2.uml.Association; |
28 | |
import org.eclipse.uml2.uml.AssociationClass; |
29 | |
import org.eclipse.uml2.uml.BehavioralFeature; |
30 | |
import org.eclipse.uml2.uml.BehavioredClassifier; |
31 | |
import org.eclipse.uml2.uml.Classifier; |
32 | |
import org.eclipse.uml2.uml.Comment; |
33 | |
import org.eclipse.uml2.uml.Component; |
34 | |
import org.eclipse.uml2.uml.Constraint; |
35 | |
import org.eclipse.uml2.uml.DataType; |
36 | |
import org.eclipse.uml2.uml.Dependency; |
37 | |
import org.eclipse.uml2.uml.Element; |
38 | |
import org.eclipse.uml2.uml.Enumeration; |
39 | |
import org.eclipse.uml2.uml.EnumerationLiteral; |
40 | |
import org.eclipse.uml2.uml.Generalization; |
41 | |
import org.eclipse.uml2.uml.Interface; |
42 | |
import org.eclipse.uml2.uml.InterfaceRealization; |
43 | |
import org.eclipse.uml2.uml.Manifestation; |
44 | |
import org.eclipse.uml2.uml.MultiplicityElement; |
45 | |
import org.eclipse.uml2.uml.NamedElement; |
46 | |
import org.eclipse.uml2.uml.Namespace; |
47 | |
import org.eclipse.uml2.uml.Node; |
48 | |
import org.eclipse.uml2.uml.OpaqueBehavior; |
49 | |
import org.eclipse.uml2.uml.Operation; |
50 | |
import org.eclipse.uml2.uml.PackageImport; |
51 | |
import org.eclipse.uml2.uml.PackageableElement; |
52 | |
import org.eclipse.uml2.uml.Parameter; |
53 | |
import org.eclipse.uml2.uml.PrimitiveType; |
54 | |
import org.eclipse.uml2.uml.Property; |
55 | |
import org.eclipse.uml2.uml.Stereotype; |
56 | |
import org.eclipse.uml2.uml.TemplateBinding; |
57 | |
import org.eclipse.uml2.uml.TemplateParameter; |
58 | |
import org.eclipse.uml2.uml.TemplateParameterSubstitution; |
59 | |
import org.eclipse.uml2.uml.TemplateSignature; |
60 | |
import org.eclipse.uml2.uml.TemplateableElement; |
61 | |
import org.eclipse.uml2.uml.Type; |
62 | |
import org.eclipse.uml2.uml.UMLFactory; |
63 | |
import org.eclipse.uml2.uml.Usage; |
64 | |
import org.eclipse.uml2.uml.ValueSpecification; |
65 | |
import org.eclipse.uml2.uml.VisibilityKind; |
66 | |
|
67 | |
|
68 | |
|
69 | |
|
70 | 0 | class CoreFactoryEUMLImpl implements CoreFactory, AbstractModelFactory { |
71 | |
|
72 | |
|
73 | |
|
74 | |
|
75 | |
private final EUMLModelImplementation modelImpl; |
76 | |
|
77 | |
private final EditingDomain editingDomain; |
78 | |
|
79 | |
|
80 | |
|
81 | |
|
82 | |
|
83 | |
|
84 | |
|
85 | 0 | public CoreFactoryEUMLImpl(EUMLModelImplementation implementation) { |
86 | 0 | modelImpl = implementation; |
87 | 0 | editingDomain = implementation.getEditingDomain(); |
88 | 0 | } |
89 | |
|
90 | |
public Abstraction buildAbstraction(final String name, |
91 | |
final Object supplier, final Object client) { |
92 | 0 | if (!(client instanceof NamedElement) |
93 | |
|| !(supplier instanceof NamedElement)) { |
94 | 0 | throw new IllegalArgumentException( |
95 | |
"The client and the supplier " + |
96 | |
"must be NamedElements."); |
97 | |
} |
98 | 0 | if (((NamedElement) client).getNearestPackage() == null) { |
99 | 0 | throw new NullPointerException( |
100 | |
"The containing package of the client " + |
101 | |
"must be non-null."); |
102 | |
} |
103 | 0 | RunnableClass run = new RunnableClass() { |
104 | |
public void run() { |
105 | 0 | Abstraction abstraction = createAbstraction(); |
106 | 0 | if (name != null) { |
107 | 0 | abstraction.setName(name); |
108 | |
} |
109 | 0 | abstraction.getSuppliers().add((NamedElement) supplier); |
110 | 0 | abstraction.getClients().add((NamedElement) client); |
111 | 0 | ((NamedElement) client).getNearestPackage() |
112 | |
.getPackagedElements().add(abstraction); |
113 | 0 | getParams().add(abstraction); |
114 | 0 | } |
115 | |
}; |
116 | 0 | ChangeCommand cmd = new ChangeCommand( |
117 | |
modelImpl, run, |
118 | |
"Create the abstraction # between " + |
119 | |
"the client # and the supplier #"); |
120 | 0 | editingDomain.getCommandStack().execute(cmd); |
121 | 0 | cmd.setObjects(run.getParams().get(0), client, supplier); |
122 | |
|
123 | 0 | return (Abstraction) run.getParams().get(0); |
124 | |
} |
125 | |
|
126 | |
private Association buildAssociation(final Object type1, |
127 | |
final Boolean navigability1, final Object aggregationKind1, |
128 | |
final Object type2, final Boolean navigability2, |
129 | |
final Object aggregationKind2, final String associationName) { |
130 | 0 | if (!(type1 instanceof Type) || !(type2 instanceof Type)) { |
131 | 0 | throw new IllegalArgumentException( |
132 | |
"The types must be instances of Type."); |
133 | |
} |
134 | 0 | if ((aggregationKind1 != null |
135 | |
&& !(aggregationKind1 instanceof AggregationKind)) |
136 | |
|| (aggregationKind2 != null |
137 | |
&& !(aggregationKind2 instanceof AggregationKind))) { |
138 | 0 | throw new IllegalArgumentException( |
139 | |
"The aggregations of the association ends" + |
140 | |
" must be instances of AggregationKind."); |
141 | |
} |
142 | 0 | if (((Type) type1).getNearestPackage() == null) { |
143 | 0 | throw new NullPointerException( |
144 | |
"The containing package of the type1" + |
145 | |
" must be non-null."); |
146 | |
} |
147 | 0 | RunnableClass run = new RunnableClass() { |
148 | |
public void run() { |
149 | 0 | Association association = createAssociation(); |
150 | 0 | Property property1 = buildAssociationEndInternal(association, |
151 | |
null, (Type) type1, null, null, navigability1, null, |
152 | |
(AggregationKind) aggregationKind1, null, null, null); |
153 | 0 | Property property2 = buildAssociationEndInternal(association, |
154 | |
null, (Type) type2, null, null, navigability2, null, |
155 | |
(AggregationKind) aggregationKind2, null, null, null); |
156 | 0 | if (associationName != null) { |
157 | 0 | association.setName(associationName); |
158 | |
} |
159 | 0 | association.getOwnedEnds().add(property1); |
160 | 0 | association.getOwnedEnds().add(property2); |
161 | |
|
162 | |
|
163 | |
|
164 | |
|
165 | |
|
166 | |
|
167 | |
|
168 | |
|
169 | |
|
170 | |
|
171 | |
|
172 | |
|
173 | |
|
174 | |
|
175 | |
|
176 | |
|
177 | |
|
178 | |
|
179 | 0 | ((Type) type1).getNearestPackage().getPackagedElements().add( |
180 | |
association); |
181 | 0 | getParams().add(association); |
182 | 0 | } |
183 | |
}; |
184 | 0 | ChangeCommand cmd = new ChangeCommand( |
185 | |
modelImpl, run, "Create the association # between # and #"); |
186 | 0 | editingDomain.getCommandStack().execute(cmd); |
187 | 0 | cmd.setObjects(run.getParams().get(0), type1, type2); |
188 | |
|
189 | 0 | return (Association) run.getParams().get(0); |
190 | |
} |
191 | |
|
192 | |
@Deprecated |
193 | |
public Association buildAssociation(Object fromClassifier, |
194 | |
Object aggregationKind1, Object toClassifier, |
195 | |
Object aggregationKind2, Boolean unidirectional) { |
196 | 0 | if (unidirectional != null) { |
197 | 0 | return buildAssociation( |
198 | |
fromClassifier, !unidirectional, aggregationKind1, toClassifier, |
199 | |
true, aggregationKind2, null); |
200 | |
} else { |
201 | 0 | return buildAssociation( |
202 | |
fromClassifier, null, aggregationKind1, toClassifier, null, |
203 | |
aggregationKind2, null); |
204 | |
} |
205 | |
} |
206 | |
|
207 | |
|
208 | |
public Object buildAssociation(Object fromClassifier, |
209 | |
Object aggregationKind1, Object toClassifier, |
210 | |
Object aggregationKind2, boolean unidirectional) { |
211 | 0 | return buildAssociation( |
212 | |
fromClassifier, true, aggregationKind1, toClassifier, |
213 | |
!unidirectional, aggregationKind2, null); |
214 | |
} |
215 | |
|
216 | |
|
217 | |
public Association buildAssociation(Object classifier1, |
218 | |
Object classifier2) { |
219 | 0 | return buildAssociation( |
220 | |
classifier1, null, null, classifier2, null, null, null); |
221 | |
} |
222 | |
|
223 | |
public Association buildAssociation(Object c1, boolean nav1, Object c2, |
224 | |
boolean nav2, String name) { |
225 | 0 | return buildAssociation(c1, nav1, null, c2, nav2, null, name); |
226 | |
} |
227 | |
|
228 | |
public AssociationClass buildAssociationClass(final Object end1, |
229 | |
final Object end2) { |
230 | 0 | if (!(end1 instanceof Type) || !(end2 instanceof Type)) { |
231 | 0 | throw new IllegalArgumentException( |
232 | |
"end1 and end2 must be instances of Type"); |
233 | |
} |
234 | 0 | if (((Type) end1).getNearestPackage() == null) { |
235 | 0 | throw new NullPointerException( |
236 | |
"The containing package of " + |
237 | |
"the end1 must be non-null."); |
238 | |
} |
239 | 0 | RunnableClass run = new RunnableClass() { |
240 | |
public void run() { |
241 | 0 | AssociationClass associationClass = createAssociationClass(); |
242 | 0 | Property property1 = createAssociationEnd(); |
243 | 0 | Property property2 = createAssociationEnd(); |
244 | 0 | property1.setType((Type) end2); |
245 | 0 | property2.setType((Type) end1); |
246 | 0 | property1.setAssociation(associationClass); |
247 | 0 | property2.setAssociation(associationClass); |
248 | 0 | ((Type) end1).getNearestPackage().getPackagedElements().add( |
249 | |
associationClass); |
250 | 0 | if (UMLUtil.getOwnedAttributes((Type) end1) == null) { |
251 | 0 | associationClass.getOwnedAttributes().add(property1); |
252 | |
} else { |
253 | 0 | UMLUtil.getOwnedAttributes((Type) end1).add(property1); |
254 | |
} |
255 | 0 | if (UMLUtil.getOwnedAttributes((Type) end2) == null) { |
256 | 0 | associationClass.getOwnedAttributes().add(property2); |
257 | |
} else { |
258 | 0 | UMLUtil.getOwnedAttributes((Type) end2).add(property2); |
259 | |
} |
260 | 0 | getParams().add(associationClass); |
261 | 0 | } |
262 | |
}; |
263 | 0 | ChangeCommand cmd = new ChangeCommand( |
264 | |
modelImpl, run, |
265 | |
"Create the association class # between # and #"); |
266 | 0 | editingDomain.getCommandStack().execute(cmd); |
267 | 0 | cmd.setObjects(run.getParams().get(0), end1, end2); |
268 | |
|
269 | 0 | return (AssociationClass) run.getParams().get(0); |
270 | |
} |
271 | |
|
272 | |
private Property buildAssociationEnd(final Object assoc, final String name, |
273 | |
final Object type, final Object multi, final Object stereo, |
274 | |
final Boolean navigable, final Object order, |
275 | |
final Object aggregation, final Object scope, |
276 | |
final Object changeable, final Object visibility) { |
277 | |
|
278 | |
|
279 | 0 | if (!(assoc instanceof Association)) { |
280 | 0 | throw new IllegalArgumentException( |
281 | |
"The assoc must be instance of Association."); |
282 | |
} |
283 | 0 | if (!(type instanceof Type)) { |
284 | 0 | throw new IllegalArgumentException( |
285 | |
"The type of the property " + |
286 | |
"must be instance of Type."); |
287 | |
} |
288 | 0 | if (aggregation != null && !(aggregation instanceof AggregationKind)) { |
289 | 0 | throw new IllegalArgumentException( |
290 | |
"The aggregation of the property " + |
291 | |
"must be instance of AggregationKind."); |
292 | |
} |
293 | 0 | if (visibility != null && !(visibility instanceof VisibilityKind)) { |
294 | 0 | throw new IllegalArgumentException( |
295 | |
"The visibility of the property must" + |
296 | |
" be instance of VisibilityKind."); |
297 | |
} |
298 | 0 | if (multi != null && !(multi instanceof MultiplicityElement)) { |
299 | 0 | throw new IllegalArgumentException( |
300 | |
"The multilicity of the property must" + |
301 | |
" be instance of MultiplicityElement."); |
302 | |
} |
303 | 0 | MultiplicityElement m = (MultiplicityElement) multi; |
304 | 0 | final int lower = m.getLower(); |
305 | 0 | final int upper = m.getUpper(); |
306 | 0 | if ((order != null && !(order instanceof Boolean)) |
307 | |
|| (changeable != null && !(changeable instanceof Boolean))) { |
308 | 0 | throw new IllegalArgumentException( |
309 | |
"The isOrdered, isReadOnly attributes of " + |
310 | |
"the property must be instances of Boolean."); |
311 | |
} |
312 | 0 | if (stereo != null && !(stereo instanceof Stereotype)) { |
313 | 0 | throw new IllegalArgumentException( |
314 | |
"stereo must be instance of Stereotype."); |
315 | |
} |
316 | 0 | RunnableClass run = new RunnableClass() { |
317 | |
public void run() { |
318 | 0 | Property property = buildAssociationEndInternal( |
319 | |
(Association) assoc, name, (Type) type, |
320 | |
new Integer[] {lower, upper}, (Stereotype) stereo, |
321 | |
navigable, (Boolean) order, |
322 | |
(AggregationKind) aggregation,(Boolean) scope, |
323 | |
(Boolean) changeable, (VisibilityKind) visibility); |
324 | 0 | getParams().add(property); |
325 | 0 | } |
326 | |
}; |
327 | 0 | modelImpl.getModelEventPump().getRootContainer().setHoldEvents(true); |
328 | 0 | ChangeCommand cmd = new ChangeCommand( |
329 | |
modelImpl, run, |
330 | |
"Create the association end # of the association #"); |
331 | 0 | editingDomain.getCommandStack().execute(cmd); |
332 | 0 | if (run.getParams().isEmpty()) { |
333 | 0 | editingDomain.getCommandStack().undo(); |
334 | 0 | editingDomain.getCommandStack().flush(); |
335 | 0 | modelImpl.getModelEventPump().getRootContainer().clearHeldEvents(); |
336 | 0 | modelImpl.getModelEventPump().getRootContainer().setHoldEvents( |
337 | |
false); |
338 | 0 | throw new UnsupportedOperationException( |
339 | |
"This stereotype cannot be applied " + |
340 | |
"to the association end."); |
341 | |
} |
342 | 0 | cmd.setObjects(run.getParams().get(0), assoc); |
343 | 0 | modelImpl.getModelEventPump().getRootContainer().setHoldEvents(false); |
344 | |
|
345 | 0 | return (Property) run.getParams().get(0); |
346 | |
} |
347 | |
|
348 | |
private Property buildAssociationEndInternal(final Association assoc, |
349 | |
final String name, final Type type, |
350 | |
final Integer[] multi, final Stereotype stereo, |
351 | |
final Boolean navigable, final Boolean order, |
352 | |
final AggregationKind aggregation, final Object scope, |
353 | |
final Object changeable, final VisibilityKind visibility) { |
354 | |
|
355 | |
|
356 | |
|
357 | 0 | Property property = createAssociationEnd(); |
358 | 0 | property.setType((Type) type); |
359 | 0 | property.setAssociation((Association) assoc); |
360 | 0 | if (name != null) { |
361 | 0 | property.setName(name); |
362 | |
} |
363 | 0 | if (navigable != null) { |
364 | 0 | property.setIsNavigable(navigable); |
365 | 0 | if (!(Boolean) navigable) { |
366 | 0 | ((Association) assoc).getOwnedEnds().add(property); |
367 | |
} |
368 | |
} |
369 | 0 | if (aggregation != null) { |
370 | 0 | property.setAggregation((AggregationKind) aggregation); |
371 | |
} |
372 | 0 | if (visibility != null) { |
373 | 0 | property.setVisibility((VisibilityKind) visibility); |
374 | |
} |
375 | 0 | if (multi != null) { |
376 | 0 | if (multi[0] != null) { |
377 | 0 | property.setLower(multi[0]); |
378 | |
} |
379 | 0 | if (multi[1] != null) { |
380 | 0 | property.setUpper(multi[1]); |
381 | |
} |
382 | |
} |
383 | 0 | if (order != null) { |
384 | 0 | property.setIsOrdered((Boolean) order); |
385 | |
} |
386 | 0 | if (changeable != null) { |
387 | 0 | property.setIsReadOnly((Boolean) changeable); |
388 | |
} |
389 | 0 | if (stereo != null) { |
390 | 0 | if (property.isStereotypeApplicable((Stereotype) stereo)) { |
391 | 0 | property.applyStereotype((Stereotype) stereo); |
392 | |
} |
393 | |
} |
394 | 0 | return property; |
395 | |
} |
396 | |
|
397 | |
@Deprecated |
398 | |
public Property buildAssociationEnd(Object assoc, String name, Object type, |
399 | |
Object multi, Object stereo, boolean navigable, Object order, |
400 | |
Object aggregation, Object scope, Object changeable, |
401 | |
Object visibility) { |
402 | 0 | throw new NotImplementedException(); |
403 | |
} |
404 | |
|
405 | |
public Property buildAssociationEnd(Object assoc, String name, Object type, |
406 | |
Integer[] multi, Object stereo, boolean navigable, Object order, |
407 | |
Object aggregation, Object scope, Object changeable, |
408 | |
Object visibility) { |
409 | 0 | return buildAssociationEndInternal((Association) assoc, name, |
410 | |
(Type) type, multi, (Stereotype) stereo, (Boolean) navigable, |
411 | |
(Boolean) order, (AggregationKind) aggregation, scope, |
412 | |
changeable, (VisibilityKind) visibility); |
413 | |
} |
414 | |
|
415 | |
public Property buildAssociationEnd(Object type, Object assoc) { |
416 | 0 | return buildAssociationEnd( |
417 | |
assoc, null, type, null, null, null, null, null, null, null, |
418 | |
null); |
419 | |
} |
420 | |
|
421 | |
public Property buildAttribute(Object model, Object type) { |
422 | 0 | return buildAttribute2(type); |
423 | |
} |
424 | |
|
425 | |
public Property buildAttribute2(Object type) { |
426 | 0 | if (!(type instanceof Type)) { |
427 | 0 | throw new IllegalArgumentException( |
428 | |
"The type of the attribute must" + |
429 | |
" be instance of Type."); |
430 | |
} |
431 | 0 | Property property = createAttribute(); |
432 | 0 | property.setType((Type) type); |
433 | 0 | return property; |
434 | |
} |
435 | |
|
436 | |
|
437 | |
public Property buildAttribute2(final Object handle, final Object type) { |
438 | 0 | if (!(handle instanceof Type) || !(type instanceof Type)) { |
439 | 0 | throw new IllegalArgumentException( |
440 | |
"handle and type must be instances of Type."); |
441 | |
} |
442 | 0 | if (UMLUtil.getOwnedAttributes((Type) handle) == null) { |
443 | 0 | throw new UnsupportedOperationException( |
444 | |
"The type " + handle.getClass() |
445 | |
+ " does not support owning attributes."); |
446 | |
} |
447 | 0 | RunnableClass run = new RunnableClass() { |
448 | |
public void run() { |
449 | 0 | Property property = createAttribute(); |
450 | 0 | UMLUtil.getOwnedAttributes((Type) handle).add(property); |
451 | 0 | property.setType((Type) type); |
452 | 0 | property.setName("newAttr"); |
453 | 0 | getParams().add(property); |
454 | 0 | } |
455 | |
}; |
456 | 0 | ChangeCommand cmd = new ChangeCommand( |
457 | |
modelImpl, run, "Create the attribute # of the type #"); |
458 | 0 | editingDomain.getCommandStack().execute(cmd); |
459 | 0 | cmd.setObjects(run.getParams().get(0), handle); |
460 | |
|
461 | 0 | return (Property) run.getParams().get(0); |
462 | |
} |
463 | |
|
464 | |
|
465 | |
|
466 | |
|
467 | |
@Deprecated |
468 | |
public Object buildBinding(Object client, Object supplier, List arguments) { |
469 | 0 | return buildTemplateBinding(client, supplier, arguments); |
470 | |
} |
471 | |
|
472 | |
public TemplateBinding buildTemplateBinding(final Object client, |
473 | |
final Object supplier, final List arguments) { |
474 | |
|
475 | |
|
476 | 0 | if (!(client instanceof TemplateableElement)) { |
477 | 0 | throw new IllegalArgumentException( |
478 | |
"The supplier must be instance of " + |
479 | |
"TemplateableElement."); |
480 | |
} |
481 | 0 | if (!(supplier instanceof TemplateSignature)) { |
482 | 0 | throw new IllegalArgumentException( |
483 | |
"The supplier must be instance of " + |
484 | |
"TemplateSignature."); |
485 | |
} |
486 | 0 | if (arguments != null) { |
487 | 0 | for (Object o : arguments) { |
488 | 0 | if (!(o instanceof TemplateParameterSubstitution)) { |
489 | 0 | throw new IllegalArgumentException( |
490 | |
"The list of arguments must be instances" + |
491 | |
" of TemplateParameterSubstitutions."); |
492 | |
} |
493 | |
} |
494 | |
} |
495 | 0 | RunnableClass run = new RunnableClass() { |
496 | |
public void run() { |
497 | 0 | TemplateBinding templateBinding = createTemplateBinding(); |
498 | 0 | templateBinding.setBoundElement((TemplateableElement) client); |
499 | 0 | templateBinding.setSignature((TemplateSignature) supplier); |
500 | 0 | if (arguments != null) { |
501 | 0 | for (Object o : arguments) { |
502 | 0 | templateBinding.getParameterSubstitutions().add( |
503 | |
(TemplateParameterSubstitution) o); |
504 | |
} |
505 | |
} |
506 | 0 | getParams().add(templateBinding); |
507 | 0 | } |
508 | |
}; |
509 | 0 | ChangeCommand cmd = new ChangeCommand( |
510 | |
modelImpl, run, |
511 | |
"Create the template binding # between " |
512 | |
+ "the client # and the supplier #"); |
513 | 0 | editingDomain.getCommandStack().execute(cmd); |
514 | 0 | cmd.setObjects(run.getParams().get(0), client, supplier); |
515 | |
|
516 | 0 | return (TemplateBinding) run.getParams().get(0); |
517 | |
} |
518 | |
|
519 | |
public org.eclipse.uml2.uml.Class buildClass() { |
520 | 0 | return createClass(); |
521 | |
} |
522 | |
|
523 | |
public org.eclipse.uml2.uml.Class buildClass(Object owner) { |
524 | 0 | return buildClass(null, owner); |
525 | |
} |
526 | |
|
527 | |
public org.eclipse.uml2.uml.Class buildClass(String name) { |
528 | 0 | org.eclipse.uml2.uml.Class clazz = createClass(); |
529 | 0 | if (name != null) { |
530 | 0 | clazz.setName(name); |
531 | |
} |
532 | 0 | return clazz; |
533 | |
} |
534 | |
|
535 | |
public org.eclipse.uml2.uml.Class buildClass(final String name, |
536 | |
final Object owner) { |
537 | 0 | if (!(owner instanceof org.eclipse.uml2.uml.Package) |
538 | |
&& !(owner instanceof org.eclipse.uml2.uml.Class) |
539 | |
&& !(owner instanceof Interface)) { |
540 | 0 | throw new IllegalArgumentException( |
541 | |
"The owner must be instance of Package" + |
542 | |
" or UML2 Class or Interface."); |
543 | |
} |
544 | 0 | RunnableClass run = new RunnableClass() { |
545 | |
public void run() { |
546 | 0 | org.eclipse.uml2.uml.Class clazz = createClass(); |
547 | 0 | if (name != null) { |
548 | 0 | clazz.setName(name); |
549 | |
} |
550 | 0 | if (owner instanceof org.eclipse.uml2.uml.Package) { |
551 | 0 | clazz.setPackage((org.eclipse.uml2.uml.Package) owner); |
552 | 0 | } else if (owner instanceof org.eclipse.uml2.uml.Class) { |
553 | 0 | ((org.eclipse.uml2.uml.Class) owner).getNestedClassifiers() |
554 | |
.add(clazz); |
555 | 0 | } else if (owner instanceof Interface) { |
556 | 0 | ((Interface) owner).getNestedClassifiers().add(clazz); |
557 | |
} |
558 | 0 | getParams().add(clazz); |
559 | 0 | } |
560 | |
}; |
561 | 0 | ChangeCommand cmd = new ChangeCommand( |
562 | |
modelImpl, run, "Create the class # of the owner #"); |
563 | 0 | editingDomain.getCommandStack().execute(cmd); |
564 | 0 | cmd.setObjects(run.getParams().get(0), owner); |
565 | |
|
566 | 0 | return (org.eclipse.uml2.uml.Class) run.getParams().get(0); |
567 | |
} |
568 | |
|
569 | |
public Comment buildComment(final Object element, final Object model) { |
570 | 0 | if (!(model instanceof Namespace)) { |
571 | 0 | throw new IllegalArgumentException( |
572 | |
"A namespace must be supplied."); |
573 | |
} |
574 | 0 | if (element != null && !(element instanceof Element)) { |
575 | 0 | throw new IllegalArgumentException( |
576 | |
"The annotated element must be instance of Element."); |
577 | |
} |
578 | 0 | RunnableClass run = new RunnableClass() { |
579 | |
public void run() { |
580 | 0 | Comment comment = createComment(); |
581 | 0 | if (element != null) { |
582 | 0 | comment.getAnnotatedElements().add((Element) element); |
583 | |
} |
584 | 0 | ((Namespace) model).getOwnedComments().add(comment); |
585 | 0 | getParams().add(comment); |
586 | 0 | } |
587 | |
}; |
588 | |
ChangeCommand cmd; |
589 | 0 | if (element == null) { |
590 | 0 | cmd = new ChangeCommand(modelImpl, run, "Create the comment #"); |
591 | |
} else { |
592 | 0 | cmd = new ChangeCommand( |
593 | |
modelImpl, run, |
594 | |
"Create the comment # attached to the element #"); |
595 | |
} |
596 | 0 | editingDomain.getCommandStack().execute(cmd); |
597 | 0 | if (element == null) { |
598 | 0 | cmd.setObjects(run.getParams().get(0)); |
599 | |
} else { |
600 | 0 | cmd.setObjects(run.getParams().get(0), element); |
601 | |
} |
602 | |
|
603 | 0 | return (Comment) run.getParams().get(0); |
604 | |
} |
605 | |
|
606 | |
public Constraint buildConstraint(final Object constrElement) { |
607 | 0 | if (!(constrElement instanceof Element)) { |
608 | 0 | throw new IllegalArgumentException( |
609 | |
"The constrained element must be instance of Element."); |
610 | |
} |
611 | 0 | if (((Element) constrElement).getNearestPackage() == null) { |
612 | 0 | throw new NullPointerException( |
613 | |
"The containing package of the constrained" |
614 | |
+ " element must be non-null."); |
615 | |
} |
616 | 0 | RunnableClass run = new RunnableClass() { |
617 | |
public void run() { |
618 | 0 | Constraint constraint = createConstraint(); |
619 | 0 | constraint.getConstrainedElements() |
620 | |
.add((Element) constrElement); |
621 | 0 | getParams().add(constraint); |
622 | 0 | } |
623 | |
}; |
624 | 0 | ChangeCommand cmd = new ChangeCommand( |
625 | |
modelImpl, run, |
626 | |
"Create the constraint # that constrains the element #"); |
627 | 0 | editingDomain.getCommandStack().execute(cmd); |
628 | 0 | cmd.setObjects(run.getParams().get(0), constrElement); |
629 | |
|
630 | 0 | return (Constraint) run.getParams().get(0); |
631 | |
} |
632 | |
|
633 | |
public Constraint buildConstraint(String name, Object bexpr) { |
634 | |
|
635 | |
|
636 | 0 | if (!(bexpr instanceof ValueSpecification)) { |
637 | 0 | throw new IllegalArgumentException( |
638 | |
"The 'bexpr' value specification must be " |
639 | |
+ "instance of ValueSpecification"); |
640 | |
} |
641 | 0 | Constraint constraint = createConstraint(); |
642 | 0 | if (name != null) { |
643 | 0 | constraint.setName(name); |
644 | |
} |
645 | 0 | constraint.setSpecification((ValueSpecification) bexpr); |
646 | 0 | return constraint; |
647 | |
} |
648 | |
|
649 | |
public DataType buildDataType(final String name, final Object owner) { |
650 | 0 | if (!(owner instanceof org.eclipse.uml2.uml.Package) |
651 | |
&& !(owner instanceof org.eclipse.uml2.uml.Class) |
652 | |
&& !(owner instanceof Interface)) { |
653 | 0 | throw new IllegalArgumentException( |
654 | |
"The owner must be instance of Package" |
655 | |
+ " or UML2 Class or Interface."); |
656 | |
} |
657 | 0 | RunnableClass run = new RunnableClass() { |
658 | |
public void run() { |
659 | 0 | DataType dataType = createDataType(); |
660 | 0 | if (name != null) { |
661 | 0 | dataType.setName(name); |
662 | |
} |
663 | 0 | if (owner instanceof org.eclipse.uml2.uml.Package) { |
664 | 0 | dataType.setPackage((org.eclipse.uml2.uml.Package) owner); |
665 | 0 | } else if (owner instanceof org.eclipse.uml2.uml.Class) { |
666 | 0 | ((org.eclipse.uml2.uml.Class) owner).getNestedClassifiers() |
667 | |
.add(dataType); |
668 | 0 | } else if (owner instanceof Interface) { |
669 | 0 | ((Interface) owner).getNestedClassifiers().add(dataType); |
670 | |
} |
671 | 0 | getParams().add(dataType); |
672 | 0 | } |
673 | |
}; |
674 | 0 | ChangeCommand cmd = new ChangeCommand( |
675 | |
modelImpl, run, "Create the data type # owned by #"); |
676 | 0 | editingDomain.getCommandStack().execute(cmd); |
677 | 0 | cmd.setObjects(run.getParams().get(0), owner); |
678 | |
|
679 | 0 | return (DataType) run.getParams().get(0); |
680 | |
} |
681 | |
|
682 | |
public Dependency buildDependency(final Object clientObj, |
683 | |
final Object supplierObj) { |
684 | 0 | if (!(clientObj instanceof NamedElement) |
685 | |
|| !(supplierObj instanceof NamedElement)) { |
686 | 0 | throw new IllegalArgumentException( |
687 | |
"The client and the supplier must be" |
688 | |
+ " instances of NamedElement."); |
689 | |
} |
690 | 0 | if (((NamedElement) clientObj).getNearestPackage() == null) { |
691 | 0 | throw new NullPointerException( |
692 | |
"The containing package of the client must be non-null."); |
693 | |
} |
694 | 0 | RunnableClass run = new RunnableClass() { |
695 | |
public void run() { |
696 | 0 | Dependency dependency = createDependency(); |
697 | 0 | dependency.getClients().add((NamedElement) clientObj); |
698 | 0 | dependency.getSuppliers().add((NamedElement) supplierObj); |
699 | 0 | ((NamedElement) clientObj).getNearestPackage() |
700 | |
.getPackagedElements().add(dependency); |
701 | 0 | getParams().add(dependency); |
702 | 0 | } |
703 | |
}; |
704 | 0 | ChangeCommand cmd = new ChangeCommand( |
705 | |
modelImpl, run, "Create the dependency # between the" |
706 | |
+ " client # and the supplier #"); |
707 | 0 | editingDomain.getCommandStack().execute(cmd); |
708 | 0 | cmd.setObjects(run.getParams().get(0), clientObj, supplierObj); |
709 | |
|
710 | 0 | return (Dependency) run.getParams().get(0); |
711 | |
} |
712 | |
|
713 | |
public Object buildElementResidence(Object me, Object component) { |
714 | |
|
715 | 0 | throw new NotImplementedException(); |
716 | |
} |
717 | |
|
718 | |
public Enumeration buildEnumeration(final String name, final Object owner) { |
719 | 0 | if (!(owner instanceof org.eclipse.uml2.uml.Package) |
720 | |
&& !(owner instanceof org.eclipse.uml2.uml.Class) |
721 | |
&& !(owner instanceof Interface)) { |
722 | 0 | throw new IllegalArgumentException( |
723 | |
"The owner must be instance of Package or UML2 Class or Interface."); |
724 | |
} |
725 | 0 | RunnableClass run = new RunnableClass() { |
726 | |
public void run() { |
727 | 0 | Enumeration enumeration = createEnumeration(); |
728 | 0 | if (name != null) { |
729 | 0 | enumeration.setName(name); |
730 | |
} |
731 | 0 | if (owner instanceof org.eclipse.uml2.uml.Package) { |
732 | 0 | enumeration.setPackage( |
733 | |
(org.eclipse.uml2.uml.Package) owner); |
734 | 0 | } else if (owner instanceof org.eclipse.uml2.uml.Class) { |
735 | 0 | ((org.eclipse.uml2.uml.Class) owner).getNestedClassifiers() |
736 | |
.add(enumeration); |
737 | 0 | } else if (owner instanceof Interface) { |
738 | 0 | ((Interface) owner).getNestedClassifiers().add(enumeration); |
739 | |
} |
740 | 0 | getParams().add(enumeration); |
741 | 0 | } |
742 | |
}; |
743 | 0 | ChangeCommand cmd = new ChangeCommand( |
744 | |
modelImpl, run, "Create the enumeration # owned by #"); |
745 | 0 | editingDomain.getCommandStack().execute(cmd); |
746 | 0 | cmd.setObjects(run.getParams().get(0), owner); |
747 | |
|
748 | 0 | return (Enumeration) run.getParams().get(0); |
749 | |
} |
750 | |
|
751 | |
public EnumerationLiteral buildEnumerationLiteral(final String name, |
752 | |
final Object enumeration) { |
753 | 0 | if (!(enumeration instanceof Enumeration)) { |
754 | 0 | throw new IllegalArgumentException( |
755 | |
"The enumeration must be instance of Enumeration."); |
756 | |
} |
757 | 0 | RunnableClass run = new RunnableClass() { |
758 | |
public void run() { |
759 | 0 | EnumerationLiteral enumerationLiteral = |
760 | |
createEnumerationLiteral(); |
761 | 0 | if (name != null) { |
762 | 0 | enumerationLiteral.setName(name); |
763 | |
} |
764 | 0 | enumerationLiteral.setEnumeration((Enumeration) enumeration); |
765 | 0 | getParams().add(enumerationLiteral); |
766 | 0 | } |
767 | |
}; |
768 | 0 | ChangeCommand cmd = new ChangeCommand( |
769 | |
modelImpl, run, "Create the enumeration literal # owned by #"); |
770 | 0 | editingDomain.getCommandStack().execute(cmd); |
771 | 0 | cmd.setObjects(run.getParams().get(0), enumeration); |
772 | |
|
773 | 0 | return (EnumerationLiteral) run.getParams().get(0); |
774 | |
} |
775 | |
|
776 | |
|
777 | |
public Generalization buildGeneralization(final Object child, |
778 | |
final Object parent) { |
779 | 0 | if (!(child instanceof Classifier) || !(parent instanceof Classifier)) { |
780 | 0 | throw new IllegalArgumentException( |
781 | |
"The general (the parent) and the specific (the child) must be instances of Classifier."); |
782 | |
} |
783 | 0 | RunnableClass run = new RunnableClass() { |
784 | |
public void run() { |
785 | 0 | Generalization generalization = createGeneralization(); |
786 | 0 | generalization.setGeneral((Classifier) parent); |
787 | 0 | generalization.setSpecific((Classifier) child); |
788 | 0 | getParams().add(generalization); |
789 | 0 | } |
790 | |
}; |
791 | 0 | ChangeCommand cmd = new ChangeCommand( |
792 | |
modelImpl, run, |
793 | |
"Create the generalization # between # (general) and # (specific)"); |
794 | 0 | editingDomain.getCommandStack().execute(cmd); |
795 | 0 | cmd.setObjects(run.getParams().get(0), parent, child); |
796 | |
|
797 | 0 | return (Generalization) run.getParams().get(0); |
798 | |
} |
799 | |
|
800 | |
public Interface buildInterface() { |
801 | 0 | return createInterface(); |
802 | |
} |
803 | |
|
804 | |
public Interface buildInterface(Object owner) { |
805 | 0 | return buildInterface(null, owner); |
806 | |
} |
807 | |
|
808 | |
public Interface buildInterface(String name) { |
809 | 0 | Interface interfaze = createInterface(); |
810 | 0 | if (name != null) { |
811 | 0 | interfaze.setName(name); |
812 | |
} |
813 | 0 | return interfaze; |
814 | |
} |
815 | |
|
816 | |
public Interface buildInterface(final String name, final Object owner) { |
817 | 0 | if (!(owner instanceof org.eclipse.uml2.uml.Package) |
818 | |
&& !(owner instanceof org.eclipse.uml2.uml.Class) |
819 | |
&& !(owner instanceof Interface)) { |
820 | 0 | throw new IllegalArgumentException( |
821 | |
"The owner must be instance of Package" + |
822 | |
" or UML2 Class or Interface."); |
823 | |
} |
824 | 0 | RunnableClass run = new RunnableClass() { |
825 | |
public void run() { |
826 | 0 | Interface interfaze = createInterface(); |
827 | 0 | if (owner instanceof org.eclipse.uml2.uml.Package) { |
828 | 0 | interfaze.setPackage((org.eclipse.uml2.uml.Package) owner); |
829 | 0 | } else if (owner instanceof org.eclipse.uml2.uml.Class) { |
830 | 0 | ((org.eclipse.uml2.uml.Class) owner).getNestedClassifiers() |
831 | |
.add(interfaze); |
832 | 0 | } else if (owner instanceof Interface) { |
833 | 0 | ((Interface) owner).getNestedClassifiers().add(interfaze); |
834 | |
} |
835 | 0 | if (name != null) { |
836 | 0 | interfaze.setName(name); |
837 | |
} |
838 | 0 | getParams().add(interfaze); |
839 | 0 | } |
840 | |
}; |
841 | 0 | ChangeCommand cmd = new ChangeCommand( |
842 | |
modelImpl, run, "Create the interface # owned by #"); |
843 | 0 | editingDomain.getCommandStack().execute(cmd); |
844 | 0 | cmd.setObjects(run.getParams().get(0), owner); |
845 | |
|
846 | 0 | return (Interface) run.getParams().get(0); |
847 | |
} |
848 | |
|
849 | |
public Object buildManifestation(Object utilizedElement) { |
850 | 0 | if (!(utilizedElement instanceof PackageableElement)) { |
851 | 0 | throw new IllegalArgumentException( |
852 | |
"The utilized element must be an instance of PackageableElement."); |
853 | |
} |
854 | 0 | Manifestation m = UMLFactory.eINSTANCE.createManifestation(); |
855 | 0 | m.setName(((PackageableElement) utilizedElement).getName() + " manifestation"); |
856 | 0 | m.setUtilizedElement((PackageableElement) utilizedElement); |
857 | 0 | return m; |
858 | |
} |
859 | |
|
860 | |
public Object buildMethod(String name) { |
861 | |
|
862 | 0 | OpaqueBehavior method = UMLFactory.eINSTANCE.createOpaqueBehavior(); |
863 | 0 | method.setName(name); |
864 | 0 | return method; |
865 | |
} |
866 | |
|
867 | |
public Operation buildOperation(Object classifier, Object returnType) { |
868 | 0 | return buildOperation2(classifier, returnType, null); |
869 | |
} |
870 | |
|
871 | |
|
872 | |
public Operation buildOperation2(final Object cls, final Object returnType, |
873 | |
final String name) { |
874 | 0 | if ((returnType != null && !(returnType instanceof Type)) |
875 | |
|| !(cls instanceof Type)) { |
876 | 0 | throw new IllegalArgumentException( |
877 | |
"cls and returnType must be instances of Type."); |
878 | |
} |
879 | 0 | if (UMLUtil.getOwnedOperations((Type) cls) == null) { |
880 | 0 | throw new UnsupportedOperationException( |
881 | |
"The type " + cls.getClass() |
882 | |
+ " does not support owning operations."); |
883 | |
} |
884 | 0 | RunnableClass run = new RunnableClass() { |
885 | |
public void run() { |
886 | 0 | Operation operation = createOperation(); |
887 | 0 | UMLUtil.getOwnedOperations((Type) cls).add(operation); |
888 | 0 | operation.createReturnResult("return", (Type) returnType); |
889 | 0 | if (name != null) { |
890 | 0 | operation.setName(name); |
891 | |
} else { |
892 | |
|
893 | 0 | operation.setName("newOperation"); |
894 | |
} |
895 | 0 | getParams().add(operation); |
896 | 0 | } |
897 | |
}; |
898 | 0 | ChangeCommand cmd = new ChangeCommand( |
899 | |
modelImpl, run, "Create the operation # owned by #"); |
900 | 0 | editingDomain.getCommandStack().execute(cmd); |
901 | 0 | cmd.setObjects(run.getParams().get(0), cls); |
902 | |
|
903 | 0 | return (Operation) run.getParams().get(0); |
904 | |
} |
905 | |
|
906 | |
|
907 | |
public Parameter buildParameter(final Object o, final Object type) { |
908 | |
|
909 | |
|
910 | |
|
911 | 0 | if (!(o instanceof BehavioralFeature)) { |
912 | 0 | throw new IllegalArgumentException( |
913 | |
"The parameter must be attached to a BehavioralFeature."); |
914 | |
} |
915 | 0 | if (!(type instanceof Type)) { |
916 | 0 | throw new IllegalArgumentException( |
917 | |
"The type of the parameter must be instance of Type."); |
918 | |
} |
919 | 0 | RunnableClass run = new RunnableClass() { |
920 | |
public void run() { |
921 | 0 | Parameter param = createParameter(); |
922 | 0 | param.setType((Type) type); |
923 | |
|
924 | 0 | param.setName("arg" + |
925 | |
((BehavioralFeature) o).getOwnedParameters().size()); |
926 | 0 | ((BehavioralFeature) o).getOwnedParameters().add(param); |
927 | 0 | getParams().add(param); |
928 | 0 | } |
929 | |
}; |
930 | 0 | ChangeCommand cmd = new ChangeCommand( |
931 | |
modelImpl, run, "Create the parameter # owned by #"); |
932 | 0 | editingDomain.getCommandStack().execute(cmd); |
933 | 0 | cmd.setObjects(run.getParams().get(0), o); |
934 | |
|
935 | 0 | return (Parameter) run.getParams().get(0); |
936 | |
} |
937 | |
|
938 | |
|
939 | |
public PackageImport buildPackageAccess(Object client, Object supplier) { |
940 | 0 | return buildPackageImport( |
941 | |
client, supplier, VisibilityKind.PRIVATE_LITERAL); |
942 | |
} |
943 | |
|
944 | |
public PackageImport buildPackageImport(Object client, Object supplier) { |
945 | 0 | return buildPackageImport(client, supplier, null); |
946 | |
} |
947 | |
|
948 | |
private PackageImport buildPackageImport(final Object client, |
949 | |
final Object supplier, final VisibilityKind visibility) { |
950 | 0 | if (!(client instanceof Namespace)) { |
951 | 0 | throw new IllegalArgumentException( |
952 | |
"The client must be instance of Namespace."); |
953 | |
} |
954 | 0 | if (!(supplier instanceof org.eclipse.uml2.uml.Package)) { |
955 | 0 | throw new IllegalArgumentException( |
956 | |
"The supplier must be instance of Package."); |
957 | |
} |
958 | 0 | RunnableClass run = new RunnableClass() { |
959 | |
public void run() { |
960 | 0 | PackageImport packageImport = createPackageImport(); |
961 | 0 | packageImport.setImportedPackage((org.eclipse.uml2.uml.Package) supplier); |
962 | 0 | packageImport.setImportingNamespace((Namespace) client); |
963 | 0 | if (visibility != null) { |
964 | 0 | packageImport.setVisibility(visibility); |
965 | |
} |
966 | 0 | getParams().add(packageImport); |
967 | 0 | } |
968 | |
}; |
969 | 0 | ChangeCommand cmd = new ChangeCommand( |
970 | |
modelImpl, run, |
971 | |
"Create the package import # between the client # and the supplier #"); |
972 | 0 | editingDomain.getCommandStack().execute(cmd); |
973 | 0 | cmd.setObjects(run.getParams().get(0), client, supplier); |
974 | |
|
975 | 0 | return (PackageImport) run.getParams().get(0); |
976 | |
} |
977 | |
|
978 | |
public InterfaceRealization buildRealization(final Object client, |
979 | |
final Object supplier, Object namespace) { |
980 | |
|
981 | |
|
982 | 0 | if (!(client instanceof BehavioredClassifier)) { |
983 | 0 | throw new IllegalArgumentException( |
984 | |
"The client must be instance of BehavioredClassifier"); |
985 | |
} |
986 | 0 | if (!(supplier instanceof Interface)) { |
987 | 0 | throw new IllegalArgumentException( |
988 | |
"The supplier must be an Interface"); |
989 | |
} |
990 | 0 | RunnableClass run = new RunnableClass() { |
991 | |
public void run() { |
992 | 0 | InterfaceRealization realization = |
993 | |
UMLFactory.eINSTANCE.createInterfaceRealization(); |
994 | 0 | realization.setImplementingClassifier( |
995 | |
(BehavioredClassifier) client); |
996 | 0 | realization.setContract((Interface) supplier); |
997 | 0 | ((BehavioredClassifier) client).getInterfaceRealizations() |
998 | |
.add(realization); |
999 | 0 | getParams().add(realization); |
1000 | 0 | } |
1001 | |
}; |
1002 | 0 | ChangeCommand cmd = new ChangeCommand( |
1003 | |
modelImpl, run, |
1004 | |
"Create the interface realization # between" |
1005 | |
+ " the client # and the supplier #"); |
1006 | 0 | editingDomain.getCommandStack().execute(cmd); |
1007 | 0 | cmd.setObjects(run.getParams().get(0), client, supplier); |
1008 | |
|
1009 | 0 | return (InterfaceRealization) run.getParams().get(0); |
1010 | |
} |
1011 | |
|
1012 | |
public Object buildTemplateArgument(Object element) { |
1013 | |
|
1014 | 0 | throw new NotImplementedException(); |
1015 | |
} |
1016 | |
|
1017 | |
public Usage buildUsage(final Object client, final Object supplier) { |
1018 | 0 | if (!(client instanceof NamedElement) |
1019 | |
|| !(supplier instanceof NamedElement)) { |
1020 | 0 | throw new IllegalArgumentException( |
1021 | |
"The client and the supplier must be NamedElements."); |
1022 | |
} |
1023 | 0 | if (((NamedElement) client).getNearestPackage() == null) { |
1024 | 0 | throw new NullPointerException( |
1025 | |
"The client is not contained in a package."); |
1026 | |
} |
1027 | 0 | RunnableClass run = new RunnableClass() { |
1028 | |
public void run() { |
1029 | 0 | Usage usage = createUsage(); |
1030 | 0 | usage.getClients().add((NamedElement) client); |
1031 | 0 | usage.getSuppliers().add((NamedElement) supplier); |
1032 | 0 | ((NamedElement) client).getNearestPackage() |
1033 | |
.getPackagedElements().add(usage); |
1034 | 0 | getParams().add(usage); |
1035 | 0 | } |
1036 | |
}; |
1037 | 0 | ChangeCommand cmd = new ChangeCommand( |
1038 | |
modelImpl, run, |
1039 | |
"Create the usage # between the client # and the supplier #"); |
1040 | 0 | editingDomain.getCommandStack().execute(cmd); |
1041 | 0 | cmd.setObjects(run.getParams().get(0), client, supplier); |
1042 | |
|
1043 | 0 | return (Usage) run.getParams().get(0); |
1044 | |
} |
1045 | |
|
1046 | |
public Object copyClass(Object source, Object ns) { |
1047 | 0 | return modelImpl.getCopyHelper().copy(source, ns); |
1048 | |
} |
1049 | |
|
1050 | |
public Object copyDataType(Object source, Object ns) { |
1051 | 0 | return modelImpl.getCopyHelper().copy(source, ns); |
1052 | |
} |
1053 | |
|
1054 | |
public Object copyFeature(Object source, Object classifier) { |
1055 | 0 | return modelImpl.getCopyHelper().copy(source, classifier); |
1056 | |
} |
1057 | |
|
1058 | |
public Object copyInterface(Object source, Object ns) { |
1059 | 0 | return modelImpl.getCopyHelper().copy(source, ns); |
1060 | |
} |
1061 | |
|
1062 | |
public Abstraction createAbstraction() { |
1063 | 0 | return UMLFactory.eINSTANCE.createAbstraction(); |
1064 | |
} |
1065 | |
|
1066 | |
public Artifact createArtifact() { |
1067 | 0 | return UMLFactory.eINSTANCE.createArtifact(); |
1068 | |
} |
1069 | |
|
1070 | |
@Deprecated |
1071 | |
public Association createAssociation() { |
1072 | 0 | return createAssociation(null); |
1073 | |
} |
1074 | |
|
1075 | |
public Association createAssociation(Object extent) { |
1076 | 0 | RunnableClass run = new RunnableClass() { |
1077 | |
public void run() { |
1078 | 0 | getParams().add(UMLFactory.eINSTANCE.createAssociation()); |
1079 | 0 | } |
1080 | |
}; |
1081 | 0 | ChangeCommand cmd = new ChangeCommand( |
1082 | |
modelImpl, run, |
1083 | |
"Create an association"); |
1084 | 0 | editingDomain.getCommandStack().execute(cmd); |
1085 | |
|
1086 | 0 | return (Association) run.getParams().get(0); |
1087 | |
} |
1088 | |
|
1089 | |
public AssociationClass createAssociationClass() { |
1090 | 0 | return UMLFactory.eINSTANCE.createAssociationClass(); |
1091 | |
} |
1092 | |
|
1093 | |
public Property createAssociationEnd() { |
1094 | 0 | return UMLFactory.eINSTANCE.createProperty(); |
1095 | |
} |
1096 | |
|
1097 | |
public Property createAttribute() { |
1098 | 0 | return UMLFactory.eINSTANCE.createProperty(); |
1099 | |
} |
1100 | |
|
1101 | |
|
1102 | |
|
1103 | |
|
1104 | |
@Deprecated |
1105 | |
public TemplateBinding createBinding() { |
1106 | 0 | return createTemplateBinding(); |
1107 | |
} |
1108 | |
|
1109 | |
public TemplateBinding createTemplateBinding() { |
1110 | 0 | return UMLFactory.eINSTANCE.createTemplateBinding(); |
1111 | |
} |
1112 | |
|
1113 | |
public org.eclipse.uml2.uml.Class createClass() { |
1114 | 0 | return UMLFactory.eINSTANCE.createClass(); |
1115 | |
} |
1116 | |
|
1117 | |
public Comment createComment() { |
1118 | 0 | return UMLFactory.eINSTANCE.createComment(); |
1119 | |
} |
1120 | |
|
1121 | |
public Component createComponent() { |
1122 | 0 | return UMLFactory.eINSTANCE.createComponent(); |
1123 | |
} |
1124 | |
|
1125 | |
public Constraint createConstraint() { |
1126 | 0 | return UMLFactory.eINSTANCE.createConstraint(); |
1127 | |
} |
1128 | |
|
1129 | |
public DataType createDataType() { |
1130 | 0 | return UMLFactory.eINSTANCE.createDataType(); |
1131 | |
} |
1132 | |
|
1133 | |
public Dependency createDependency() { |
1134 | 0 | return UMLFactory.eINSTANCE.createDependency(); |
1135 | |
} |
1136 | |
|
1137 | |
public Object createElementResidence() { |
1138 | |
|
1139 | 0 | throw new NotImplementedException(); |
1140 | |
} |
1141 | |
|
1142 | |
public Enumeration createEnumeration() { |
1143 | 0 | return UMLFactory.eINSTANCE.createEnumeration(); |
1144 | |
} |
1145 | |
|
1146 | |
public EnumerationLiteral createEnumerationLiteral() { |
1147 | 0 | return UMLFactory.eINSTANCE.createEnumerationLiteral(); |
1148 | |
} |
1149 | |
|
1150 | |
public Object createFlow() { |
1151 | |
|
1152 | 0 | throw new NotImplementedException(); |
1153 | |
} |
1154 | |
|
1155 | |
public Generalization createGeneralization() { |
1156 | 0 | return createGeneralization(null); |
1157 | |
} |
1158 | |
|
1159 | |
public Generalization createGeneralization(Object extent) { |
1160 | |
|
1161 | 0 | return UMLFactory.eINSTANCE.createGeneralization(); |
1162 | |
} |
1163 | |
|
1164 | |
public Interface createInterface() { |
1165 | 0 | return UMLFactory.eINSTANCE.createInterface(); |
1166 | |
} |
1167 | |
|
1168 | |
public Object createMethod() { |
1169 | |
|
1170 | 0 | throw new NotImplementedException(); |
1171 | |
} |
1172 | |
|
1173 | |
public Node createNode() { |
1174 | 0 | return UMLFactory.eINSTANCE.createNode(); |
1175 | |
} |
1176 | |
|
1177 | |
public Operation createOperation() { |
1178 | 0 | return UMLFactory.eINSTANCE.createOperation(); |
1179 | |
} |
1180 | |
|
1181 | |
public Parameter createParameter() { |
1182 | 0 | return UMLFactory.eINSTANCE.createParameter(); |
1183 | |
} |
1184 | |
|
1185 | |
|
1186 | |
|
1187 | |
|
1188 | |
@Deprecated |
1189 | |
public PackageImport createPermission() { |
1190 | 0 | return createPackageImport(); |
1191 | |
} |
1192 | |
|
1193 | |
public PackageImport createPackageImport() { |
1194 | 0 | return UMLFactory.eINSTANCE.createPackageImport(); |
1195 | |
} |
1196 | |
|
1197 | |
public PrimitiveType createPrimitiveType() { |
1198 | 0 | return UMLFactory.eINSTANCE.createPrimitiveType(); |
1199 | |
} |
1200 | |
|
1201 | |
public Object createTemplateArgument() { |
1202 | |
|
1203 | 0 | throw new NotImplementedException(); |
1204 | |
} |
1205 | |
|
1206 | |
public TemplateParameter createTemplateParameter() { |
1207 | 0 | return UMLFactory.eINSTANCE.createTemplateParameter(); |
1208 | |
} |
1209 | |
|
1210 | |
public Usage createUsage() { |
1211 | 0 | return UMLFactory.eINSTANCE.createUsage(); |
1212 | |
} |
1213 | |
|
1214 | |
public Object buildTemplateArgument(Object binding, Object argument) { |
1215 | |
|
1216 | 0 | throw new NotYetImplementedException(); |
1217 | |
|
1218 | |
} |
1219 | |
|
1220 | |
public Object buildTemplateParameter(Object template, Object parameter, |
1221 | |
Object defaultElement) { |
1222 | |
|
1223 | 0 | throw new NotYetImplementedException(); |
1224 | |
|
1225 | |
} |
1226 | |
|
1227 | |
public Object createTemplateArgument(Object extent) { |
1228 | |
|
1229 | 0 | throw new NotYetImplementedException(); |
1230 | |
|
1231 | |
} |
1232 | |
|
1233 | |
public Object createTemplateParameter(Object extent) { |
1234 | |
|
1235 | 0 | throw new NotYetImplementedException(); |
1236 | |
|
1237 | |
} |
1238 | |
|
1239 | |
} |