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

nameclass, %method, %block, %line, %
BranchTransitionItemSemanticEditPolicy.java0%   (0/1)0%   (0/4)0%   (0/101)0%   (0/24)

COVERAGE BREAKDOWN BY CLASS AND METHOD

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

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