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

nameclass, %method, %block, %line, %
RecoveryAction2ItemSemanticEditPolicy.java0%   (0/1)0%   (0/7)0%   (0/337)0%   (0/85)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class RecoveryAction2ItemSemanticEditPolicy0%   (0/1)0%   (0/7)0%   (0/337)0%   (0/85)
RecoveryAction2ItemSemanticEditPolicy (): void 0%   (0/1)0%   (0/4)0%   (0/2)
addDestroyChildNodesCommand (ICompositeCommand): void 0%   (0/1)0%   (0/133)0%   (0/36)
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/132)0%   (0/29)
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.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.CreateRelationshipRequest;
16import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
17import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;
18import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
19import org.eclipse.gmf.runtime.notation.Edge;
20import org.eclipse.gmf.runtime.notation.Node;
21import org.eclipse.gmf.runtime.notation.View;
22 
23import de.uka.ipd.sdq.pcm.gmf.seff.edit.commands.AbstractActionSuccessor_AbstractActionCreateCommand;
24import de.uka.ipd.sdq.pcm.gmf.seff.edit.commands.AbstractActionSuccessor_AbstractActionReorientCommand;
25import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.AbstractActionSuccessor_AbstractActionEditPart;
26import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.RecoveryActionBehaviourEditPart;
27import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.RecoveryActionBehaviourFailureHandlingAlternatives__RecoveryActionBehaviourEditPart;
28import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.RecoveryActionRecoveryBlockCompartmentEditPart;
29import de.uka.ipd.sdq.pcm.gmf.seff.part.PalladioComponentModelVisualIDRegistry;
30import de.uka.ipd.sdq.pcm.gmf.seff.providers.PalladioComponentModelElementTypes;
31 
32/**
33 * @generated
34 */
35public class RecoveryAction2ItemSemanticEditPolicy extends
36                PalladioComponentModelBaseItemSemanticEditPolicy {
37 
38        /**
39         * @generated
40         */
41        public RecoveryAction2ItemSemanticEditPolicy() {
42                super(PalladioComponentModelElementTypes.RecoveryAction_3057);
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                for (Iterator it = view.getTargetEdges().iterator(); it.hasNext();) {
54                        Edge incomingLink = (Edge) it.next();
55                        if (PalladioComponentModelVisualIDRegistry
56                                        .getVisualID(incomingLink) == AbstractActionSuccessor_AbstractActionEditPart.VISUAL_ID) {
57                                DestroyReferenceRequest r = new DestroyReferenceRequest(
58                                                incomingLink.getSource().getElement(), null,
59                                                incomingLink.getTarget().getElement(), false);
60                                cmd.add(new DestroyReferenceCommand(r));
61                                cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
62                                continue;
63                        }
64                }
65                for (Iterator it = view.getSourceEdges().iterator(); it.hasNext();) {
66                        Edge outgoingLink = (Edge) it.next();
67                        if (PalladioComponentModelVisualIDRegistry
68                                        .getVisualID(outgoingLink) == AbstractActionSuccessor_AbstractActionEditPart.VISUAL_ID) {
69                                DestroyReferenceRequest r = new DestroyReferenceRequest(
70                                                outgoingLink.getSource().getElement(), null,
71                                                outgoingLink.getTarget().getElement(), false);
72                                cmd.add(new DestroyReferenceCommand(r));
73                                cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
74                                continue;
75                        }
76                }
77                EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
78                if (annotation == null) {
79                        // there are indirectly referenced children, need extra commands: false
80                        addDestroyChildNodesCommand(cmd);
81                        addDestroyShortcutsCommand(cmd, view);
82                        // delete host element
83                        cmd.add(new DestroyElementCommand(req));
84                } else {
85                        cmd.add(new DeleteCommand(getEditingDomain(), view));
86                }
87                return getGEFWrapper(cmd.reduce());
88        }
89 
90        /**
91         * @generated
92         */
93        private void addDestroyChildNodesCommand(ICompositeCommand cmd) {
94                View view = (View) getHost().getModel();
95                for (Iterator nit = view.getChildren().iterator(); nit.hasNext();) {
96                        Node node = (Node) nit.next();
97                        switch (PalladioComponentModelVisualIDRegistry.getVisualID(node)) {
98                        case RecoveryActionRecoveryBlockCompartmentEditPart.VISUAL_ID:
99                                for (Iterator cit = node.getChildren().iterator(); cit
100                                                .hasNext();) {
101                                        Node cnode = (Node) cit.next();
102                                        switch (PalladioComponentModelVisualIDRegistry
103                                                        .getVisualID(cnode)) {
104                                        case RecoveryActionBehaviourEditPart.VISUAL_ID:
105                                                for (Iterator it = cnode.getTargetEdges().iterator(); it
106                                                                .hasNext();) {
107                                                        Edge incomingLink = (Edge) it.next();
108                                                        if (PalladioComponentModelVisualIDRegistry
109                                                                        .getVisualID(incomingLink) == RecoveryActionBehaviourFailureHandlingAlternatives__RecoveryActionBehaviourEditPart.VISUAL_ID) {
110                                                                DestroyReferenceRequest r = new DestroyReferenceRequest(
111                                                                                incomingLink.getSource().getElement(),
112                                                                                null, incomingLink.getTarget()
113                                                                                                .getElement(), false);
114                                                                cmd.add(new DestroyReferenceCommand(r));
115                                                                cmd.add(new DeleteCommand(getEditingDomain(),
116                                                                                incomingLink));
117                                                                continue;
118                                                        }
119                                                }
120                                                for (Iterator it = cnode.getSourceEdges().iterator(); it
121                                                                .hasNext();) {
122                                                        Edge outgoingLink = (Edge) it.next();
123                                                        if (PalladioComponentModelVisualIDRegistry
124                                                                        .getVisualID(outgoingLink) == RecoveryActionBehaviourFailureHandlingAlternatives__RecoveryActionBehaviourEditPart.VISUAL_ID) {
125                                                                DestroyReferenceRequest r = new DestroyReferenceRequest(
126                                                                                outgoingLink.getSource().getElement(),
127                                                                                null, outgoingLink.getTarget()
128                                                                                                .getElement(), false);
129                                                                cmd.add(new DestroyReferenceCommand(r));
130                                                                cmd.add(new DeleteCommand(getEditingDomain(),
131                                                                                outgoingLink));
132                                                                continue;
133                                                        }
134                                                }
135                                                cmd.add(new DestroyElementCommand(
136                                                                new DestroyElementRequest(getEditingDomain(),
137                                                                                cnode.getElement(), false))); // directlyOwned: true
138                                                // don't need explicit deletion of cnode as parent's view deletion would clean child views as well 
139                                                // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
140                                                break;
141                                        }
142                                }
143                                break;
144                        }
145                }
146        }
147 
148        /**
149         * @generated
150         */
151        protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
152                Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req)
153                                : getCompleteCreateRelationshipCommand(req);
154                return command != null ? command : super
155                                .getCreateRelationshipCommand(req);
156        }
157 
158        /**
159         * @generated
160         */
161        protected Command getStartCreateRelationshipCommand(
162                        CreateRelationshipRequest req) {
163                if (PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001 == req
164                                .getElementType()) {
165                        return getGEFWrapper(new AbstractActionSuccessor_AbstractActionCreateCommand(
166                                        req, req.getSource(), req.getTarget()));
167                }
168                return null;
169        }
170 
171        /**
172         * @generated
173         */
174        protected Command getCompleteCreateRelationshipCommand(
175                        CreateRelationshipRequest req) {
176                if (PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001 == req
177                                .getElementType()) {
178                        return getGEFWrapper(new AbstractActionSuccessor_AbstractActionCreateCommand(
179                                        req, req.getSource(), req.getTarget()));
180                }
181                return null;
182        }
183 
184        /**
185         * Returns command to reorient EReference based link. New link target or source
186         * should be the domain model element associated with this node.
187         * 
188         * @generated
189         */
190        protected Command getReorientReferenceRelationshipCommand(
191                        ReorientReferenceRelationshipRequest req) {
192                switch (getVisualID(req)) {
193                case AbstractActionSuccessor_AbstractActionEditPart.VISUAL_ID:
194                        return getGEFWrapper(new AbstractActionSuccessor_AbstractActionReorientCommand(
195                                        req));
196                }
197                return super.getReorientReferenceRelationshipCommand(req);
198        }
199 
200}

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