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

nameclass, %method, %block, %line, %
CollectionIteratorActionItemSemanticEditPolicy.java0%   (0/1)0%   (0/8)0%   (0/253)0%   (0/61)

COVERAGE BREAKDOWN BY CLASS AND METHOD

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

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