EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012)
[all classes][de.uka.ipd.sdq.pcm.gmf.composite.edit.policies]

COVERAGE SUMMARY FOR SOURCE FILE [ComposedProvidingRequiringEntity2ItemSemanticEditPolicy.java]

nameclass, %method, %block, %line, %
ComposedProvidingRequiringEntity2ItemSemanticEditPolicy.java0%   (0/1)0%   (0/4)0%   (0/355)0%   (0/95)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ComposedProvidingRequiringEntity2ItemSemanticEditPolicy0%   (0/1)0%   (0/4)0%   (0/355)0%   (0/95)
ComposedProvidingRequiringEntity2ItemSemanticEditPolicy (): void 0%   (0/1)0%   (0/4)0%   (0/3)
addDestroyChildNodesCommand (ICompositeCommand): void 0%   (0/1)0%   (0/277)0%   (0/74)
getCreateCommand (CreateElementRequest): Command 0%   (0/1)0%   (0/26)0%   (0/7)
getDestroyElementCommand (DestroyElementRequest): Command 0%   (0/1)0%   (0/48)0%   (0/11)

1/*
2 * Copyright 2007, SDQ, IPD, Uni Karlsruhe (TH)
3 */
4package de.uka.ipd.sdq.pcm.gmf.composite.edit.policies;
5 
6import java.util.Iterator;
7 
8import org.eclipse.emf.ecore.EAnnotation;
9import org.eclipse.gef.commands.Command;
10import org.eclipse.gmf.runtime.common.core.command.ICompositeCommand;
11import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
12import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
13import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
14import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
15import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
16import org.eclipse.gmf.runtime.notation.Edge;
17import org.eclipse.gmf.runtime.notation.Node;
18import org.eclipse.gmf.runtime.notation.View;
19 
20import de.uka.ipd.sdq.pcm.gmf.composite.edit.commands.OperationProvidedRole2CreateCommand;
21import de.uka.ipd.sdq.pcm.gmf.composite.edit.commands.OperationRequiredRole2CreateCommand;
22import de.uka.ipd.sdq.pcm.gmf.composite.edit.parts.AssemblyConnectorEditPart;
23import de.uka.ipd.sdq.pcm.gmf.composite.edit.parts.AssemblyContextEditPart;
24import de.uka.ipd.sdq.pcm.gmf.composite.edit.parts.ComposedProvidingRequiringEntityCompositeStructureInnerCompartmentEditPart;
25import de.uka.ipd.sdq.pcm.gmf.composite.edit.parts.OperationProvidedRole2EditPart;
26import de.uka.ipd.sdq.pcm.gmf.composite.edit.parts.OperationRequiredRole2EditPart;
27import de.uka.ipd.sdq.pcm.gmf.composite.edit.parts.ProvidedDelegationConnectorEditPart;
28import de.uka.ipd.sdq.pcm.gmf.composite.edit.parts.RequiredDelegationConnectorEditPart;
29import de.uka.ipd.sdq.pcm.gmf.composite.part.PalladioComponentModelVisualIDRegistry;
30import de.uka.ipd.sdq.pcm.gmf.composite.providers.PalladioComponentModelElementTypes;
31 
32/**
33 * @generated
34 */
35public class ComposedProvidingRequiringEntity2ItemSemanticEditPolicy extends
36                PalladioComponentModelBaseItemSemanticEditPolicy {
37 
38        /**
39         * @generated
40         */
41        public ComposedProvidingRequiringEntity2ItemSemanticEditPolicy() {
42                super(
43                                PalladioComponentModelElementTypes.ComposedProvidingRequiringEntity_2002);
44        }
45 
46        /**
47         * @generated
48         */
49        protected Command getCreateCommand(CreateElementRequest req) {
50                if (PalladioComponentModelElementTypes.OperationProvidedRole_3011 == req
51                                .getElementType()) {
52                        return getGEFWrapper(new OperationProvidedRole2CreateCommand(req));
53                }
54                if (PalladioComponentModelElementTypes.OperationRequiredRole_3012 == req
55                                .getElementType()) {
56                        return getGEFWrapper(new OperationRequiredRole2CreateCommand(req));
57                }
58                return super.getCreateCommand(req);
59        }
60 
61        /**
62         * @generated
63         */
64        protected Command getDestroyElementCommand(DestroyElementRequest req) {
65                View view = (View) getHost().getModel();
66                CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(
67                                getEditingDomain(), null);
68                cmd.setTransactionNestingEnabled(false);
69                EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
70                if (annotation == null) {
71                        // there are indirectly referenced children, need extra commands: false
72                        addDestroyChildNodesCommand(cmd);
73                        addDestroyShortcutsCommand(cmd, view);
74                        // delete host element
75                        cmd.add(new DestroyElementCommand(req));
76                } else {
77                        cmd.add(new DeleteCommand(getEditingDomain(), view));
78                }
79                return getGEFWrapper(cmd.reduce());
80        }
81 
82        /**
83         * @generated
84         */
85        private void addDestroyChildNodesCommand(ICompositeCommand cmd) {
86                View view = (View) getHost().getModel();
87                for (Iterator nit = view.getChildren().iterator(); nit.hasNext();) {
88                        Node node = (Node) nit.next();
89                        switch (PalladioComponentModelVisualIDRegistry.getVisualID(node)) {
90                        case OperationProvidedRole2EditPart.VISUAL_ID:
91                                for (Iterator it = node.getTargetEdges().iterator(); it
92                                                .hasNext();) {
93                                        Edge incomingLink = (Edge) it.next();
94                                        if (PalladioComponentModelVisualIDRegistry
95                                                        .getVisualID(incomingLink) == AssemblyConnectorEditPart.VISUAL_ID) {
96                                                DestroyElementRequest r = new DestroyElementRequest(
97                                                                incomingLink.getElement(), false);
98                                                cmd.add(new DestroyElementCommand(r));
99                                                cmd.add(new DeleteCommand(getEditingDomain(),
100                                                                incomingLink));
101                                                continue;
102                                        }
103                                        if (PalladioComponentModelVisualIDRegistry
104                                                        .getVisualID(incomingLink) == ProvidedDelegationConnectorEditPart.VISUAL_ID) {
105                                                DestroyElementRequest r = new DestroyElementRequest(
106                                                                incomingLink.getElement(), false);
107                                                cmd.add(new DestroyElementCommand(r));
108                                                cmd.add(new DeleteCommand(getEditingDomain(),
109                                                                incomingLink));
110                                                continue;
111                                        }
112                                }
113                                for (Iterator it = node.getSourceEdges().iterator(); it
114                                                .hasNext();) {
115                                        Edge outgoingLink = (Edge) it.next();
116                                        if (PalladioComponentModelVisualIDRegistry
117                                                        .getVisualID(outgoingLink) == ProvidedDelegationConnectorEditPart.VISUAL_ID) {
118                                                DestroyElementRequest r = new DestroyElementRequest(
119                                                                outgoingLink.getElement(), false);
120                                                cmd.add(new DestroyElementCommand(r));
121                                                cmd.add(new DeleteCommand(getEditingDomain(),
122                                                                outgoingLink));
123                                                continue;
124                                        }
125                                }
126                                cmd.add(new DestroyElementCommand(new DestroyElementRequest(
127                                                getEditingDomain(), node.getElement(), false))); // directlyOwned: true
128                                // don't need explicit deletion of node as parent's view deletion would clean child views as well 
129                                // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), node));
130                                break;
131                        case OperationRequiredRole2EditPart.VISUAL_ID:
132                                for (Iterator it = node.getTargetEdges().iterator(); it
133                                                .hasNext();) {
134                                        Edge incomingLink = (Edge) it.next();
135                                        if (PalladioComponentModelVisualIDRegistry
136                                                        .getVisualID(incomingLink) == RequiredDelegationConnectorEditPart.VISUAL_ID) {
137                                                DestroyElementRequest r = new DestroyElementRequest(
138                                                                incomingLink.getElement(), false);
139                                                cmd.add(new DestroyElementCommand(r));
140                                                cmd.add(new DeleteCommand(getEditingDomain(),
141                                                                incomingLink));
142                                                continue;
143                                        }
144                                }
145                                for (Iterator it = node.getSourceEdges().iterator(); it
146                                                .hasNext();) {
147                                        Edge outgoingLink = (Edge) it.next();
148                                        if (PalladioComponentModelVisualIDRegistry
149                                                        .getVisualID(outgoingLink) == AssemblyConnectorEditPart.VISUAL_ID) {
150                                                DestroyElementRequest r = new DestroyElementRequest(
151                                                                outgoingLink.getElement(), false);
152                                                cmd.add(new DestroyElementCommand(r));
153                                                cmd.add(new DeleteCommand(getEditingDomain(),
154                                                                outgoingLink));
155                                                continue;
156                                        }
157                                        if (PalladioComponentModelVisualIDRegistry
158                                                        .getVisualID(outgoingLink) == RequiredDelegationConnectorEditPart.VISUAL_ID) {
159                                                DestroyElementRequest r = new DestroyElementRequest(
160                                                                outgoingLink.getElement(), false);
161                                                cmd.add(new DestroyElementCommand(r));
162                                                cmd.add(new DeleteCommand(getEditingDomain(),
163                                                                outgoingLink));
164                                                continue;
165                                        }
166                                }
167                                cmd.add(new DestroyElementCommand(new DestroyElementRequest(
168                                                getEditingDomain(), node.getElement(), false))); // directlyOwned: true
169                                // don't need explicit deletion of node as parent's view deletion would clean child views as well 
170                                // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), node));
171                                break;
172                        case ComposedProvidingRequiringEntityCompositeStructureInnerCompartmentEditPart.VISUAL_ID:
173                                for (Iterator cit = node.getChildren().iterator(); cit
174                                                .hasNext();) {
175                                        Node cnode = (Node) cit.next();
176                                        switch (PalladioComponentModelVisualIDRegistry
177                                                        .getVisualID(cnode)) {
178                                        case AssemblyContextEditPart.VISUAL_ID:
179                                                cmd.add(new DestroyElementCommand(
180                                                                new DestroyElementRequest(getEditingDomain(),
181                                                                                cnode.getElement(), false))); // directlyOwned: true
182                                                // don't need explicit deletion of cnode as parent's view deletion would clean child views as well 
183                                                // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
184                                                break;
185                                        }
186                                }
187                                break;
188                        }
189                }
190        }
191 
192}

[all classes][de.uka.ipd.sdq.pcm.gmf.composite.edit.policies]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov