1 | /* |
2 | * Copyright 2009, SDQ, IPD, Uni Karlsruhe (TH) |
3 | */ |
4 | package de.uka.ipd.sdq.pcm.gmf.resource.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.resource.providers.PalladioComponentModelElementTypes; |
15 | |
16 | /** |
17 | * @generated |
18 | */ |
19 | public class CommunicationLinkResourceSpecificationItemSemanticEditPolicy |
20 | extends PalladioComponentModelBaseItemSemanticEditPolicy { |
21 | |
22 | /** |
23 | * @generated |
24 | */ |
25 | public CommunicationLinkResourceSpecificationItemSemanticEditPolicy() { |
26 | super( |
27 | PalladioComponentModelElementTypes.CommunicationLinkResourceSpecification_3002); |
28 | } |
29 | |
30 | /** |
31 | * @generated |
32 | */ |
33 | protected Command getDestroyElementCommand(DestroyElementRequest req) { |
34 | View view = (View) getHost().getModel(); |
35 | CompositeTransactionalCommand cmd = new CompositeTransactionalCommand( |
36 | getEditingDomain(), null); |
37 | cmd.setTransactionNestingEnabled(false); |
38 | EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$ |
39 | if (annotation == null) { |
40 | // there are indirectly referenced children, need extra commands: false |
41 | addDestroyShortcutsCommand(cmd, view); |
42 | // delete host element |
43 | cmd.add(new DestroyElementCommand(req)); |
44 | } else { |
45 | cmd.add(new DeleteCommand(getEditingDomain(), view)); |
46 | } |
47 | return getGEFWrapper(cmd.reduce()); |
48 | } |
49 | |
50 | } |