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

nameclass, %method, %block, %line, %
CompositeComponentItemSemanticEditPolicy.java0%   (0/1)0%   (0/7)0%   (0/482)0%   (0/132)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class CompositeComponentItemSemanticEditPolicy0%   (0/1)0%   (0/7)0%   (0/482)0%   (0/132)
CompositeComponentItemSemanticEditPolicy (): void 0%   (0/1)0%   (0/4)0%   (0/2)
getCompleteCreateRelationshipCommand (CreateRelationshipRequest): Command 0%   (0/1)0%   (0/44)0%   (0/22)
getCreateRelationshipCommand (CreateRelationshipRequest): Command 0%   (0/1)0%   (0/19)0%   (0/4)
getDestroyElementCommand (DestroyElementRequest): Command 0%   (0/1)0%   (0/243)0%   (0/61)
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/107)0%   (0/29)

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

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