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.LinkedList; |
7 | import java.util.List; |
8 | |
9 | import org.eclipse.emf.ecore.EObject; |
10 | import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy; |
11 | import org.eclipse.gmf.runtime.notation.View; |
12 | |
13 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.ResourceDemandingBehaviourEditPart; |
14 | import de.uka.ipd.sdq.pcm.gmf.seff.part.PalladioComponentModelVisualIDRegistry; |
15 | import de.uka.ipd.sdq.pcm.seff.AbstractLoopAction; |
16 | |
17 | /** |
18 | * @generated |
19 | */ |
20 | public class LoopActionBehaviourCompartmentCanonicalEditPolicy extends |
21 | CanonicalEditPolicy { |
22 | |
23 | /** |
24 | * @generated |
25 | */ |
26 | protected List getSemanticChildrenList() { |
27 | List result = new LinkedList(); |
28 | EObject modelObject = ((View) getHost().getModel()).getElement(); |
29 | View viewObject = (View) getHost().getModel(); |
30 | EObject nextValue; |
31 | int nodeVID; |
32 | nextValue = ((AbstractLoopAction) modelObject).getBodyBehaviour_Loop(); |
33 | nodeVID = PalladioComponentModelVisualIDRegistry.getNodeVisualID( |
34 | viewObject, nextValue); |
35 | if (ResourceDemandingBehaviourEditPart.VISUAL_ID == nodeVID) { |
36 | result.add(nextValue); |
37 | } |
38 | return result; |
39 | } |
40 | |
41 | /** |
42 | * @generated |
43 | */ |
44 | protected boolean shouldDeleteView(View view) { |
45 | if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$ |
46 | return view.isSetElement() |
47 | && (view.getElement() == null || view.getElement() |
48 | .eIsProxy()); |
49 | } |
50 | int nodeVID = PalladioComponentModelVisualIDRegistry.getVisualID(view); |
51 | switch (nodeVID) { |
52 | case ResourceDemandingBehaviourEditPart.VISUAL_ID: |
53 | return true; |
54 | } |
55 | return false; |
56 | } |
57 | |
58 | /** |
59 | * @generated |
60 | */ |
61 | protected String getDefaultFactoryHint() { |
62 | return null; |
63 | } |
64 | |
65 | } |