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

nameclass, %method, %block, %line, %
SetVariableAction2ItemSemanticEditPolicy.java0%   (0/1)0%   (0/7)0%   (0/253)0%   (0/61)

COVERAGE BREAKDOWN BY CLASS AND METHOD

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

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