| 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.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.usage.edit.parts.ScenarioBehaviour3EditPart; |
| 14 | import de.uka.ipd.sdq.pcm.gmf.usage.part.PalladioComponentModelVisualIDRegistry; |
| 15 | import de.uka.ipd.sdq.pcm.usagemodel.BranchTransition; |
| 16 | |
| 17 | /** |
| 18 | * @generated |
| 19 | */ |
| 20 | public class BranchTransitionBranchTransitionCompartmentCanonicalEditPolicy |
| 21 | extends 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 = ((BranchTransition) modelObject) |
| 33 | .getBranchedBehaviour_BranchTransition(); |
| 34 | nodeVID = PalladioComponentModelVisualIDRegistry.getNodeVisualID( |
| 35 | viewObject, nextValue); |
| 36 | if (ScenarioBehaviour3EditPart.VISUAL_ID == nodeVID) { |
| 37 | result.add(nextValue); |
| 38 | } |
| 39 | return result; |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * @generated |
| 44 | */ |
| 45 | protected boolean shouldDeleteView(View view) { |
| 46 | if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$ |
| 47 | return view.isSetElement() |
| 48 | && (view.getElement() == null || view.getElement() |
| 49 | .eIsProxy()); |
| 50 | } |
| 51 | int nodeVID = PalladioComponentModelVisualIDRegistry.getVisualID(view); |
| 52 | switch (nodeVID) { |
| 53 | case ScenarioBehaviour3EditPart.VISUAL_ID: |
| 54 | return true; |
| 55 | } |
| 56 | return false; |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * @generated |
| 61 | */ |
| 62 | protected String getDefaultFactoryHint() { |
| 63 | return null; |
| 64 | } |
| 65 | |
| 66 | } |