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