1 | /* |
2 | *Copyright 2007, SDQ, IPD, University of Karlsruhe |
3 | */ |
4 | package de.uka.ipd.sdq.pcm.gmf.usage.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.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy; |
14 | import org.eclipse.gmf.runtime.notation.View; |
15 | |
16 | import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.ScenarioBehaviour2EditPart; |
17 | import de.uka.ipd.sdq.pcm.gmf.usage.part.PalladioComponentModelDiagramUpdater; |
18 | import de.uka.ipd.sdq.pcm.gmf.usage.part.PalladioComponentModelNodeDescriptor; |
19 | import de.uka.ipd.sdq.pcm.gmf.usage.part.PalladioComponentModelVisualIDRegistry; |
20 | import de.uka.ipd.sdq.pcm.usagemodel.UsagemodelPackage; |
21 | |
22 | /** |
23 | * @generated |
24 | */ |
25 | public class LoopCanonicalEditPolicy extends CanonicalEditPolicy { |
26 | |
27 | /** |
28 | * @generated |
29 | */ |
30 | Set myFeaturesToSynchronize; |
31 | |
32 | /** |
33 | * @generated |
34 | */ |
35 | protected List getSemanticChildrenList() { |
36 | View viewObject = (View) getHost().getModel(); |
37 | List result = new LinkedList(); |
38 | for (Iterator it = PalladioComponentModelDiagramUpdater |
39 | .getLoop_3005SemanticChildren(viewObject).iterator(); it |
40 | .hasNext();) { |
41 | result.add(((PalladioComponentModelNodeDescriptor) it.next()) |
42 | .getModelElement()); |
43 | } |
44 | return result; |
45 | } |
46 | |
47 | /** |
48 | * @generated |
49 | */ |
50 | protected boolean isOrphaned(Collection semanticChildren, final View view) { |
51 | int visualID = PalladioComponentModelVisualIDRegistry.getVisualID(view); |
52 | switch (visualID) { |
53 | case ScenarioBehaviour2EditPart.VISUAL_ID: |
54 | if (!semanticChildren.contains(view.getElement())) { |
55 | return true; |
56 | } |
57 | } |
58 | return false; |
59 | } |
60 | |
61 | /** |
62 | * @generated |
63 | */ |
64 | protected String getDefaultFactoryHint() { |
65 | return null; |
66 | } |
67 | |
68 | /** |
69 | * @generated |
70 | */ |
71 | protected Set getFeaturesToSynchronize() { |
72 | if (myFeaturesToSynchronize == null) { |
73 | myFeaturesToSynchronize = new HashSet(); |
74 | myFeaturesToSynchronize.add(UsagemodelPackage.eINSTANCE |
75 | .getLoop_BodyBehaviour_Loop()); |
76 | } |
77 | return myFeaturesToSynchronize; |
78 | } |
79 | |
80 | } |