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

COVERAGE SUMMARY FOR SOURCE FILE [ProbabilisticBranchTransitionItemSemanticEditPolicy.java]

nameclass, %method, %block, %line, %
ProbabilisticBranchTransitionItemSemanticEditPolicy.java0%   (0/1)0%   (0/4)0%   (0/101)0%   (0/26)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ProbabilisticBranchTransitionItemSemanticEditPolicy0%   (0/1)0%   (0/4)0%   (0/101)0%   (0/26)
ProbabilisticBranchTransitionItemSemanticEditPolicy (): void 0%   (0/1)0%   (0/4)0%   (0/3)
addDestroyChildNodesCommand (ICompositeCommand): void 0%   (0/1)0%   (0/34)0%   (0/7)
getCreateCommand (CreateElementRequest): Command 0%   (0/1)0%   (0/15)0%   (0/5)
getDestroyElementCommand (DestroyElementRequest): Command 0%   (0/1)0%   (0/48)0%   (0/11)

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

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