EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012)
[all classes][de.uka.ipd.sdq.pcm.gmf.composite.edit.policies]

COVERAGE SUMMARY FOR SOURCE FILE [OperationRequiredRoleItemSemanticEditPolicy.java]

nameclass, %method, %block, %line, %
OperationRequiredRoleItemSemanticEditPolicy.java0%   (0/3)0%   (0/10)0%   (0/358)0%   (0/96)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class OperationRequiredRoleItemSemanticEditPolicy0%   (0/1)0%   (0/8)0%   (0/346)0%   (0/95)
OperationRequiredRoleItemSemanticEditPolicy (): void 0%   (0/1)0%   (0/4)0%   (0/2)
getCompleteCreateRelationshipCommand (CreateRelationshipRequest): Command 0%   (0/1)0%   (0/23)0%   (0/8)
getCreateRelationshipCommand (CreateRelationshipRequest): Command 0%   (0/1)0%   (0/30)0%   (0/9)
getDestroyElementCommand (DestroyElementRequest): Command 0%   (0/1)0%   (0/145)0%   (0/33)
getReorientRelationshipCommand (ReorientRelationshipRequest): Command 0%   (0/1)0%   (0/22)0%   (0/5)
getStartCreateRelationshipCommand (CreateRelationshipRequest): Command 0%   (0/1)0%   (0/32)0%   (0/9)
getStartCreateRelationshipCommandAssemblyConnector (CreateRelationshipRequest... 0%   (0/1)0%   (0/45)0%   (0/14)
getStartCreateRelationshipCommandRequiredDelegationConnector (CreateRelations... 0%   (0/1)0%   (0/45)0%   (0/15)
     
class OperationRequiredRoleItemSemanticEditPolicy$10%   (0/1)0%   (0/1)0%   (0/6)0%   (0/2)
OperationRequiredRoleItemSemanticEditPolicy$1 (OperationRequiredRoleItemSeman... 0%   (0/1)0%   (0/6)0%   (0/2)
     
class OperationRequiredRoleItemSemanticEditPolicy$20%   (0/1)0%   (0/1)0%   (0/6)0%   (0/2)
OperationRequiredRoleItemSemanticEditPolicy$2 (OperationRequiredRoleItemSeman... 0%   (0/1)0%   (0/6)0%   (0/2)

1/*
2 * Copyright 2007, SDQ, IPD, Uni Karlsruhe (TH)
3 */
4package de.uka.ipd.sdq.pcm.gmf.composite.edit.policies;
5 
6import java.util.Iterator;
7 
8import org.eclipse.emf.ecore.EAnnotation;
9import org.eclipse.emf.ecore.EObject;
10import org.eclipse.gef.commands.Command;
11import org.eclipse.gef.commands.UnexecutableCommand;
12import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
13import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
14import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
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.ReorientRelationshipRequest;
18import org.eclipse.gmf.runtime.notation.Edge;
19import org.eclipse.gmf.runtime.notation.View;
20 
21import de.uka.ipd.sdq.pcm.core.composition.ComposedStructure;
22import de.uka.ipd.sdq.pcm.core.composition.CompositionPackage;
23import de.uka.ipd.sdq.pcm.gmf.composite.edit.commands.AssemblyConnectorCreateCommand;
24import de.uka.ipd.sdq.pcm.gmf.composite.edit.commands.AssemblyConnectorReorientCommand;
25import de.uka.ipd.sdq.pcm.gmf.composite.edit.commands.RequiredDelegationConnectorCreateCommand;
26import de.uka.ipd.sdq.pcm.gmf.composite.edit.commands.RequiredDelegationConnectorReorientCommand;
27import de.uka.ipd.sdq.pcm.gmf.composite.edit.parts.AssemblyConnectorEditPart;
28import de.uka.ipd.sdq.pcm.gmf.composite.edit.parts.RequiredDelegationConnectorEditPart;
29import de.uka.ipd.sdq.pcm.gmf.composite.part.PalladioComponentModelVisualIDRegistry;
30import de.uka.ipd.sdq.pcm.gmf.composite.providers.PalladioComponentModelElementTypes;
31import de.uka.ipd.sdq.pcm.repository.OperationRequiredRole;
32 
33/**
34 * Semantic edit policy for inner assembly context operation required roles.
35 * 
36 * @generated
37 */
38public class OperationRequiredRoleItemSemanticEditPolicy extends
39                PalladioComponentModelBaseItemSemanticEditPolicy {
40 
41        /**
42         * @generated
43         */
44        public OperationRequiredRoleItemSemanticEditPolicy() {
45                super(PalladioComponentModelElementTypes.OperationRequiredRole_3008);
46        }
47 
48        /**
49         * @generated
50         */
51        protected Command getDestroyElementCommand(DestroyElementRequest req) {
52                View view = (View) getHost().getModel();
53                CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(
54                                getEditingDomain(), null);
55                cmd.setTransactionNestingEnabled(false);
56                for (Iterator it = view.getTargetEdges().iterator(); it.hasNext();) {
57                        Edge incomingLink = (Edge) it.next();
58                        if (PalladioComponentModelVisualIDRegistry
59                                        .getVisualID(incomingLink) == RequiredDelegationConnectorEditPart.VISUAL_ID) {
60                                DestroyElementRequest r = new DestroyElementRequest(
61                                                incomingLink.getElement(), false);
62                                cmd.add(new DestroyElementCommand(r));
63                                cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
64                                continue;
65                        }
66                }
67                for (Iterator it = view.getSourceEdges().iterator(); it.hasNext();) {
68                        Edge outgoingLink = (Edge) it.next();
69                        if (PalladioComponentModelVisualIDRegistry
70                                        .getVisualID(outgoingLink) == AssemblyConnectorEditPart.VISUAL_ID) {
71                                DestroyElementRequest r = new DestroyElementRequest(
72                                                outgoingLink.getElement(), false);
73                                cmd.add(new DestroyElementCommand(r));
74                                cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
75                                continue;
76                        }
77                        if (PalladioComponentModelVisualIDRegistry
78                                        .getVisualID(outgoingLink) == RequiredDelegationConnectorEditPart.VISUAL_ID) {
79                                DestroyElementRequest r = new DestroyElementRequest(
80                                                outgoingLink.getElement(), false);
81                                cmd.add(new DestroyElementCommand(r));
82                                cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
83                                continue;
84                        }
85                }
86                EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
87                if (annotation == null) {
88                        // there are indirectly referenced children, need extra commands: false
89                        addDestroyShortcutsCommand(cmd, view);
90                        // delete host element
91                        cmd.add(new DestroyElementCommand(req));
92                } else {
93                        cmd.add(new DeleteCommand(getEditingDomain(), view));
94                }
95                return getGEFWrapper(cmd.reduce());
96        }
97 
98        /**
99         * Get the create relationship command or null / UnexecutableCommand instance
100         * if this is not an valid end for the connector creation.
101         * 
102         * @param req The request object to create the command
103         * @return The prepared creation command object
104         *
105         * @generated not
106         */
107        protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
108                if (PalladioComponentModelElementTypes.AssemblyConnector_4004 == req
109                                .getElementType()) {
110                        return req.getTarget() == null ? getStartCreateRelationshipCommandAssemblyConnector(req)
111                                        : null;
112                }
113                if (PalladioComponentModelElementTypes.RequiredDelegationConnector_4005 == req
114                                .getElementType()) {
115                        return req.getTarget() == null ? getStartCreateRelationshipCommandRequiredDelegationConnector(req)
116                                        : null;
117                }
118                return super.getCreateRelationshipCommand(req);
119        }
120 
121        /**
122         * @generated
123         */
124        protected Command getStartCreateRelationshipCommand(
125                        CreateRelationshipRequest req) {
126                if (PalladioComponentModelElementTypes.AssemblyConnector_4004 == req
127                                .getElementType()) {
128                        return getGEFWrapper(new AssemblyConnectorCreateCommand(req, req
129                                        .getSource(), req.getTarget()));
130                }
131                if (PalladioComponentModelElementTypes.RequiredDelegationConnector_4005 == req
132                                .getElementType()) {
133                        return getGEFWrapper(new RequiredDelegationConnectorCreateCommand(
134                                        req, req.getSource(), req.getTarget()));
135                }
136                return null;
137        }
138 
139        /**
140         * Helper to create an instance of an outgoing assembly connector.
141         * 
142         * @param req The request describing the command to be created.
143         * @return The prepared command to create an AssemblyConnector
144         * 
145         * @generated not
146         */
147        protected Command getStartCreateRelationshipCommandAssemblyConnector(
148                        CreateRelationshipRequest req) {
149                EObject sourceEObject = req.getSource();
150                if (false == sourceEObject instanceof OperationRequiredRole) {
151                        return UnexecutableCommand.INSTANCE;
152                }
153                OperationRequiredRole source = (OperationRequiredRole) sourceEObject;
154                ComposedStructure container = (ComposedStructure) getRelationshipContainer(
155                                source, CompositionPackage.eINSTANCE.getComposedStructure(),
156                                req.getElementType());
157                if (container == null) {
158                        return UnexecutableCommand.INSTANCE;
159                }
160                if (!PalladioComponentModelBaseItemSemanticEditPolicy.LinkConstraints
161                                .canCreateAssemblyConnector_4004(container, source, null)) {
162                        return UnexecutableCommand.INSTANCE;
163                }
164                req.setParameter("REQ_CHILD_CONTEXT", ((View) getHost().getParent()
165                                .getModel()).getElement());
166                return new Command() {
167                };
168        }
169 
170        /**
171         * Get a command to create a required delegation connector.
172         * 
173         * @param req The request object to build up the command.
174         * @return The prepared command.
175         * 
176         * @generated not
177         */
178        protected Command getStartCreateRelationshipCommandRequiredDelegationConnector(
179                        CreateRelationshipRequest req) {
180                EObject sourceEObject = req.getSource();
181                if (false == sourceEObject instanceof OperationRequiredRole) {
182                        return UnexecutableCommand.INSTANCE;
183                }
184                OperationRequiredRole source = (OperationRequiredRole) sourceEObject;
185                ComposedStructure container = (ComposedStructure) getRelationshipContainer(
186                                source, CompositionPackage.eINSTANCE.getComposedStructure(),
187                                req.getElementType());
188                if (container == null) {
189                        return UnexecutableCommand.INSTANCE;
190                }
191                req.setParameter("CHILD_CONTEXT", ((View) getHost().getParent()
192                                .getModel()).getElement());
193                if (!PalladioComponentModelBaseItemSemanticEditPolicy.LinkConstraints
194                                .canCreateRequiredDelegationConnector_4005(container, source,
195                                                null)) {
196                        return UnexecutableCommand.INSTANCE;
197                }
198                return new Command() {
199                };
200        }
201 
202        /**
203         * @generated
204         */
205        protected Command getCompleteCreateRelationshipCommand(
206                        CreateRelationshipRequest req) {
207                if (PalladioComponentModelElementTypes.AssemblyConnector_4004 == req
208                                .getElementType()) {
209                        return null;
210                }
211                if (PalladioComponentModelElementTypes.RequiredDelegationConnector_4005 == req
212                                .getElementType()) {
213                        return getGEFWrapper(new RequiredDelegationConnectorCreateCommand(
214                                        req, req.getSource(), req.getTarget()));
215                }
216                return null;
217        }
218 
219        /**
220         * Returns command to reorient EClass based link. New link target or source
221         * should be the domain model element associated with this node.
222         * 
223         * @generated
224         */
225        protected Command getReorientRelationshipCommand(
226                        ReorientRelationshipRequest req) {
227                switch (getVisualID(req)) {
228                case AssemblyConnectorEditPart.VISUAL_ID:
229                        return getGEFWrapper(new AssemblyConnectorReorientCommand(req));
230                case RequiredDelegationConnectorEditPart.VISUAL_ID:
231                        return getGEFWrapper(new RequiredDelegationConnectorReorientCommand(
232                                        req));
233                }
234                return super.getReorientRelationshipCommand(req);
235        }
236 
237}

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