1 | /* |
2 | *Copyright 2007, SDQ, IPD, Uni Karlsruhe (TH) |
3 | */ |
4 | package de.uka.ipd.sdq.pcm.gmf.composite.edit.policies; |
5 | |
6 | import java.util.Collection; |
7 | import java.util.HashSet; |
8 | import java.util.Iterator; |
9 | import java.util.LinkedList; |
10 | import java.util.List; |
11 | import java.util.Set; |
12 | |
13 | import org.eclipse.emf.ecore.EObject; |
14 | import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy; |
15 | import org.eclipse.gmf.runtime.notation.View; |
16 | |
17 | import de.uka.ipd.sdq.pcm.core.composition.AssemblyContext; |
18 | import de.uka.ipd.sdq.pcm.core.composition.ComposedStructure; |
19 | import de.uka.ipd.sdq.pcm.core.entity.EntityPackage; |
20 | import de.uka.ipd.sdq.pcm.gmf.composite.edit.parts.AssemblyContextEditPart; |
21 | import de.uka.ipd.sdq.pcm.gmf.composite.part.PalladioComponentModelDiagramUpdater; |
22 | import de.uka.ipd.sdq.pcm.gmf.composite.part.PalladioComponentModelNodeDescriptor; |
23 | import de.uka.ipd.sdq.pcm.gmf.composite.part.PalladioComponentModelVisualIDRegistry; |
24 | |
25 | /** |
26 | * @generated |
27 | */ |
28 | public class ComposedProvidingRequiringEntityCompositeStructureInnerCompartmentCanonicalEditPolicy |
29 | extends CanonicalEditPolicy { |
30 | |
31 | /** |
32 | * @generated |
33 | */ |
34 | Set myFeaturesToSynchronize; |
35 | |
36 | /** |
37 | * @generated not |
38 | */ |
39 | protected List getSemanticChildrenList() { |
40 | View viewObject = (View) getHost().getModel(); |
41 | EObject modelObject = viewObject.getElement(); |
42 | List result = new LinkedList(); |
43 | |
44 | if (modelObject != null && modelObject instanceof ComposedStructure) { |
45 | for (AssemblyContext assemblyContext : ((ComposedStructure) modelObject) |
46 | .getAssemblyContexts__ComposedStructure()) { |
47 | |
48 | int assemblyNodeVID = PalladioComponentModelVisualIDRegistry |
49 | .getNodeVisualID(viewObject, assemblyContext); |
50 | if (AssemblyContextEditPart.VISUAL_ID == assemblyNodeVID) { |
51 | result.add(assemblyContext); |
52 | } |
53 | } |
54 | } |
55 | return result; |
56 | } |
57 | |
58 | /** |
59 | * @generated |
60 | */ |
61 | protected boolean isOrphaned(Collection semanticChildren, final View view) { |
62 | int visualID = PalladioComponentModelVisualIDRegistry.getVisualID(view); |
63 | switch (visualID) { |
64 | case AssemblyContextEditPart.VISUAL_ID: |
65 | if (!semanticChildren.contains(view.getElement())) { |
66 | return true; |
67 | } |
68 | } |
69 | return false; |
70 | } |
71 | |
72 | /** |
73 | * @generated |
74 | */ |
75 | protected String getDefaultFactoryHint() { |
76 | return null; |
77 | } |
78 | |
79 | /** |
80 | * @generated |
81 | */ |
82 | protected Set getFeaturesToSynchronize() { |
83 | if (myFeaturesToSynchronize == null) { |
84 | myFeaturesToSynchronize = new HashSet(); |
85 | myFeaturesToSynchronize |
86 | .add(EntityPackage.eINSTANCE |
87 | .getInterfaceProvidingEntity_ProvidedRoles_InterfaceProvidingEntity()); |
88 | } |
89 | return myFeaturesToSynchronize; |
90 | } |
91 | |
92 | } |