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.VariableCharacterisation4EditPart; |
17 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.VariableCharacterisation5EditPart; |
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.parameter.ParameterPackage; |
22 | |
23 | /** |
24 | * @generated |
25 | */ |
26 | public class VariableUsageVariableCharacterisation3CanonicalEditPolicy 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 | .getVariableUsageVariableCharacterisation_7032SemanticChildren( |
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 VariableCharacterisation5EditPart.VISUAL_ID: |
56 | if (!semanticChildren.contains(view.getElement())) { |
57 | return true; |
58 | } |
59 | } |
60 | return false; |
61 | } |
62 | |
63 | /** |
64 | * @generated |
65 | */ |
66 | protected String getDefaultFactoryHint() { |
67 | return null; |
68 | } |
69 | |
70 | /** |
71 | * @generated |
72 | */ |
73 | protected Set getFeaturesToSynchronize() { |
74 | if (myFeaturesToSynchronize == null) { |
75 | myFeaturesToSynchronize = new HashSet(); |
76 | myFeaturesToSynchronize.add(ParameterPackage.eINSTANCE |
77 | .getVariableUsage_VariableCharacterisation_VariableUsage()); |
78 | } |
79 | return myFeaturesToSynchronize; |
80 | } |
81 | |
82 | } |