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

nameclass, %method, %block, %line, %
ProvidesComponentTypeItemSemanticEditPolicy.java0%   (0/1)0%   (0/7)0%   (0/493)0%   (0/133)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ProvidesComponentTypeItemSemanticEditPolicy0%   (0/1)0%   (0/7)0%   (0/493)0%   (0/133)
ProvidesComponentTypeItemSemanticEditPolicy (): void 0%   (0/1)0%   (0/4)0%   (0/2)
getCompleteCreateRelationshipCommand (CreateRelationshipRequest): Command 0%   (0/1)0%   (0/53)0%   (0/23)
getCreateRelationshipCommand (CreateRelationshipRequest): Command 0%   (0/1)0%   (0/19)0%   (0/4)
getDestroyElementCommand (DestroyElementRequest): Command 0%   (0/1)0%   (0/254)0%   (0/62)
getReorientReferenceRelationshipCommand (ReorientReferenceRelationshipRequest... 0%   (0/1)0%   (0/15)0%   (0/4)
getReorientRelationshipCommand (ReorientRelationshipRequest): Command 0%   (0/1)0%   (0/50)0%   (0/10)
getStartCreateRelationshipCommand (CreateRelationshipRequest): Command 0%   (0/1)0%   (0/98)0%   (0/28)

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

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