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