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

nameclass, %method, %block, %line, %
StopActionItemSemanticEditPolicy.java0%   (0/1)0%   (0/6)0%   (0/201)0%   (0/48)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class StopActionItemSemanticEditPolicy0%   (0/1)0%   (0/6)0%   (0/201)0%   (0/48)
StopActionItemSemanticEditPolicy (): void 0%   (0/1)0%   (0/4)0%   (0/2)
getCompleteCreateRelationshipCommand (CreateRelationshipRequest): Command 0%   (0/1)0%   (0/17)0%   (0/5)
getCreateRelationshipCommand (CreateRelationshipRequest): Command 0%   (0/1)0%   (0/19)0%   (0/4)
getDestroyElementCommand (DestroyElementRequest): Command 0%   (0/1)0%   (0/129)0%   (0/28)
getReorientReferenceRelationshipCommand (ReorientReferenceRelationshipRequest... 0%   (0/1)0%   (0/15)0%   (0/4)
getStartCreateRelationshipCommand (CreateRelationshipRequest): Command 0%   (0/1)0%   (0/17)0%   (0/5)

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.diagram.core.commands.DeleteCommand;
11import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
12import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
13import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyReferenceCommand;
14import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
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.emf.type.core.requests.ReorientReferenceRelationshipRequest;
18import org.eclipse.gmf.runtime.notation.Edge;
19import org.eclipse.gmf.runtime.notation.View;
20 
21import de.uka.ipd.sdq.pcm.gmf.seff.edit.commands.AbstractActionSuccessor_AbstractActionCreateCommand;
22import de.uka.ipd.sdq.pcm.gmf.seff.edit.commands.AbstractActionSuccessor_AbstractActionReorientCommand;
23import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.AbstractActionSuccessor_AbstractActionEditPart;
24import de.uka.ipd.sdq.pcm.gmf.seff.part.PalladioComponentModelVisualIDRegistry;
25import de.uka.ipd.sdq.pcm.gmf.seff.providers.PalladioComponentModelElementTypes;
26 
27/**
28 * @generated
29 */
30public class StopActionItemSemanticEditPolicy extends
31                PalladioComponentModelBaseItemSemanticEditPolicy {
32 
33        /**
34         * @generated
35         */
36        public StopActionItemSemanticEditPolicy() {
37                super(PalladioComponentModelElementTypes.StopAction_2002);
38        }
39 
40        /**
41         * @generated
42         */
43        protected Command getDestroyElementCommand(DestroyElementRequest req) {
44                View view = (View) getHost().getModel();
45                CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(
46                                getEditingDomain(), null);
47                cmd.setTransactionNestingEnabled(false);
48                for (Iterator it = view.getTargetEdges().iterator(); it.hasNext();) {
49                        Edge incomingLink = (Edge) it.next();
50                        if (PalladioComponentModelVisualIDRegistry
51                                        .getVisualID(incomingLink) == AbstractActionSuccessor_AbstractActionEditPart.VISUAL_ID) {
52                                DestroyReferenceRequest r = new DestroyReferenceRequest(
53                                                incomingLink.getSource().getElement(), null,
54                                                incomingLink.getTarget().getElement(), false);
55                                cmd.add(new DestroyReferenceCommand(r));
56                                cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
57                                continue;
58                        }
59                }
60                for (Iterator it = view.getSourceEdges().iterator(); it.hasNext();) {
61                        Edge outgoingLink = (Edge) it.next();
62                        if (PalladioComponentModelVisualIDRegistry
63                                        .getVisualID(outgoingLink) == AbstractActionSuccessor_AbstractActionEditPart.VISUAL_ID) {
64                                DestroyReferenceRequest r = new DestroyReferenceRequest(
65                                                outgoingLink.getSource().getElement(), null,
66                                                outgoingLink.getTarget().getElement(), false);
67                                cmd.add(new DestroyReferenceCommand(r));
68                                cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
69                                continue;
70                        }
71                }
72                EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
73                if (annotation == null) {
74                        // there are indirectly referenced children, need extra commands: false
75                        addDestroyShortcutsCommand(cmd, view);
76                        // delete host element
77                        cmd.add(new DestroyElementCommand(req));
78                } else {
79                        cmd.add(new DeleteCommand(getEditingDomain(), view));
80                }
81                return getGEFWrapper(cmd.reduce());
82        }
83 
84        /**
85         * @generated
86         */
87        protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
88                Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req)
89                                : getCompleteCreateRelationshipCommand(req);
90                return command != null ? command : super
91                                .getCreateRelationshipCommand(req);
92        }
93 
94        /**
95         * @generated
96         */
97        protected Command getStartCreateRelationshipCommand(
98                        CreateRelationshipRequest req) {
99                if (PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001 == req
100                                .getElementType()) {
101                        return getGEFWrapper(new AbstractActionSuccessor_AbstractActionCreateCommand(
102                                        req, req.getSource(), req.getTarget()));
103                }
104                return null;
105        }
106 
107        /**
108         * @generated
109         */
110        protected Command getCompleteCreateRelationshipCommand(
111                        CreateRelationshipRequest req) {
112                if (PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001 == req
113                                .getElementType()) {
114                        return getGEFWrapper(new AbstractActionSuccessor_AbstractActionCreateCommand(
115                                        req, req.getSource(), req.getTarget()));
116                }
117                return null;
118        }
119 
120        /**
121         * Returns command to reorient EReference based link. New link target or source
122         * should be the domain model element associated with this node.
123         * 
124         * @generated
125         */
126        protected Command getReorientReferenceRelationshipCommand(
127                        ReorientReferenceRelationshipRequest req) {
128                switch (getVisualID(req)) {
129                case AbstractActionSuccessor_AbstractActionEditPart.VISUAL_ID:
130                        return getGEFWrapper(new AbstractActionSuccessor_AbstractActionReorientCommand(
131                                        req));
132                }
133                return super.getReorientReferenceRelationshipCommand(req);
134        }
135 
136}

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