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

nameclass, %method, %block, %line, %
ResourceDemandingSEFFCanonicalEditPolicy.java0%   (0/1)0%   (0/16)0%   (0/1501)0%   (0/423)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ResourceDemandingSEFFCanonicalEditPolicy0%   (0/1)0%   (0/16)0%   (0/1501)0%   (0/423)
ResourceDemandingSEFFCanonicalEditPolicy (): void 0%   (0/1)0%   (0/3)0%   (0/1)
collectAllLinks (View, Map): Collection 0%   (0/1)0%   (0/1167)0%   (0/318)
createConnections (Collection, Map): Collection 0%   (0/1)0%   (0/92)0%   (0/30)
getDefaultFactoryHint (): String 0%   (0/1)0%   (0/2)0%   (0/1)
getDiagram (): Diagram 0%   (0/1)0%   (0/6)0%   (0/1)
getEditPart (EObject, Map): EditPart 0%   (0/1)0%   (0/17)0%   (0/5)
getFeaturesToSynchronize (): Set 0%   (0/1)0%   (0/17)0%   (0/5)
getSemanticChildrenList (): List 0%   (0/1)0%   (0/26)0%   (0/8)
getSemanticConnectionsList (): List 0%   (0/1)0%   (0/2)0%   (0/1)
getSourceElement (EObject): EObject 0%   (0/1)0%   (0/2)0%   (0/1)
getTargetElement (EObject): EObject 0%   (0/1)0%   (0/2)0%   (0/1)
isOrphaned (Collection, View): boolean 0%   (0/1)0%   (0/14)0%   (0/5)
refreshConnections (): Collection 0%   (0/1)0%   (0/96)0%   (0/32)
refreshSemantic (): void 0%   (0/1)0%   (0/51)0%   (0/12)
shouldDeleteView (View): boolean 0%   (0/1)0%   (0/2)0%   (0/1)
shouldIncludeConnection (Edge, Collection): boolean 0%   (0/1)0%   (0/2)0%   (0/1)

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.Collection;
7import java.util.Collections;
8import java.util.HashMap;
9import java.util.HashSet;
10import java.util.Iterator;
11import java.util.LinkedList;
12import java.util.List;
13import java.util.Map;
14import java.util.Set;
15 
16import org.eclipse.core.runtime.IAdaptable;
17import org.eclipse.emf.ecore.EObject;
18import org.eclipse.gef.EditPart;
19import org.eclipse.gef.commands.Command;
20import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
21import org.eclipse.gmf.runtime.diagram.ui.commands.DeferredLayoutCommand;
22import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
23import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
24import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalConnectionEditPolicy;
25import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest;
26import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
27import org.eclipse.gmf.runtime.notation.Diagram;
28import org.eclipse.gmf.runtime.notation.Edge;
29import org.eclipse.gmf.runtime.notation.View;
30 
31import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.AcquireAction2EditPart;
32import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.AcquireActionEditPart;
33import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.BranchAction2EditPart;
34import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.BranchActionEditPart;
35import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.CollectionIteratorAction2EditPart;
36import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.CollectionIteratorActionEditPart;
37import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.EmitEventAction2EditPart;
38import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.EmitEventActionEditPart;
39import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.ExternalCallAction2EditPart;
40import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.ExternalCallActionEditPart;
41import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.ForkAction2EditPart;
42import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.ForkActionEditPart;
43import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.ForkedBehaviour2EditPart;
44import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.ForkedBehaviourEditPart;
45import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.GuardedBranchTransitionEditPart;
46import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.InfrastructureCallEditPart;
47import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.InternalAction2EditPart;
48import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.InternalActionEditPart;
49import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.LoopAction2EditPart;
50import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.LoopActionEditPart;
51import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.ProbabilisticBranchTransitionEditPart;
52import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.RecoveryAction2EditPart;
53import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.RecoveryActionBehaviourEditPart;
54import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.RecoveryActionEditPart;
55import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.ReleaseAction2EditPart;
56import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.ReleaseActionEditPart;
57import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.ResourceDemandingBehaviour2EditPart;
58import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.ResourceDemandingBehaviour3EditPart;
59import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.ResourceDemandingBehaviour4EditPart;
60import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.ResourceDemandingBehaviourEditPart;
61import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.ResourceDemandingSEFFEditPart;
62import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.SetVariableAction2EditPart;
63import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.SetVariableActionEditPart;
64import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.StartAction2EditPart;
65import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.StartActionEditPart;
66import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.StopAction2EditPart;
67import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.StopActionEditPart;
68import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.SynchronisationPointEditPart;
69import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.VariableUsage2EditPart;
70import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.VariableUsage3EditPart;
71import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.VariableUsage4EditPart;
72import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.VariableUsage5EditPart;
73import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.VariableUsageEditPart;
74import de.uka.ipd.sdq.pcm.gmf.seff.part.PalladioComponentModelDiagramUpdater;
75import de.uka.ipd.sdq.pcm.gmf.seff.part.PalladioComponentModelLinkDescriptor;
76import de.uka.ipd.sdq.pcm.gmf.seff.part.PalladioComponentModelNodeDescriptor;
77import de.uka.ipd.sdq.pcm.gmf.seff.part.PalladioComponentModelVisualIDRegistry;
78import de.uka.ipd.sdq.pcm.seff.SeffPackage;
79 
80/**
81 * @generated
82 */
83public class ResourceDemandingSEFFCanonicalEditPolicy extends
84                CanonicalConnectionEditPolicy {
85 
86        /**
87         * @generated
88         */
89        Set myFeaturesToSynchronize;
90 
91        /**
92         * @generated
93         */
94        protected List getSemanticChildrenList() {
95                View viewObject = (View) getHost().getModel();
96                List result = new LinkedList();
97                for (Iterator it = PalladioComponentModelDiagramUpdater
98                                .getResourceDemandingSEFF_1000SemanticChildren(viewObject)
99                                .iterator(); it.hasNext();) {
100                        result.add(((PalladioComponentModelNodeDescriptor) it.next())
101                                        .getModelElement());
102                }
103                return result;
104        }
105 
106        /**
107         * @generated
108         */
109        protected boolean shouldDeleteView(View view) {
110                return true;
111        }
112 
113        /**
114         * @generated
115         */
116        protected boolean isOrphaned(Collection semanticChildren, final View view) {
117                int visualID = PalladioComponentModelVisualIDRegistry.getVisualID(view);
118                switch (visualID) {
119                case StartActionEditPart.VISUAL_ID:
120                case StopActionEditPart.VISUAL_ID:
121                case ExternalCallActionEditPart.VISUAL_ID:
122                case EmitEventActionEditPart.VISUAL_ID:
123                case LoopActionEditPart.VISUAL_ID:
124                case BranchActionEditPart.VISUAL_ID:
125                case InternalActionEditPart.VISUAL_ID:
126                case CollectionIteratorActionEditPart.VISUAL_ID:
127                case SetVariableActionEditPart.VISUAL_ID:
128                case AcquireActionEditPart.VISUAL_ID:
129                case ReleaseActionEditPart.VISUAL_ID:
130                case ForkActionEditPart.VISUAL_ID:
131                case RecoveryActionEditPart.VISUAL_ID:
132                        if (!semanticChildren.contains(view.getElement())) {
133                                return true;
134                        }
135                }
136                return false;
137        }
138 
139        /**
140         * @generated
141         */
142        protected String getDefaultFactoryHint() {
143                return null;
144        }
145 
146        /**
147         * @generated
148         */
149        protected Set getFeaturesToSynchronize() {
150                if (myFeaturesToSynchronize == null) {
151                        myFeaturesToSynchronize = new HashSet();
152                        myFeaturesToSynchronize.add(SeffPackage.eINSTANCE
153                                        .getResourceDemandingBehaviour_Steps_Behaviour());
154                }
155                return myFeaturesToSynchronize;
156        }
157 
158        /**
159         * @generated
160         */
161        protected List getSemanticConnectionsList() {
162                return Collections.EMPTY_LIST;
163        }
164 
165        /**
166         * @generated
167         */
168        protected EObject getSourceElement(EObject relationship) {
169                return null;
170        }
171 
172        /**
173         * @generated
174         */
175        protected EObject getTargetElement(EObject relationship) {
176                return null;
177        }
178 
179        /**
180         * @generated
181         */
182        protected boolean shouldIncludeConnection(Edge connector,
183                        Collection children) {
184                return false;
185        }
186 
187        /**
188         * @generated
189         */
190        protected void refreshSemantic() {
191                List createdViews = new LinkedList();
192                createdViews.addAll(refreshSemanticChildren());
193                List createdConnectionViews = new LinkedList();
194                createdConnectionViews.addAll(refreshSemanticConnections());
195                createdConnectionViews.addAll(refreshConnections());
196 
197                if (createdViews.size() > 1) {
198                        // perform a layout of the container
199                        DeferredLayoutCommand layoutCmd = new DeferredLayoutCommand(host()
200                                        .getEditingDomain(), createdViews, host());
201                        executeCommand(new ICommandProxy(layoutCmd));
202                }
203 
204                createdViews.addAll(createdConnectionViews);
205                makeViewsImmutable(createdViews);
206        }
207 
208        /**
209         * @generated
210         */
211        private Collection refreshConnections() {
212                Map domain2NotationMap = new HashMap();
213                Collection linkDescriptors = collectAllLinks(getDiagram(),
214                                domain2NotationMap);
215                Collection existingLinks = new LinkedList(getDiagram().getEdges());
216                for (Iterator linksIterator = existingLinks.iterator(); linksIterator
217                                .hasNext();) {
218                        Edge nextDiagramLink = (Edge) linksIterator.next();
219                        int diagramLinkVisualID = PalladioComponentModelVisualIDRegistry
220                                        .getVisualID(nextDiagramLink);
221                        if (diagramLinkVisualID == -1) {
222                                if (nextDiagramLink.getSource() != null
223                                                && nextDiagramLink.getTarget() != null) {
224                                        linksIterator.remove();
225                                }
226                                continue;
227                        }
228                        EObject diagramLinkObject = nextDiagramLink.getElement();
229                        EObject diagramLinkSrc = nextDiagramLink.getSource().getElement();
230                        EObject diagramLinkDst = nextDiagramLink.getTarget().getElement();
231                        for (Iterator linkDescriptorsIterator = linkDescriptors.iterator(); linkDescriptorsIterator
232                                        .hasNext();) {
233                                PalladioComponentModelLinkDescriptor nextLinkDescriptor = (PalladioComponentModelLinkDescriptor) linkDescriptorsIterator
234                                                .next();
235                                if (diagramLinkObject == nextLinkDescriptor.getModelElement()
236                                                && diagramLinkSrc == nextLinkDescriptor.getSource()
237                                                && diagramLinkDst == nextLinkDescriptor
238                                                                .getDestination()
239                                                && diagramLinkVisualID == nextLinkDescriptor
240                                                                .getVisualID()) {
241                                        linksIterator.remove();
242                                        linkDescriptorsIterator.remove();
243                                        break;
244                                }
245                        }
246                }
247                deleteViews(existingLinks.iterator());
248                return createConnections(linkDescriptors, domain2NotationMap);
249        }
250 
251        /**
252         * @generated
253         */
254        private Collection collectAllLinks(View view, Map domain2NotationMap) {
255                if (!ResourceDemandingSEFFEditPart.MODEL_ID
256                                .equals(PalladioComponentModelVisualIDRegistry.getModelID(view))) {
257                        return Collections.EMPTY_LIST;
258                }
259                Collection result = new LinkedList();
260                switch (PalladioComponentModelVisualIDRegistry.getVisualID(view)) {
261                case ResourceDemandingSEFFEditPart.VISUAL_ID: {
262                        if (!domain2NotationMap.containsKey(view.getElement())) {
263                                result.addAll(PalladioComponentModelDiagramUpdater
264                                                .getResourceDemandingSEFF_1000ContainedLinks(view));
265                        }
266                        if (!domain2NotationMap.containsKey(view.getElement())
267                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
268                                domain2NotationMap.put(view.getElement(), view);
269                        }
270                        break;
271                }
272                case StartActionEditPart.VISUAL_ID: {
273                        if (!domain2NotationMap.containsKey(view.getElement())) {
274                                result.addAll(PalladioComponentModelDiagramUpdater
275                                                .getStartAction_2001ContainedLinks(view));
276                        }
277                        if (!domain2NotationMap.containsKey(view.getElement())
278                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
279                                domain2NotationMap.put(view.getElement(), view);
280                        }
281                        break;
282                }
283                case StopActionEditPart.VISUAL_ID: {
284                        if (!domain2NotationMap.containsKey(view.getElement())) {
285                                result.addAll(PalladioComponentModelDiagramUpdater
286                                                .getStopAction_2002ContainedLinks(view));
287                        }
288                        if (!domain2NotationMap.containsKey(view.getElement())
289                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
290                                domain2NotationMap.put(view.getElement(), view);
291                        }
292                        break;
293                }
294                case ExternalCallActionEditPart.VISUAL_ID: {
295                        if (!domain2NotationMap.containsKey(view.getElement())) {
296                                result.addAll(PalladioComponentModelDiagramUpdater
297                                                .getExternalCallAction_2003ContainedLinks(view));
298                        }
299                        if (!domain2NotationMap.containsKey(view.getElement())
300                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
301                                domain2NotationMap.put(view.getElement(), view);
302                        }
303                        break;
304                }
305                case EmitEventActionEditPart.VISUAL_ID: {
306                        if (!domain2NotationMap.containsKey(view.getElement())) {
307                                result.addAll(PalladioComponentModelDiagramUpdater
308                                                .getEmitEventAction_2013ContainedLinks(view));
309                        }
310                        if (!domain2NotationMap.containsKey(view.getElement())
311                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
312                                domain2NotationMap.put(view.getElement(), view);
313                        }
314                        break;
315                }
316                case LoopActionEditPart.VISUAL_ID: {
317                        if (!domain2NotationMap.containsKey(view.getElement())) {
318                                result.addAll(PalladioComponentModelDiagramUpdater
319                                                .getLoopAction_2004ContainedLinks(view));
320                        }
321                        if (!domain2NotationMap.containsKey(view.getElement())
322                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
323                                domain2NotationMap.put(view.getElement(), view);
324                        }
325                        break;
326                }
327                case BranchActionEditPart.VISUAL_ID: {
328                        if (!domain2NotationMap.containsKey(view.getElement())) {
329                                result.addAll(PalladioComponentModelDiagramUpdater
330                                                .getBranchAction_2005ContainedLinks(view));
331                        }
332                        if (!domain2NotationMap.containsKey(view.getElement())
333                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
334                                domain2NotationMap.put(view.getElement(), view);
335                        }
336                        break;
337                }
338                case InternalActionEditPart.VISUAL_ID: {
339                        if (!domain2NotationMap.containsKey(view.getElement())) {
340                                result.addAll(PalladioComponentModelDiagramUpdater
341                                                .getInternalAction_2006ContainedLinks(view));
342                        }
343                        if (!domain2NotationMap.containsKey(view.getElement())
344                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
345                                domain2NotationMap.put(view.getElement(), view);
346                        }
347                        break;
348                }
349                case CollectionIteratorActionEditPart.VISUAL_ID: {
350                        if (!domain2NotationMap.containsKey(view.getElement())) {
351                                result.addAll(PalladioComponentModelDiagramUpdater
352                                                .getCollectionIteratorAction_2007ContainedLinks(view));
353                        }
354                        if (!domain2NotationMap.containsKey(view.getElement())
355                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
356                                domain2NotationMap.put(view.getElement(), view);
357                        }
358                        break;
359                }
360                case SetVariableActionEditPart.VISUAL_ID: {
361                        if (!domain2NotationMap.containsKey(view.getElement())) {
362                                result.addAll(PalladioComponentModelDiagramUpdater
363                                                .getSetVariableAction_2008ContainedLinks(view));
364                        }
365                        if (!domain2NotationMap.containsKey(view.getElement())
366                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
367                                domain2NotationMap.put(view.getElement(), view);
368                        }
369                        break;
370                }
371                case AcquireActionEditPart.VISUAL_ID: {
372                        if (!domain2NotationMap.containsKey(view.getElement())) {
373                                result.addAll(PalladioComponentModelDiagramUpdater
374                                                .getAcquireAction_2012ContainedLinks(view));
375                        }
376                        if (!domain2NotationMap.containsKey(view.getElement())
377                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
378                                domain2NotationMap.put(view.getElement(), view);
379                        }
380                        break;
381                }
382                case ReleaseActionEditPart.VISUAL_ID: {
383                        if (!domain2NotationMap.containsKey(view.getElement())) {
384                                result.addAll(PalladioComponentModelDiagramUpdater
385                                                .getReleaseAction_2010ContainedLinks(view));
386                        }
387                        if (!domain2NotationMap.containsKey(view.getElement())
388                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
389                                domain2NotationMap.put(view.getElement(), view);
390                        }
391                        break;
392                }
393                case ForkActionEditPart.VISUAL_ID: {
394                        if (!domain2NotationMap.containsKey(view.getElement())) {
395                                result.addAll(PalladioComponentModelDiagramUpdater
396                                                .getForkAction_2011ContainedLinks(view));
397                        }
398                        if (!domain2NotationMap.containsKey(view.getElement())
399                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
400                                domain2NotationMap.put(view.getElement(), view);
401                        }
402                        break;
403                }
404                case RecoveryActionEditPart.VISUAL_ID: {
405                        if (!domain2NotationMap.containsKey(view.getElement())) {
406                                result.addAll(PalladioComponentModelDiagramUpdater
407                                                .getRecoveryAction_2016ContainedLinks(view));
408                        }
409                        if (!domain2NotationMap.containsKey(view.getElement())
410                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
411                                domain2NotationMap.put(view.getElement(), view);
412                        }
413                        break;
414                }
415                case VariableUsageEditPart.VISUAL_ID: {
416                        if (!domain2NotationMap.containsKey(view.getElement())) {
417                                result.addAll(PalladioComponentModelDiagramUpdater
418                                                .getVariableUsage_3042ContainedLinks(view));
419                        }
420                        if (!domain2NotationMap.containsKey(view.getElement())
421                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
422                                domain2NotationMap.put(view.getElement(), view);
423                        }
424                        break;
425                }
426                case VariableUsage2EditPart.VISUAL_ID: {
427                        if (!domain2NotationMap.containsKey(view.getElement())) {
428                                result.addAll(PalladioComponentModelDiagramUpdater
429                                                .getVariableUsage_3049ContainedLinks(view));
430                        }
431                        if (!domain2NotationMap.containsKey(view.getElement())
432                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
433                                domain2NotationMap.put(view.getElement(), view);
434                        }
435                        break;
436                }
437                case VariableUsage4EditPart.VISUAL_ID: {
438                        if (!domain2NotationMap.containsKey(view.getElement())) {
439                                result.addAll(PalladioComponentModelDiagramUpdater
440                                                .getVariableUsage_3047ContainedLinks(view));
441                        }
442                        if (!domain2NotationMap.containsKey(view.getElement())
443                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
444                                domain2NotationMap.put(view.getElement(), view);
445                        }
446                        break;
447                }
448                case ResourceDemandingBehaviourEditPart.VISUAL_ID: {
449                        if (!domain2NotationMap.containsKey(view.getElement())) {
450                                result
451                                                .addAll(PalladioComponentModelDiagramUpdater
452                                                                .getResourceDemandingBehaviour_3003ContainedLinks(view));
453                        }
454                        if (!domain2NotationMap.containsKey(view.getElement())
455                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
456                                domain2NotationMap.put(view.getElement(), view);
457                        }
458                        break;
459                }
460                case StartAction2EditPart.VISUAL_ID: {
461                        if (!domain2NotationMap.containsKey(view.getElement())) {
462                                result.addAll(PalladioComponentModelDiagramUpdater
463                                                .getStartAction_3004ContainedLinks(view));
464                        }
465                        if (!domain2NotationMap.containsKey(view.getElement())
466                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
467                                domain2NotationMap.put(view.getElement(), view);
468                        }
469                        break;
470                }
471                case StopAction2EditPart.VISUAL_ID: {
472                        if (!domain2NotationMap.containsKey(view.getElement())) {
473                                result.addAll(PalladioComponentModelDiagramUpdater
474                                                .getStopAction_3005ContainedLinks(view));
475                        }
476                        if (!domain2NotationMap.containsKey(view.getElement())
477                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
478                                domain2NotationMap.put(view.getElement(), view);
479                        }
480                        break;
481                }
482                case LoopAction2EditPart.VISUAL_ID: {
483                        if (!domain2NotationMap.containsKey(view.getElement())) {
484                                result.addAll(PalladioComponentModelDiagramUpdater
485                                                .getLoopAction_3006ContainedLinks(view));
486                        }
487                        if (!domain2NotationMap.containsKey(view.getElement())
488                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
489                                domain2NotationMap.put(view.getElement(), view);
490                        }
491                        break;
492                }
493                case InternalAction2EditPart.VISUAL_ID: {
494                        if (!domain2NotationMap.containsKey(view.getElement())) {
495                                result.addAll(PalladioComponentModelDiagramUpdater
496                                                .getInternalAction_3007ContainedLinks(view));
497                        }
498                        if (!domain2NotationMap.containsKey(view.getElement())
499                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
500                                domain2NotationMap.put(view.getElement(), view);
501                        }
502                        break;
503                }
504                case InfrastructureCallEditPart.VISUAL_ID: {
505                        if (!domain2NotationMap.containsKey(view.getElement())) {
506                                result.addAll(PalladioComponentModelDiagramUpdater
507                                                .getInfrastructureCall_3053ContainedLinks(view));
508                        }
509                        if (!domain2NotationMap.containsKey(view.getElement())
510                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
511                                domain2NotationMap.put(view.getElement(), view);
512                        }
513                        break;
514                }
515                case VariableUsage5EditPart.VISUAL_ID: {
516                        if (!domain2NotationMap.containsKey(view.getElement())) {
517                                result.addAll(PalladioComponentModelDiagramUpdater
518                                                .getVariableUsage_3054ContainedLinks(view));
519                        }
520                        if (!domain2NotationMap.containsKey(view.getElement())
521                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
522                                domain2NotationMap.put(view.getElement(), view);
523                        }
524                        break;
525                }
526                case BranchAction2EditPart.VISUAL_ID: {
527                        if (!domain2NotationMap.containsKey(view.getElement())) {
528                                result.addAll(PalladioComponentModelDiagramUpdater
529                                                .getBranchAction_3009ContainedLinks(view));
530                        }
531                        if (!domain2NotationMap.containsKey(view.getElement())
532                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
533                                domain2NotationMap.put(view.getElement(), view);
534                        }
535                        break;
536                }
537                case ProbabilisticBranchTransitionEditPart.VISUAL_ID: {
538                        if (!domain2NotationMap.containsKey(view.getElement())) {
539                                result
540                                                .addAll(PalladioComponentModelDiagramUpdater
541                                                                .getProbabilisticBranchTransition_3010ContainedLinks(view));
542                        }
543                        if (!domain2NotationMap.containsKey(view.getElement())
544                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
545                                domain2NotationMap.put(view.getElement(), view);
546                        }
547                        break;
548                }
549                case ResourceDemandingBehaviour2EditPart.VISUAL_ID: {
550                        if (!domain2NotationMap.containsKey(view.getElement())) {
551                                result
552                                                .addAll(PalladioComponentModelDiagramUpdater
553                                                                .getResourceDemandingBehaviour_3011ContainedLinks(view));
554                        }
555                        if (!domain2NotationMap.containsKey(view.getElement())
556                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
557                                domain2NotationMap.put(view.getElement(), view);
558                        }
559                        break;
560                }
561                case ExternalCallAction2EditPart.VISUAL_ID: {
562                        if (!domain2NotationMap.containsKey(view.getElement())) {
563                                result.addAll(PalladioComponentModelDiagramUpdater
564                                                .getExternalCallAction_3012ContainedLinks(view));
565                        }
566                        if (!domain2NotationMap.containsKey(view.getElement())
567                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
568                                domain2NotationMap.put(view.getElement(), view);
569                        }
570                        break;
571                }
572                case EmitEventAction2EditPart.VISUAL_ID: {
573                        if (!domain2NotationMap.containsKey(view.getElement())) {
574                                result.addAll(PalladioComponentModelDiagramUpdater
575                                                .getEmitEventAction_3046ContainedLinks(view));
576                        }
577                        if (!domain2NotationMap.containsKey(view.getElement())
578                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
579                                domain2NotationMap.put(view.getElement(), view);
580                        }
581                        break;
582                }
583                case AcquireAction2EditPart.VISUAL_ID: {
584                        if (!domain2NotationMap.containsKey(view.getElement())) {
585                                result.addAll(PalladioComponentModelDiagramUpdater
586                                                .getAcquireAction_3026ContainedLinks(view));
587                        }
588                        if (!domain2NotationMap.containsKey(view.getElement())
589                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
590                                domain2NotationMap.put(view.getElement(), view);
591                        }
592                        break;
593                }
594                case ReleaseAction2EditPart.VISUAL_ID: {
595                        if (!domain2NotationMap.containsKey(view.getElement())) {
596                                result.addAll(PalladioComponentModelDiagramUpdater
597                                                .getReleaseAction_3020ContainedLinks(view));
598                        }
599                        if (!domain2NotationMap.containsKey(view.getElement())
600                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
601                                domain2NotationMap.put(view.getElement(), view);
602                        }
603                        break;
604                }
605                case ForkAction2EditPart.VISUAL_ID: {
606                        if (!domain2NotationMap.containsKey(view.getElement())) {
607                                result.addAll(PalladioComponentModelDiagramUpdater
608                                                .getForkAction_3023ContainedLinks(view));
609                        }
610                        if (!domain2NotationMap.containsKey(view.getElement())
611                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
612                                domain2NotationMap.put(view.getElement(), view);
613                        }
614                        break;
615                }
616                case ForkedBehaviourEditPart.VISUAL_ID: {
617                        if (!domain2NotationMap.containsKey(view.getElement())) {
618                                result.addAll(PalladioComponentModelDiagramUpdater
619                                                .getForkedBehaviour_3027ContainedLinks(view));
620                        }
621                        if (!domain2NotationMap.containsKey(view.getElement())
622                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
623                                domain2NotationMap.put(view.getElement(), view);
624                        }
625                        break;
626                }
627                case CollectionIteratorAction2EditPart.VISUAL_ID: {
628                        if (!domain2NotationMap.containsKey(view.getElement())) {
629                                result.addAll(PalladioComponentModelDiagramUpdater
630                                                .getCollectionIteratorAction_3013ContainedLinks(view));
631                        }
632                        if (!domain2NotationMap.containsKey(view.getElement())
633                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
634                                domain2NotationMap.put(view.getElement(), view);
635                        }
636                        break;
637                }
638                case ResourceDemandingBehaviour3EditPart.VISUAL_ID: {
639                        if (!domain2NotationMap.containsKey(view.getElement())) {
640                                result
641                                                .addAll(PalladioComponentModelDiagramUpdater
642                                                                .getResourceDemandingBehaviour_3014ContainedLinks(view));
643                        }
644                        if (!domain2NotationMap.containsKey(view.getElement())
645                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
646                                domain2NotationMap.put(view.getElement(), view);
647                        }
648                        break;
649                }
650                case RecoveryAction2EditPart.VISUAL_ID: {
651                        if (!domain2NotationMap.containsKey(view.getElement())) {
652                                result.addAll(PalladioComponentModelDiagramUpdater
653                                                .getRecoveryAction_3057ContainedLinks(view));
654                        }
655                        if (!domain2NotationMap.containsKey(view.getElement())
656                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
657                                domain2NotationMap.put(view.getElement(), view);
658                        }
659                        break;
660                }
661                case RecoveryActionBehaviourEditPart.VISUAL_ID: {
662                        if (!domain2NotationMap.containsKey(view.getElement())) {
663                                result.addAll(PalladioComponentModelDiagramUpdater
664                                                .getRecoveryActionBehaviour_3058ContainedLinks(view));
665                        }
666                        if (!domain2NotationMap.containsKey(view.getElement())
667                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
668                                domain2NotationMap.put(view.getElement(), view);
669                        }
670                        break;
671                }
672                case SetVariableAction2EditPart.VISUAL_ID: {
673                        if (!domain2NotationMap.containsKey(view.getElement())) {
674                                result.addAll(PalladioComponentModelDiagramUpdater
675                                                .getSetVariableAction_3024ContainedLinks(view));
676                        }
677                        if (!domain2NotationMap.containsKey(view.getElement())
678                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
679                                domain2NotationMap.put(view.getElement(), view);
680                        }
681                        break;
682                }
683                case VariableUsage3EditPart.VISUAL_ID: {
684                        if (!domain2NotationMap.containsKey(view.getElement())) {
685                                result.addAll(PalladioComponentModelDiagramUpdater
686                                                .getVariableUsage_3036ContainedLinks(view));
687                        }
688                        if (!domain2NotationMap.containsKey(view.getElement())
689                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
690                                domain2NotationMap.put(view.getElement(), view);
691                        }
692                        break;
693                }
694                case SynchronisationPointEditPart.VISUAL_ID: {
695                        if (!domain2NotationMap.containsKey(view.getElement())) {
696                                result.addAll(PalladioComponentModelDiagramUpdater
697                                                .getSynchronisationPoint_3038ContainedLinks(view));
698                        }
699                        if (!domain2NotationMap.containsKey(view.getElement())
700                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
701                                domain2NotationMap.put(view.getElement(), view);
702                        }
703                        break;
704                }
705                case ForkedBehaviour2EditPart.VISUAL_ID: {
706                        if (!domain2NotationMap.containsKey(view.getElement())) {
707                                result.addAll(PalladioComponentModelDiagramUpdater
708                                                .getForkedBehaviour_3039ContainedLinks(view));
709                        }
710                        if (!domain2NotationMap.containsKey(view.getElement())
711                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
712                                domain2NotationMap.put(view.getElement(), view);
713                        }
714                        break;
715                }
716                case GuardedBranchTransitionEditPart.VISUAL_ID: {
717                        if (!domain2NotationMap.containsKey(view.getElement())) {
718                                result.addAll(PalladioComponentModelDiagramUpdater
719                                                .getGuardedBranchTransition_3017ContainedLinks(view));
720                        }
721                        if (!domain2NotationMap.containsKey(view.getElement())
722                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
723                                domain2NotationMap.put(view.getElement(), view);
724                        }
725                        break;
726                }
727                case ResourceDemandingBehaviour4EditPart.VISUAL_ID: {
728                        if (!domain2NotationMap.containsKey(view.getElement())) {
729                                result
730                                                .addAll(PalladioComponentModelDiagramUpdater
731                                                                .getResourceDemandingBehaviour_3018ContainedLinks(view));
732                        }
733                        if (!domain2NotationMap.containsKey(view.getElement())
734                                        || view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
735                                domain2NotationMap.put(view.getElement(), view);
736                        }
737                        break;
738                }
739                }
740                for (Iterator children = view.getChildren().iterator(); children
741                                .hasNext();) {
742                        result.addAll(collectAllLinks((View) children.next(),
743                                        domain2NotationMap));
744                }
745                for (Iterator edges = view.getSourceEdges().iterator(); edges.hasNext();) {
746                        result.addAll(collectAllLinks((View) edges.next(),
747                                        domain2NotationMap));
748                }
749                return result;
750        }
751 
752        /**
753         * @generated
754         */
755        private Collection createConnections(Collection linkDescriptors,
756                        Map domain2NotationMap) {
757                List adapters = new LinkedList();
758                for (Iterator linkDescriptorsIterator = linkDescriptors.iterator(); linkDescriptorsIterator
759                                .hasNext();) {
760                        final PalladioComponentModelLinkDescriptor nextLinkDescriptor = (PalladioComponentModelLinkDescriptor) linkDescriptorsIterator
761                                        .next();
762                        EditPart sourceEditPart = getEditPart(nextLinkDescriptor
763                                        .getSource(), domain2NotationMap);
764                        EditPart targetEditPart = getEditPart(nextLinkDescriptor
765                                        .getDestination(), domain2NotationMap);
766                        if (sourceEditPart == null || targetEditPart == null) {
767                                continue;
768                        }
769                        CreateConnectionViewRequest.ConnectionViewDescriptor descriptor = new CreateConnectionViewRequest.ConnectionViewDescriptor(
770                                        nextLinkDescriptor.getSemanticAdapter(), String
771                                                        .valueOf(nextLinkDescriptor.getVisualID()),
772                                        ViewUtil.APPEND, false, ((IGraphicalEditPart) getHost())
773                                                        .getDiagramPreferencesHint());
774                        CreateConnectionViewRequest ccr = new CreateConnectionViewRequest(
775                                        descriptor);
776                        ccr.setType(RequestConstants.REQ_CONNECTION_START);
777                        ccr.setSourceEditPart(sourceEditPart);
778                        sourceEditPart.getCommand(ccr);
779                        ccr.setTargetEditPart(targetEditPart);
780                        ccr.setType(RequestConstants.REQ_CONNECTION_END);
781                        Command cmd = targetEditPart.getCommand(ccr);
782                        if (cmd != null && cmd.canExecute()) {
783                                executeCommand(cmd);
784                                IAdaptable viewAdapter = (IAdaptable) ccr.getNewObject();
785                                if (viewAdapter != null) {
786                                        adapters.add(viewAdapter);
787                                }
788                        }
789                }
790                return adapters;
791        }
792 
793        /**
794         * @generated
795         */
796        private EditPart getEditPart(EObject domainModelElement,
797                        Map domain2NotationMap) {
798                View view = (View) domain2NotationMap.get(domainModelElement);
799                if (view != null) {
800                        return (EditPart) getHost().getViewer().getEditPartRegistry().get(
801                                        view);
802                }
803                return null;
804        }
805 
806        /**
807         * @generated
808         */
809        private Diagram getDiagram() {
810                return ((View) getHost().getModel()).getDiagram();
811        }
812 
813}

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