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