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

nameclass, %method, %block, %line, %
ForkActionItemSemanticEditPolicy.java0%   (0/1)0%   (0/7)0%   (0/267)0%   (0/65)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ForkActionItemSemanticEditPolicy0%   (0/1)0%   (0/7)0%   (0/267)0%   (0/65)
ForkActionItemSemanticEditPolicy (): void 0%   (0/1)0%   (0/4)0%   (0/2)
addDestroyChildNodesCommand (ICompositeCommand): void 0%   (0/1)0%   (0/63)0%   (0/16)
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.ForkActionForkedBehaviours2EditPart;
27import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.ForkedBehaviourEditPart;
28import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.SynchronisationPointEditPart;
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 ForkActionItemSemanticEditPolicy extends
36                PalladioComponentModelBaseItemSemanticEditPolicy {
37 
38        /**
39         * @generated
40         */
41        public ForkActionItemSemanticEditPolicy() {
42                super(PalladioComponentModelElementTypes.ForkAction_2011);
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 ForkActionForkedBehaviours2EditPart.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 ForkedBehaviourEditPart.VISUAL_ID:
105                                                cmd.add(new DestroyElementCommand(
106                                                                new DestroyElementRequest(getEditingDomain(),
107                                                                                cnode.getElement(), false))); // directlyOwned: true
108                                                // don't need explicit deletion of cnode as parent's view deletion would clean child views as well 
109                                                // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
110                                                break;
111                                        case SynchronisationPointEditPart.VISUAL_ID:
112                                                cmd.add(new DestroyElementCommand(
113                                                                new DestroyElementRequest(getEditingDomain(),
114                                                                                cnode.getElement(), false))); // directlyOwned: true
115                                                // don't need explicit deletion of cnode as parent's view deletion would clean child views as well 
116                                                // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
117                                                break;
118                                        }
119                                }
120                                break;
121                        }
122                }
123        }
124 
125        /**
126         * @generated
127         */
128        protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
129                Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req)
130                                : getCompleteCreateRelationshipCommand(req);
131                return command != null ? command : super
132                                .getCreateRelationshipCommand(req);
133        }
134 
135        /**
136         * @generated
137         */
138        protected Command getStartCreateRelationshipCommand(
139                        CreateRelationshipRequest req) {
140                if (PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001 == req
141                                .getElementType()) {
142                        return getGEFWrapper(new AbstractActionSuccessor_AbstractActionCreateCommand(
143                                        req, req.getSource(), req.getTarget()));
144                }
145                return null;
146        }
147 
148        /**
149         * @generated
150         */
151        protected Command getCompleteCreateRelationshipCommand(
152                        CreateRelationshipRequest req) {
153                if (PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001 == req
154                                .getElementType()) {
155                        return getGEFWrapper(new AbstractActionSuccessor_AbstractActionCreateCommand(
156                                        req, req.getSource(), req.getTarget()));
157                }
158                return null;
159        }
160 
161        /**
162         * Returns command to reorient EReference based link. New link target or source
163         * should be the domain model element associated with this node.
164         * 
165         * @generated
166         */
167        protected Command getReorientReferenceRelationshipCommand(
168                        ReorientReferenceRelationshipRequest req) {
169                switch (getVisualID(req)) {
170                case AbstractActionSuccessor_AbstractActionEditPart.VISUAL_ID:
171                        return getGEFWrapper(new AbstractActionSuccessor_AbstractActionReorientCommand(
172                                        req));
173                }
174                return super.getReorientReferenceRelationshipCommand(req);
175        }
176 
177}

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