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

nameclass, %method, %block, %line, %
ExternalCallActionItemSemanticEditPolicy.java0%   (0/1)0%   (0/7)0%   (0/282)0%   (0/69)

COVERAGE BREAKDOWN BY CLASS AND METHOD

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

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