1 | /* |
2 | *Copyright 2006 SDQ Research Group, University of Karlsruhe (TH) |
3 | */ |
4 | package de.uka.ipd.sdq.pcm.gmf.seff.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.seff.edit.parts.AcquireAction2EditPart; |
17 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.BranchActionEditPart; |
18 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.CollectionIteratorActionEditPart; |
19 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.ExternalCallAction2EditPart; |
20 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.ForkActionEditPart; |
21 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.InternalActionEditPart; |
22 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.LoopAction2EditPart; |
23 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.ReleaseActionEditPart; |
24 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.StartAction2EditPart; |
25 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.StopAction2EditPart; |
26 | import de.uka.ipd.sdq.pcm.gmf.seff.part.PalladioComponentModelDiagramUpdater; |
27 | import de.uka.ipd.sdq.pcm.gmf.seff.part.PalladioComponentModelNodeDescriptor; |
28 | import de.uka.ipd.sdq.pcm.gmf.seff.part.PalladioComponentModelVisualIDRegistry; |
29 | import de.uka.ipd.sdq.pcm.seff.SeffPackage; |
30 | |
31 | /** |
32 | * @generated |
33 | */ |
34 | public class ResourceDemandingBehaviourLoopCompartment2CanonicalEditPolicy |
35 | extends CanonicalEditPolicy { |
36 | |
37 | /** |
38 | * @generated |
39 | */ |
40 | Set myFeaturesToSynchronize; |
41 | |
42 | /** |
43 | * @generated |
44 | */ |
45 | protected List getSemanticChildrenList() { |
46 | View viewObject = (View) getHost().getModel(); |
47 | List result = new LinkedList(); |
48 | for (Iterator it = PalladioComponentModelDiagramUpdater |
49 | .getResourceDemandingBehaviourBehaviourCompartment_7014SemanticChildren( |
50 | viewObject).iterator(); it.hasNext();) { |
51 | result.add(((PalladioComponentModelNodeDescriptor) it.next()) |
52 | .getModelElement()); |
53 | } |
54 | return result; |
55 | } |
56 | |
57 | /** |
58 | * @generated |
59 | */ |
60 | protected boolean isOrphaned(Collection semanticChildren, final View view) { |
61 | int visualID = PalladioComponentModelVisualIDRegistry.getVisualID(view); |
62 | switch (visualID) { |
63 | case StartAction2EditPart.VISUAL_ID: |
64 | case StopAction2EditPart.VISUAL_ID: |
65 | case LoopAction2EditPart.VISUAL_ID: |
66 | case InternalActionEditPart.VISUAL_ID: |
67 | case BranchActionEditPart.VISUAL_ID: |
68 | case ExternalCallAction2EditPart.VISUAL_ID: |
69 | case CollectionIteratorActionEditPart.VISUAL_ID: |
70 | case AcquireAction2EditPart.VISUAL_ID: |
71 | case ReleaseActionEditPart.VISUAL_ID: |
72 | case ForkActionEditPart.VISUAL_ID: |
73 | if (!semanticChildren.contains(view.getElement())) { |
74 | return true; |
75 | } |
76 | } |
77 | return false; |
78 | } |
79 | |
80 | /** |
81 | * @generated |
82 | */ |
83 | protected String getDefaultFactoryHint() { |
84 | return null; |
85 | } |
86 | |
87 | /** |
88 | * @generated |
89 | */ |
90 | protected Set getFeaturesToSynchronize() { |
91 | if (myFeaturesToSynchronize == null) { |
92 | myFeaturesToSynchronize = new HashSet(); |
93 | myFeaturesToSynchronize.add(SeffPackage.eINSTANCE |
94 | .getResourceDemandingBehaviour_Steps_Behaviour()); |
95 | } |
96 | return myFeaturesToSynchronize; |
97 | } |
98 | |
99 | } |