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.SetVariableActionEditPart; |
25 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.StartAction2EditPart; |
26 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.StopAction2EditPart; |
27 | import de.uka.ipd.sdq.pcm.gmf.seff.part.PalladioComponentModelDiagramUpdater; |
28 | import de.uka.ipd.sdq.pcm.gmf.seff.part.PalladioComponentModelNodeDescriptor; |
29 | import de.uka.ipd.sdq.pcm.gmf.seff.part.PalladioComponentModelVisualIDRegistry; |
30 | import de.uka.ipd.sdq.pcm.seff.SeffPackage; |
31 | |
32 | /** |
33 | * @generated |
34 | */ |
35 | public class ResourceDemandingBehaviourLoopCompartmentCanonicalEditPolicy |
36 | extends CanonicalEditPolicy { |
37 | |
38 | /** |
39 | * @generated |
40 | */ |
41 | Set myFeaturesToSynchronize; |
42 | |
43 | /** |
44 | * @generated |
45 | */ |
46 | protected List getSemanticChildrenList() { |
47 | View viewObject = (View) getHost().getModel(); |
48 | List result = new LinkedList(); |
49 | for (Iterator it = PalladioComponentModelDiagramUpdater |
50 | .getResourceDemandingBehaviourBehaviourCompartment_7004SemanticChildren( |
51 | viewObject).iterator(); it.hasNext();) { |
52 | result.add(((PalladioComponentModelNodeDescriptor) it.next()) |
53 | .getModelElement()); |
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 StartAction2EditPart.VISUAL_ID: |
65 | case StopAction2EditPart.VISUAL_ID: |
66 | case LoopAction2EditPart.VISUAL_ID: |
67 | case InternalActionEditPart.VISUAL_ID: |
68 | case BranchActionEditPart.VISUAL_ID: |
69 | case ExternalCallAction2EditPart.VISUAL_ID: |
70 | case CollectionIteratorActionEditPart.VISUAL_ID: |
71 | case AcquireAction2EditPart.VISUAL_ID: |
72 | case ReleaseActionEditPart.VISUAL_ID: |
73 | case ForkActionEditPart.VISUAL_ID: |
74 | case SetVariableActionEditPart.VISUAL_ID: |
75 | if (!semanticChildren.contains(view.getElement())) { |
76 | return true; |
77 | } |
78 | } |
79 | return false; |
80 | } |
81 | |
82 | /** |
83 | * @generated |
84 | */ |
85 | protected String getDefaultFactoryHint() { |
86 | return null; |
87 | } |
88 | |
89 | /** |
90 | * @generated |
91 | */ |
92 | protected Set getFeaturesToSynchronize() { |
93 | if (myFeaturesToSynchronize == null) { |
94 | myFeaturesToSynchronize = new HashSet(); |
95 | myFeaturesToSynchronize.add(SeffPackage.eINSTANCE |
96 | .getResourceDemandingBehaviour_Steps_Behaviour()); |
97 | } |
98 | return myFeaturesToSynchronize; |
99 | } |
100 | |
101 | } |