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

COVERAGE SUMMARY FOR SOURCE FILE [ScenarioBehaviour2ItemSemanticEditPolicy.java]

nameclass, %method, %block, %line, %
ScenarioBehaviour2ItemSemanticEditPolicy.java0%   (0/1)0%   (0/3)0%   (0/675)0%   (0/189)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ScenarioBehaviour2ItemSemanticEditPolicy0%   (0/1)0%   (0/3)0%   (0/675)0%   (0/189)
ScenarioBehaviour2ItemSemanticEditPolicy (): void 0%   (0/1)0%   (0/4)0%   (0/2)
addDestroyChildNodesCommand (ICompositeCommand): void 0%   (0/1)0%   (0/623)0%   (0/176)
getDestroyElementCommand (DestroyElementRequest): Command 0%   (0/1)0%   (0/48)0%   (0/11)

1/*
2 * Copyright 2007, SDQ, IPD, University of Karlsruhe
3 */
4package de.uka.ipd.sdq.pcm.gmf.usage.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.commands.DestroyReferenceCommand;
15import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
16import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;
17import org.eclipse.gmf.runtime.notation.Edge;
18import org.eclipse.gmf.runtime.notation.Node;
19import org.eclipse.gmf.runtime.notation.View;
20 
21import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.AbstractUserActionSuccessorEditPart;
22import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.BranchEditPart;
23import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.DelayEditPart;
24import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.EntryLevelSystemCallEditPart;
25import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.LoopEditPart;
26import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.ScenarioBehaviourScenarioBehaviourStepsCompartment2EditPart;
27import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.StartEditPart;
28import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.StopEditPart;
29import de.uka.ipd.sdq.pcm.gmf.usage.part.PalladioComponentModelVisualIDRegistry;
30import de.uka.ipd.sdq.pcm.gmf.usage.providers.PalladioComponentModelElementTypes;
31 
32/**
33 * @generated
34 */
35public class ScenarioBehaviour2ItemSemanticEditPolicy extends
36                PalladioComponentModelBaseItemSemanticEditPolicy {
37 
38        /**
39         * @generated
40         */
41        public ScenarioBehaviour2ItemSemanticEditPolicy() {
42                super(PalladioComponentModelElementTypes.ScenarioBehaviour_3007);
43        }
44 
45        /**
46         * @generated
47         */
48        protected Command getDestroyElementCommand(DestroyElementRequest req) {
49                View view = (View) getHost().getModel();
50                CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(
51                                getEditingDomain(), null);
52                cmd.setTransactionNestingEnabled(false);
53                EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
54                if (annotation == null) {
55                        // there are indirectly referenced children, need extra commands: false
56                        addDestroyChildNodesCommand(cmd);
57                        addDestroyShortcutsCommand(cmd, view);
58                        // delete host element
59                        cmd.add(new DestroyElementCommand(req));
60                } else {
61                        cmd.add(new DeleteCommand(getEditingDomain(), view));
62                }
63                return getGEFWrapper(cmd.reduce());
64        }
65 
66        /**
67         * @generated
68         */
69        private void addDestroyChildNodesCommand(ICompositeCommand cmd) {
70                View view = (View) getHost().getModel();
71                for (Iterator nit = view.getChildren().iterator(); nit.hasNext();) {
72                        Node node = (Node) nit.next();
73                        switch (PalladioComponentModelVisualIDRegistry.getVisualID(node)) {
74                        case ScenarioBehaviourScenarioBehaviourStepsCompartment2EditPart.VISUAL_ID:
75                                for (Iterator cit = node.getChildren().iterator(); cit
76                                                .hasNext();) {
77                                        Node cnode = (Node) cit.next();
78                                        switch (PalladioComponentModelVisualIDRegistry
79                                                        .getVisualID(cnode)) {
80                                        case StartEditPart.VISUAL_ID:
81                                                for (Iterator it = cnode.getTargetEdges().iterator(); it
82                                                                .hasNext();) {
83                                                        Edge incomingLink = (Edge) it.next();
84                                                        if (PalladioComponentModelVisualIDRegistry
85                                                                        .getVisualID(incomingLink) == AbstractUserActionSuccessorEditPart.VISUAL_ID) {
86                                                                DestroyReferenceRequest r = new DestroyReferenceRequest(
87                                                                                incomingLink.getSource().getElement(),
88                                                                                null, incomingLink.getTarget()
89                                                                                                .getElement(), false);
90                                                                cmd.add(new DestroyReferenceCommand(r));
91                                                                cmd.add(new DeleteCommand(getEditingDomain(),
92                                                                                incomingLink));
93                                                                continue;
94                                                        }
95                                                }
96                                                for (Iterator it = cnode.getSourceEdges().iterator(); it
97                                                                .hasNext();) {
98                                                        Edge outgoingLink = (Edge) it.next();
99                                                        if (PalladioComponentModelVisualIDRegistry
100                                                                        .getVisualID(outgoingLink) == AbstractUserActionSuccessorEditPart.VISUAL_ID) {
101                                                                DestroyReferenceRequest r = new DestroyReferenceRequest(
102                                                                                outgoingLink.getSource().getElement(),
103                                                                                null, outgoingLink.getTarget()
104                                                                                                .getElement(), false);
105                                                                cmd.add(new DestroyReferenceCommand(r));
106                                                                cmd.add(new DeleteCommand(getEditingDomain(),
107                                                                                outgoingLink));
108                                                                continue;
109                                                        }
110                                                }
111                                                cmd.add(new DestroyElementCommand(
112                                                                new DestroyElementRequest(getEditingDomain(),
113                                                                                cnode.getElement(), false))); // directlyOwned: true
114                                                // don't need explicit deletion of cnode as parent's view deletion would clean child views as well 
115                                                // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
116                                                break;
117                                        case StopEditPart.VISUAL_ID:
118                                                for (Iterator it = cnode.getTargetEdges().iterator(); it
119                                                                .hasNext();) {
120                                                        Edge incomingLink = (Edge) it.next();
121                                                        if (PalladioComponentModelVisualIDRegistry
122                                                                        .getVisualID(incomingLink) == AbstractUserActionSuccessorEditPart.VISUAL_ID) {
123                                                                DestroyReferenceRequest r = new DestroyReferenceRequest(
124                                                                                incomingLink.getSource().getElement(),
125                                                                                null, incomingLink.getTarget()
126                                                                                                .getElement(), false);
127                                                                cmd.add(new DestroyReferenceCommand(r));
128                                                                cmd.add(new DeleteCommand(getEditingDomain(),
129                                                                                incomingLink));
130                                                                continue;
131                                                        }
132                                                }
133                                                for (Iterator it = cnode.getSourceEdges().iterator(); it
134                                                                .hasNext();) {
135                                                        Edge outgoingLink = (Edge) it.next();
136                                                        if (PalladioComponentModelVisualIDRegistry
137                                                                        .getVisualID(outgoingLink) == AbstractUserActionSuccessorEditPart.VISUAL_ID) {
138                                                                DestroyReferenceRequest r = new DestroyReferenceRequest(
139                                                                                outgoingLink.getSource().getElement(),
140                                                                                null, outgoingLink.getTarget()
141                                                                                                .getElement(), false);
142                                                                cmd.add(new DestroyReferenceCommand(r));
143                                                                cmd.add(new DeleteCommand(getEditingDomain(),
144                                                                                outgoingLink));
145                                                                continue;
146                                                        }
147                                                }
148                                                cmd.add(new DestroyElementCommand(
149                                                                new DestroyElementRequest(getEditingDomain(),
150                                                                                cnode.getElement(), false))); // directlyOwned: true
151                                                // don't need explicit deletion of cnode as parent's view deletion would clean child views as well 
152                                                // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
153                                                break;
154                                        case EntryLevelSystemCallEditPart.VISUAL_ID:
155                                                for (Iterator it = cnode.getTargetEdges().iterator(); it
156                                                                .hasNext();) {
157                                                        Edge incomingLink = (Edge) it.next();
158                                                        if (PalladioComponentModelVisualIDRegistry
159                                                                        .getVisualID(incomingLink) == AbstractUserActionSuccessorEditPart.VISUAL_ID) {
160                                                                DestroyReferenceRequest r = new DestroyReferenceRequest(
161                                                                                incomingLink.getSource().getElement(),
162                                                                                null, incomingLink.getTarget()
163                                                                                                .getElement(), false);
164                                                                cmd.add(new DestroyReferenceCommand(r));
165                                                                cmd.add(new DeleteCommand(getEditingDomain(),
166                                                                                incomingLink));
167                                                                continue;
168                                                        }
169                                                }
170                                                for (Iterator it = cnode.getSourceEdges().iterator(); it
171                                                                .hasNext();) {
172                                                        Edge outgoingLink = (Edge) it.next();
173                                                        if (PalladioComponentModelVisualIDRegistry
174                                                                        .getVisualID(outgoingLink) == AbstractUserActionSuccessorEditPart.VISUAL_ID) {
175                                                                DestroyReferenceRequest r = new DestroyReferenceRequest(
176                                                                                outgoingLink.getSource().getElement(),
177                                                                                null, outgoingLink.getTarget()
178                                                                                                .getElement(), false);
179                                                                cmd.add(new DestroyReferenceCommand(r));
180                                                                cmd.add(new DeleteCommand(getEditingDomain(),
181                                                                                outgoingLink));
182                                                                continue;
183                                                        }
184                                                }
185                                                cmd.add(new DestroyElementCommand(
186                                                                new DestroyElementRequest(getEditingDomain(),
187                                                                                cnode.getElement(), false))); // directlyOwned: true
188                                                // don't need explicit deletion of cnode as parent's view deletion would clean child views as well 
189                                                // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
190                                                break;
191                                        case LoopEditPart.VISUAL_ID:
192                                                for (Iterator it = cnode.getTargetEdges().iterator(); it
193                                                                .hasNext();) {
194                                                        Edge incomingLink = (Edge) it.next();
195                                                        if (PalladioComponentModelVisualIDRegistry
196                                                                        .getVisualID(incomingLink) == AbstractUserActionSuccessorEditPart.VISUAL_ID) {
197                                                                DestroyReferenceRequest r = new DestroyReferenceRequest(
198                                                                                incomingLink.getSource().getElement(),
199                                                                                null, incomingLink.getTarget()
200                                                                                                .getElement(), false);
201                                                                cmd.add(new DestroyReferenceCommand(r));
202                                                                cmd.add(new DeleteCommand(getEditingDomain(),
203                                                                                incomingLink));
204                                                                continue;
205                                                        }
206                                                }
207                                                for (Iterator it = cnode.getSourceEdges().iterator(); it
208                                                                .hasNext();) {
209                                                        Edge outgoingLink = (Edge) it.next();
210                                                        if (PalladioComponentModelVisualIDRegistry
211                                                                        .getVisualID(outgoingLink) == AbstractUserActionSuccessorEditPart.VISUAL_ID) {
212                                                                DestroyReferenceRequest r = new DestroyReferenceRequest(
213                                                                                outgoingLink.getSource().getElement(),
214                                                                                null, outgoingLink.getTarget()
215                                                                                                .getElement(), false);
216                                                                cmd.add(new DestroyReferenceCommand(r));
217                                                                cmd.add(new DeleteCommand(getEditingDomain(),
218                                                                                outgoingLink));
219                                                                continue;
220                                                        }
221                                                }
222                                                cmd.add(new DestroyElementCommand(
223                                                                new DestroyElementRequest(getEditingDomain(),
224                                                                                cnode.getElement(), false))); // directlyOwned: true
225                                                // don't need explicit deletion of cnode as parent's view deletion would clean child views as well 
226                                                // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
227                                                break;
228                                        case BranchEditPart.VISUAL_ID:
229                                                for (Iterator it = cnode.getTargetEdges().iterator(); it
230                                                                .hasNext();) {
231                                                        Edge incomingLink = (Edge) it.next();
232                                                        if (PalladioComponentModelVisualIDRegistry
233                                                                        .getVisualID(incomingLink) == AbstractUserActionSuccessorEditPart.VISUAL_ID) {
234                                                                DestroyReferenceRequest r = new DestroyReferenceRequest(
235                                                                                incomingLink.getSource().getElement(),
236                                                                                null, incomingLink.getTarget()
237                                                                                                .getElement(), false);
238                                                                cmd.add(new DestroyReferenceCommand(r));
239                                                                cmd.add(new DeleteCommand(getEditingDomain(),
240                                                                                incomingLink));
241                                                                continue;
242                                                        }
243                                                }
244                                                for (Iterator it = cnode.getSourceEdges().iterator(); it
245                                                                .hasNext();) {
246                                                        Edge outgoingLink = (Edge) it.next();
247                                                        if (PalladioComponentModelVisualIDRegistry
248                                                                        .getVisualID(outgoingLink) == AbstractUserActionSuccessorEditPart.VISUAL_ID) {
249                                                                DestroyReferenceRequest r = new DestroyReferenceRequest(
250                                                                                outgoingLink.getSource().getElement(),
251                                                                                null, outgoingLink.getTarget()
252                                                                                                .getElement(), false);
253                                                                cmd.add(new DestroyReferenceCommand(r));
254                                                                cmd.add(new DeleteCommand(getEditingDomain(),
255                                                                                outgoingLink));
256                                                                continue;
257                                                        }
258                                                }
259                                                cmd.add(new DestroyElementCommand(
260                                                                new DestroyElementRequest(getEditingDomain(),
261                                                                                cnode.getElement(), false))); // directlyOwned: true
262                                                // don't need explicit deletion of cnode as parent's view deletion would clean child views as well 
263                                                // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
264                                                break;
265                                        case DelayEditPart.VISUAL_ID:
266                                                for (Iterator it = cnode.getTargetEdges().iterator(); it
267                                                                .hasNext();) {
268                                                        Edge incomingLink = (Edge) it.next();
269                                                        if (PalladioComponentModelVisualIDRegistry
270                                                                        .getVisualID(incomingLink) == AbstractUserActionSuccessorEditPart.VISUAL_ID) {
271                                                                DestroyReferenceRequest r = new DestroyReferenceRequest(
272                                                                                incomingLink.getSource().getElement(),
273                                                                                null, incomingLink.getTarget()
274                                                                                                .getElement(), false);
275                                                                cmd.add(new DestroyReferenceCommand(r));
276                                                                cmd.add(new DeleteCommand(getEditingDomain(),
277                                                                                incomingLink));
278                                                                continue;
279                                                        }
280                                                }
281                                                for (Iterator it = cnode.getSourceEdges().iterator(); it
282                                                                .hasNext();) {
283                                                        Edge outgoingLink = (Edge) it.next();
284                                                        if (PalladioComponentModelVisualIDRegistry
285                                                                        .getVisualID(outgoingLink) == AbstractUserActionSuccessorEditPart.VISUAL_ID) {
286                                                                DestroyReferenceRequest r = new DestroyReferenceRequest(
287                                                                                outgoingLink.getSource().getElement(),
288                                                                                null, outgoingLink.getTarget()
289                                                                                                .getElement(), false);
290                                                                cmd.add(new DestroyReferenceCommand(r));
291                                                                cmd.add(new DeleteCommand(getEditingDomain(),
292                                                                                outgoingLink));
293                                                                continue;
294                                                        }
295                                                }
296                                                cmd.add(new DestroyElementCommand(
297                                                                new DestroyElementRequest(getEditingDomain(),
298                                                                                cnode.getElement(), false))); // directlyOwned: true
299                                                // don't need explicit deletion of cnode as parent's view deletion would clean child views as well 
300                                                // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
301                                                break;
302                                        }
303                                }
304                                break;
305                        }
306                }
307        }
308}

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