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 [UsageScenario2ItemSemanticEditPolicy.java]

nameclass, %method, %block, %line, %
UsageScenario2ItemSemanticEditPolicy.java0%   (0/1)0%   (0/3)0%   (0/129)0%   (0/33)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class UsageScenario2ItemSemanticEditPolicy0%   (0/1)0%   (0/3)0%   (0/129)0%   (0/33)
UsageScenario2ItemSemanticEditPolicy (): void 0%   (0/1)0%   (0/4)0%   (0/2)
addDestroyChildNodesCommand (ICompositeCommand): void 0%   (0/1)0%   (0/77)0%   (0/20)
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.requests.DestroyElementRequest;
15import org.eclipse.gmf.runtime.notation.Node;
16import org.eclipse.gmf.runtime.notation.View;
17 
18import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.ClosedWorkloadEditPart;
19import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.OpenWorkloadEditPart;
20import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.ScenarioBehaviourEditPart;
21import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.UsageScenarioUsageScenarioCompartmentEditPart;
22import de.uka.ipd.sdq.pcm.gmf.usage.part.PalladioComponentModelVisualIDRegistry;
23import de.uka.ipd.sdq.pcm.gmf.usage.providers.PalladioComponentModelElementTypes;
24 
25/**
26 * @generated
27 */
28public class UsageScenario2ItemSemanticEditPolicy extends
29                PalladioComponentModelBaseItemSemanticEditPolicy {
30 
31        /**
32         * @generated
33         */
34        public UsageScenario2ItemSemanticEditPolicy() {
35                super(PalladioComponentModelElementTypes.UsageScenario_2004);
36        }
37 
38        /**
39         * @generated
40         */
41        protected Command getDestroyElementCommand(DestroyElementRequest req) {
42                View view = (View) getHost().getModel();
43                CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(
44                                getEditingDomain(), null);
45                cmd.setTransactionNestingEnabled(false);
46                EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
47                if (annotation == null) {
48                        // there are indirectly referenced children, need extra commands: false
49                        addDestroyChildNodesCommand(cmd);
50                        addDestroyShortcutsCommand(cmd, view);
51                        // delete host element
52                        cmd.add(new DestroyElementCommand(req));
53                } else {
54                        cmd.add(new DeleteCommand(getEditingDomain(), view));
55                }
56                return getGEFWrapper(cmd.reduce());
57        }
58 
59        /**
60         * @generated
61         */
62        private void addDestroyChildNodesCommand(ICompositeCommand cmd) {
63                View view = (View) getHost().getModel();
64                for (Iterator nit = view.getChildren().iterator(); nit.hasNext();) {
65                        Node node = (Node) nit.next();
66                        switch (PalladioComponentModelVisualIDRegistry.getVisualID(node)) {
67                        case UsageScenarioUsageScenarioCompartmentEditPart.VISUAL_ID:
68                                for (Iterator cit = node.getChildren().iterator(); cit
69                                                .hasNext();) {
70                                        Node cnode = (Node) cit.next();
71                                        switch (PalladioComponentModelVisualIDRegistry
72                                                        .getVisualID(cnode)) {
73                                        case ScenarioBehaviourEditPart.VISUAL_ID:
74                                                cmd.add(new DestroyElementCommand(
75                                                                new DestroyElementRequest(getEditingDomain(),
76                                                                                cnode.getElement(), false))); // directlyOwned: true
77                                                // don't need explicit deletion of cnode as parent's view deletion would clean child views as well 
78                                                // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
79                                                break;
80                                        case ClosedWorkloadEditPart.VISUAL_ID:
81                                                cmd.add(new DestroyElementCommand(
82                                                                new DestroyElementRequest(getEditingDomain(),
83                                                                                cnode.getElement(), false))); // directlyOwned: true
84                                                // don't need explicit deletion of cnode as parent's view deletion would clean child views as well 
85                                                // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
86                                                break;
87                                        case OpenWorkloadEditPart.VISUAL_ID:
88                                                cmd.add(new DestroyElementCommand(
89                                                                new DestroyElementRequest(getEditingDomain(),
90                                                                                cnode.getElement(), false))); // directlyOwned: true
91                                                // don't need explicit deletion of cnode as parent's view deletion would clean child views as well 
92                                                // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
93                                                break;
94                                        }
95                                }
96                                break;
97                        }
98                }
99        }
100 
101}

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