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