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

COVERAGE SUMMARY FOR SOURCE FILE [CompleteComponentTypeItemSemanticEditPolicy.java]

nameclass, %method, %block, %line, %
CompleteComponentTypeItemSemanticEditPolicy.java0%   (0/1)0%   (0/7)0%   (0/552)0%   (0/150)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class CompleteComponentTypeItemSemanticEditPolicy0%   (0/1)0%   (0/7)0%   (0/552)0%   (0/150)
CompleteComponentTypeItemSemanticEditPolicy (): void 0%   (0/1)0%   (0/4)0%   (0/2)
getCompleteCreateRelationshipCommand (CreateRelationshipRequest): Command 0%   (0/1)0%   (0/59)0%   (0/26)
getCreateRelationshipCommand (CreateRelationshipRequest): Command 0%   (0/1)0%   (0/19)0%   (0/4)
getDestroyElementCommand (DestroyElementRequest): Command 0%   (0/1)0%   (0/285)0%   (0/70)
getReorientReferenceRelationshipCommand (ReorientReferenceRelationshipRequest... 0%   (0/1)0%   (0/22)0%   (0/6)
getReorientRelationshipCommand (ReorientRelationshipRequest): Command 0%   (0/1)0%   (0/50)0%   (0/10)
getStartCreateRelationshipCommand (CreateRelationshipRequest): Command 0%   (0/1)0%   (0/113)0%   (0/32)

1/*
2 * Copyright 2007, IPD, SDQ, University of Karlsruhe
3 */
4package de.uka.ipd.sdq.pcm.gmf.repository.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.diagram.core.commands.DeleteCommand;
11import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
12import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
13import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyReferenceCommand;
14import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
15import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
16import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;
17import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
18import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
19import org.eclipse.gmf.runtime.notation.Edge;
20import org.eclipse.gmf.runtime.notation.View;
21 
22import de.uka.ipd.sdq.pcm.gmf.repository.edit.commands.CompleteComponentTypeParentProvidesComponentTypesCreateCommand;
23import de.uka.ipd.sdq.pcm.gmf.repository.edit.commands.CompleteComponentTypeParentProvidesComponentTypesReorientCommand;
24import de.uka.ipd.sdq.pcm.gmf.repository.edit.commands.ImplementationComponentTypeParentCompleteComponentTypesCreateCommand;
25import de.uka.ipd.sdq.pcm.gmf.repository.edit.commands.ImplementationComponentTypeParentCompleteComponentTypesReorientCommand;
26import de.uka.ipd.sdq.pcm.gmf.repository.edit.commands.InfrastructureProvidedRoleCreateCommand;
27import de.uka.ipd.sdq.pcm.gmf.repository.edit.commands.InfrastructureProvidedRoleReorientCommand;
28import de.uka.ipd.sdq.pcm.gmf.repository.edit.commands.InfrastructureRequiredRoleCreateCommand;
29import de.uka.ipd.sdq.pcm.gmf.repository.edit.commands.InfrastructureRequiredRoleReorientCommand;
30import de.uka.ipd.sdq.pcm.gmf.repository.edit.commands.OperationProvidedRoleCreateCommand;
31import de.uka.ipd.sdq.pcm.gmf.repository.edit.commands.OperationProvidedRoleReorientCommand;
32import de.uka.ipd.sdq.pcm.gmf.repository.edit.commands.OperationRequiredRoleCreateCommand;
33import de.uka.ipd.sdq.pcm.gmf.repository.edit.commands.OperationRequiredRoleReorientCommand;
34import de.uka.ipd.sdq.pcm.gmf.repository.edit.commands.SinkRoleCreateCommand;
35import de.uka.ipd.sdq.pcm.gmf.repository.edit.commands.SinkRoleReorientCommand;
36import de.uka.ipd.sdq.pcm.gmf.repository.edit.commands.SourceRoleCreateCommand;
37import de.uka.ipd.sdq.pcm.gmf.repository.edit.commands.SourceRoleReorientCommand;
38import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.CompleteComponentTypeParentProvidesComponentTypesEditPart;
39import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.ImplementationComponentTypeParentCompleteComponentTypesEditPart;
40import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.InfrastructureProvidedRoleEditPart;
41import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.InfrastructureRequiredRoleEditPart;
42import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.OperationProvidedRoleEditPart;
43import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.OperationRequiredRoleEditPart;
44import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.SinkRoleEditPart;
45import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.SourceRoleEditPart;
46import de.uka.ipd.sdq.pcm.gmf.repository.part.PalladioComponentModelVisualIDRegistry;
47import de.uka.ipd.sdq.pcm.gmf.repository.providers.PalladioComponentModelElementTypes;
48 
49/**
50 * @generated
51 */
52public class CompleteComponentTypeItemSemanticEditPolicy extends
53                PalladioComponentModelBaseItemSemanticEditPolicy {
54 
55        /**
56         * @generated
57         */
58        public CompleteComponentTypeItemSemanticEditPolicy() {
59                super(PalladioComponentModelElementTypes.CompleteComponentType_2104);
60        }
61 
62        /**
63         * @generated
64         */
65        protected Command getDestroyElementCommand(DestroyElementRequest req) {
66                View view = (View) getHost().getModel();
67                CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(
68                                getEditingDomain(), null);
69                cmd.setTransactionNestingEnabled(false);
70                for (Iterator it = view.getTargetEdges().iterator(); it.hasNext();) {
71                        Edge incomingLink = (Edge) it.next();
72                        if (PalladioComponentModelVisualIDRegistry
73                                        .getVisualID(incomingLink) == ImplementationComponentTypeParentCompleteComponentTypesEditPart.VISUAL_ID) {
74                                DestroyReferenceRequest r = new DestroyReferenceRequest(
75                                                incomingLink.getSource().getElement(), null,
76                                                incomingLink.getTarget().getElement(), false);
77                                cmd.add(new DestroyReferenceCommand(r));
78                                cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
79                                continue;
80                        }
81                }
82                for (Iterator it = view.getSourceEdges().iterator(); it.hasNext();) {
83                        Edge outgoingLink = (Edge) it.next();
84                        if (PalladioComponentModelVisualIDRegistry
85                                        .getVisualID(outgoingLink) == OperationProvidedRoleEditPart.VISUAL_ID) {
86                                DestroyElementRequest r = new DestroyElementRequest(
87                                                outgoingLink.getElement(), false);
88                                cmd.add(new DestroyElementCommand(r));
89                                cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
90                                continue;
91                        }
92                        if (PalladioComponentModelVisualIDRegistry
93                                        .getVisualID(outgoingLink) == InfrastructureProvidedRoleEditPart.VISUAL_ID) {
94                                DestroyElementRequest r = new DestroyElementRequest(
95                                                outgoingLink.getElement(), false);
96                                cmd.add(new DestroyElementCommand(r));
97                                cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
98                                continue;
99                        }
100                        if (PalladioComponentModelVisualIDRegistry
101                                        .getVisualID(outgoingLink) == InfrastructureRequiredRoleEditPart.VISUAL_ID) {
102                                DestroyElementRequest r = new DestroyElementRequest(
103                                                outgoingLink.getElement(), false);
104                                cmd.add(new DestroyElementCommand(r));
105                                cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
106                                continue;
107                        }
108                        if (PalladioComponentModelVisualIDRegistry
109                                        .getVisualID(outgoingLink) == SinkRoleEditPart.VISUAL_ID) {
110                                DestroyElementRequest r = new DestroyElementRequest(
111                                                outgoingLink.getElement(), false);
112                                cmd.add(new DestroyElementCommand(r));
113                                cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
114                                continue;
115                        }
116                        if (PalladioComponentModelVisualIDRegistry
117                                        .getVisualID(outgoingLink) == OperationRequiredRoleEditPart.VISUAL_ID) {
118                                DestroyElementRequest r = new DestroyElementRequest(
119                                                outgoingLink.getElement(), false);
120                                cmd.add(new DestroyElementCommand(r));
121                                cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
122                                continue;
123                        }
124                        if (PalladioComponentModelVisualIDRegistry
125                                        .getVisualID(outgoingLink) == CompleteComponentTypeParentProvidesComponentTypesEditPart.VISUAL_ID) {
126                                DestroyReferenceRequest r = new DestroyReferenceRequest(
127                                                outgoingLink.getSource().getElement(), null,
128                                                outgoingLink.getTarget().getElement(), false);
129                                cmd.add(new DestroyReferenceCommand(r));
130                                cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
131                                continue;
132                        }
133                        if (PalladioComponentModelVisualIDRegistry
134                                        .getVisualID(outgoingLink) == SourceRoleEditPart.VISUAL_ID) {
135                                DestroyElementRequest r = new DestroyElementRequest(
136                                                outgoingLink.getElement(), false);
137                                cmd.add(new DestroyElementCommand(r));
138                                cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
139                                continue;
140                        }
141                }
142                EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
143                if (annotation == null) {
144                        // there are indirectly referenced children, need extra commands: false
145                        addDestroyShortcutsCommand(cmd, view);
146                        // delete host element
147                        cmd.add(new DestroyElementCommand(req));
148                } else {
149                        cmd.add(new DeleteCommand(getEditingDomain(), view));
150                }
151                return getGEFWrapper(cmd.reduce());
152        }
153 
154        /**
155         * @generated
156         */
157        protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
158                Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req)
159                                : getCompleteCreateRelationshipCommand(req);
160                return command != null ? command : super
161                                .getCreateRelationshipCommand(req);
162        }
163 
164        /**
165         * @generated
166         */
167        protected Command getStartCreateRelationshipCommand(
168                        CreateRelationshipRequest req) {
169                if (PalladioComponentModelElementTypes.OperationProvidedRole_4105 == req
170                                .getElementType()) {
171                        return getGEFWrapper(new OperationProvidedRoleCreateCommand(req,
172                                        req.getSource(), req.getTarget()));
173                }
174                if (PalladioComponentModelElementTypes.InfrastructureProvidedRole_4111 == req
175                                .getElementType()) {
176                        return getGEFWrapper(new InfrastructureProvidedRoleCreateCommand(
177                                        req, req.getSource(), req.getTarget()));
178                }
179                if (PalladioComponentModelElementTypes.InfrastructureRequiredRole_4112 == req
180                                .getElementType()) {
181                        return getGEFWrapper(new InfrastructureRequiredRoleCreateCommand(
182                                        req, req.getSource(), req.getTarget()));
183                }
184                if (PalladioComponentModelElementTypes.SinkRole_4109 == req
185                                .getElementType()) {
186                        return getGEFWrapper(new SinkRoleCreateCommand(req,
187                                        req.getSource(), req.getTarget()));
188                }
189                if (PalladioComponentModelElementTypes.OperationRequiredRole_4106 == req
190                                .getElementType()) {
191                        return getGEFWrapper(new OperationRequiredRoleCreateCommand(req,
192                                        req.getSource(), req.getTarget()));
193                }
194                if (PalladioComponentModelElementTypes.ImplementationComponentTypeParentCompleteComponentTypes_4103 == req
195                                .getElementType()) {
196                        return null;
197                }
198                if (PalladioComponentModelElementTypes.CompleteComponentTypeParentProvidesComponentTypes_4104 == req
199                                .getElementType()) {
200                        return getGEFWrapper(new CompleteComponentTypeParentProvidesComponentTypesCreateCommand(
201                                        req, req.getSource(), req.getTarget()));
202                }
203                if (PalladioComponentModelElementTypes.SourceRole_4110 == req
204                                .getElementType()) {
205                        return getGEFWrapper(new SourceRoleCreateCommand(req, req
206                                        .getSource(), req.getTarget()));
207                }
208                return null;
209        }
210 
211        /**
212         * @generated
213         */
214        protected Command getCompleteCreateRelationshipCommand(
215                        CreateRelationshipRequest req) {
216                if (PalladioComponentModelElementTypes.OperationProvidedRole_4105 == req
217                                .getElementType()) {
218                        return null;
219                }
220                if (PalladioComponentModelElementTypes.InfrastructureProvidedRole_4111 == req
221                                .getElementType()) {
222                        return null;
223                }
224                if (PalladioComponentModelElementTypes.InfrastructureRequiredRole_4112 == req
225                                .getElementType()) {
226                        return null;
227                }
228                if (PalladioComponentModelElementTypes.SinkRole_4109 == req
229                                .getElementType()) {
230                        return null;
231                }
232                if (PalladioComponentModelElementTypes.OperationRequiredRole_4106 == req
233                                .getElementType()) {
234                        return null;
235                }
236                if (PalladioComponentModelElementTypes.ImplementationComponentTypeParentCompleteComponentTypes_4103 == req
237                                .getElementType()) {
238                        return getGEFWrapper(new ImplementationComponentTypeParentCompleteComponentTypesCreateCommand(
239                                        req, req.getSource(), req.getTarget()));
240                }
241                if (PalladioComponentModelElementTypes.CompleteComponentTypeParentProvidesComponentTypes_4104 == req
242                                .getElementType()) {
243                        return null;
244                }
245                if (PalladioComponentModelElementTypes.SourceRole_4110 == req
246                                .getElementType()) {
247                        return null;
248                }
249                return null;
250        }
251 
252        /**
253         * Returns command to reorient EClass based link. New link target or source
254         * should be the domain model element associated with this node.
255         * 
256         * @generated
257         */
258        protected Command getReorientRelationshipCommand(
259                        ReorientRelationshipRequest req) {
260                switch (getVisualID(req)) {
261                case OperationProvidedRoleEditPart.VISUAL_ID:
262                        return getGEFWrapper(new OperationProvidedRoleReorientCommand(req));
263                case InfrastructureProvidedRoleEditPart.VISUAL_ID:
264                        return getGEFWrapper(new InfrastructureProvidedRoleReorientCommand(
265                                        req));
266                case InfrastructureRequiredRoleEditPart.VISUAL_ID:
267                        return getGEFWrapper(new InfrastructureRequiredRoleReorientCommand(
268                                        req));
269                case SinkRoleEditPart.VISUAL_ID:
270                        return getGEFWrapper(new SinkRoleReorientCommand(req));
271                case OperationRequiredRoleEditPart.VISUAL_ID:
272                        return getGEFWrapper(new OperationRequiredRoleReorientCommand(req));
273                case SourceRoleEditPart.VISUAL_ID:
274                        return getGEFWrapper(new SourceRoleReorientCommand(req));
275                }
276                return super.getReorientRelationshipCommand(req);
277        }
278 
279        /**
280         * Returns command to reorient EReference based link. New link target or source
281         * should be the domain model element associated with this node.
282         * 
283         * @generated
284         */
285        protected Command getReorientReferenceRelationshipCommand(
286                        ReorientReferenceRelationshipRequest req) {
287                switch (getVisualID(req)) {
288                case ImplementationComponentTypeParentCompleteComponentTypesEditPart.VISUAL_ID:
289                        return getGEFWrapper(new ImplementationComponentTypeParentCompleteComponentTypesReorientCommand(
290                                        req));
291                case CompleteComponentTypeParentProvidesComponentTypesEditPart.VISUAL_ID:
292                        return getGEFWrapper(new CompleteComponentTypeParentProvidesComponentTypesReorientCommand(
293                                        req));
294                }
295                return super.getReorientReferenceRelationshipCommand(req);
296        }
297 
298}

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