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.BranchEditPart; |
17 | import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.DelayEditPart; |
18 | import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.EntryLevelSystemCallEditPart; |
19 | import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.LoopEditPart; |
20 | import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.StartEditPart; |
21 | import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.StopEditPart; |
22 | import de.uka.ipd.sdq.pcm.gmf.usage.part.PalladioComponentModelDiagramUpdater; |
23 | import de.uka.ipd.sdq.pcm.gmf.usage.part.PalladioComponentModelNodeDescriptor; |
24 | import de.uka.ipd.sdq.pcm.gmf.usage.part.PalladioComponentModelVisualIDRegistry; |
25 | import de.uka.ipd.sdq.pcm.usagemodel.UsagemodelPackage; |
26 | |
27 | /** |
28 | * @generated |
29 | */ |
30 | public class ScenarioBehaviourScenarioBehaviourStepsCompartment2CanonicalEditPolicy |
31 | extends CanonicalEditPolicy { |
32 | |
33 | /** |
34 | * @generated |
35 | */ |
36 | Set myFeaturesToSynchronize; |
37 | |
38 | /** |
39 | * @generated |
40 | */ |
41 | protected List getSemanticChildrenList() { |
42 | View viewObject = (View) getHost().getModel(); |
43 | List result = new LinkedList(); |
44 | for (Iterator it = PalladioComponentModelDiagramUpdater |
45 | .getScenarioBehaviourScenarioBehaviourStepsCompartment_7005SemanticChildren( |
46 | viewObject).iterator(); it.hasNext();) { |
47 | result.add(((PalladioComponentModelNodeDescriptor) it.next()) |
48 | .getModelElement()); |
49 | } |
50 | return result; |
51 | } |
52 | |
53 | /** |
54 | * @generated |
55 | */ |
56 | protected boolean isOrphaned(Collection semanticChildren, final View view) { |
57 | int visualID = PalladioComponentModelVisualIDRegistry.getVisualID(view); |
58 | switch (visualID) { |
59 | case StartEditPart.VISUAL_ID: |
60 | case StopEditPart.VISUAL_ID: |
61 | case EntryLevelSystemCallEditPart.VISUAL_ID: |
62 | case LoopEditPart.VISUAL_ID: |
63 | case BranchEditPart.VISUAL_ID: |
64 | case DelayEditPart.VISUAL_ID: |
65 | if (!semanticChildren.contains(view.getElement())) { |
66 | return true; |
67 | } |
68 | } |
69 | return false; |
70 | } |
71 | |
72 | /** |
73 | * @generated |
74 | */ |
75 | protected String getDefaultFactoryHint() { |
76 | return null; |
77 | } |
78 | |
79 | /** |
80 | * @generated |
81 | */ |
82 | protected Set getFeaturesToSynchronize() { |
83 | if (myFeaturesToSynchronize == null) { |
84 | myFeaturesToSynchronize = new HashSet(); |
85 | myFeaturesToSynchronize.add(UsagemodelPackage.eINSTANCE |
86 | .getScenarioBehaviour_Actions_ScenarioBehaviour()); |
87 | } |
88 | return myFeaturesToSynchronize; |
89 | } |
90 | |
91 | } |