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 org.eclipse.emf.ecore.EAnnotation; |
7 | import org.eclipse.gef.commands.Command; |
8 | import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand; |
9 | import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand; |
10 | import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand; |
11 | import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; |
12 | import org.eclipse.gmf.runtime.notation.View; |
13 | |
14 | import de.uka.ipd.sdq.pcm.gmf.seff.providers.PalladioComponentModelElementTypes; |
15 | |
16 | /** |
17 | * @generated |
18 | */ |
19 | public class VariableCharacterisation2ItemSemanticEditPolicy extends |
20 | PalladioComponentModelBaseItemSemanticEditPolicy { |
21 | |
22 | /** |
23 | * @generated |
24 | */ |
25 | public VariableCharacterisation2ItemSemanticEditPolicy() { |
26 | super(PalladioComponentModelElementTypes.VariableCharacterisation_3035); |
27 | } |
28 | |
29 | /** |
30 | * @generated |
31 | */ |
32 | protected Command getDestroyElementCommand(DestroyElementRequest req) { |
33 | View view = (View) getHost().getModel(); |
34 | CompositeTransactionalCommand cmd = new CompositeTransactionalCommand( |
35 | getEditingDomain(), null); |
36 | cmd.setTransactionNestingEnabled(false); |
37 | EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$ |
38 | if (annotation == null) { |
39 | // there are indirectly referenced children, need extra commands: false |
40 | addDestroyShortcutsCommand(cmd, view); |
41 | // delete host element |
42 | cmd.add(new DestroyElementCommand(req)); |
43 | } else { |
44 | cmd.add(new DeleteCommand(getEditingDomain(), view)); |
45 | } |
46 | return getGEFWrapper(cmd.reduce()); |
47 | } |
48 | } |