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

COVERAGE SUMMARY FOR SOURCE FILE [PalladioComponentModelNavigatorContentProvider.java]

nameclass, %method, %block, %line, %
PalladioComponentModelNavigatorContentProvider.java0%   (0/4)0%   (0/33)0%   (0/1758)0%   (0/540)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class PalladioComponentModelNavigatorContentProvider0%   (0/1)0%   (0/24)0%   (0/1621)0%   (0/508)
<static initializer> 0%   (0/1)0%   (0/4)0%   (0/2)
PalladioComponentModelNavigatorContentProvider (): void 0%   (0/1)0%   (0/33)0%   (0/9)
access$0 (PalladioComponentModelNavigatorContentProvider): Viewer 0%   (0/1)0%   (0/3)0%   (0/1)
access$1 (PalladioComponentModelNavigatorContentProvider): AdapterFactoryEdit... 0%   (0/1)0%   (0/3)0%   (0/1)
access$2 (PalladioComponentModelNavigatorContentProvider): Runnable 0%   (0/1)0%   (0/3)0%   (0/1)
createNavigatorItems (Collection, Object, boolean): Collection 0%   (0/1)0%   (0/24)0%   (0/5)
dispose (): void 0%   (0/1)0%   (0/33)0%   (0/10)
getChildren (Object): Object [] 0%   (0/1)0%   (0/71)0%   (0/20)
getChildrenByType (Collection, String): Collection 0%   (0/1)0%   (0/25)0%   (0/5)
getDiagramLinksByType (Collection, String): Collection 0%   (0/1)0%   (0/25)0%   (0/5)
getElements (Object): Object [] 0%   (0/1)0%   (0/4)0%   (0/1)
getIncomingLinksByType (Collection, String): Collection 0%   (0/1)0%   (0/25)0%   (0/5)
getLinksSourceByType (Collection, String): Collection 0%   (0/1)0%   (0/33)0%   (0/8)
getLinksTargetByType (Collection, String): Collection 0%   (0/1)0%   (0/33)0%   (0/8)
getOutgoingLinksByType (Collection, String): Collection 0%   (0/1)0%   (0/25)0%   (0/5)
getParent (Object): Object 0%   (0/1)0%   (0/11)0%   (0/4)
getViewChildren (View, Object): Object [] 0%   (0/1)0%   (0/1212)0%   (0/404)
hasChildren (Object): boolean 0%   (0/1)0%   (0/12)0%   (0/1)
init (ICommonContentExtensionSite): void 0%   (0/1)0%   (0/1)0%   (0/1)
inputChanged (Viewer, Object, Object): void 0%   (0/1)0%   (0/4)0%   (0/2)
isOwnView (View): boolean 0%   (0/1)0%   (0/5)0%   (0/2)
restoreState (IMemento): void 0%   (0/1)0%   (0/1)0%   (0/1)
saveState (IMemento): void 0%   (0/1)0%   (0/1)0%   (0/1)
selectViewsByType (Collection, String): Collection 0%   (0/1)0%   (0/30)0%   (0/6)
     
class PalladioComponentModelNavigatorContentProvider$10%   (0/1)0%   (0/2)0%   (0/19)0%   (0/5)
PalladioComponentModelNavigatorContentProvider$1 (PalladioComponentModelNavig... 0%   (0/1)0%   (0/6)0%   (0/2)
get (Object): Object 0%   (0/1)0%   (0/13)0%   (0/3)
     
class PalladioComponentModelNavigatorContentProvider$20%   (0/1)0%   (0/2)0%   (0/15)0%   (0/5)
PalladioComponentModelNavigatorContentProvider$2 (PalladioComponentModelNavig... 0%   (0/1)0%   (0/6)0%   (0/2)
run (): void 0%   (0/1)0%   (0/9)0%   (0/3)
     
class PalladioComponentModelNavigatorContentProvider$30%   (0/1)0%   (0/5)0%   (0/103)0%   (0/27)
PalladioComponentModelNavigatorContentProvider$3 (PalladioComponentModelNavig... 0%   (0/1)0%   (0/6)0%   (0/2)
dispose (): void 0%   (0/1)0%   (0/1)0%   (0/1)
handleResourceChanged (Resource): boolean 0%   (0/1)0%   (0/32)0%   (0/8)
handleResourceDeleted (Resource): boolean 0%   (0/1)0%   (0/32)0%   (0/8)
handleResourceMoved (Resource, URI): boolean 0%   (0/1)0%   (0/32)0%   (0/8)

1/*
2 * Copyright 2007, SDQ, IPD, University of Karlsruhe
3 */
4package de.uka.ipd.sdq.pcm.gmf.usage.navigator;
5 
6import java.util.ArrayList;
7import java.util.Collection;
8import java.util.Collections;
9import java.util.HashMap;
10import java.util.Iterator;
11 
12import org.eclipse.core.resources.IFile;
13import org.eclipse.emf.common.util.URI;
14import org.eclipse.emf.ecore.resource.Resource;
15import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
16import org.eclipse.emf.transaction.TransactionalEditingDomain;
17import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
18import org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory;
19import org.eclipse.gmf.runtime.notation.Diagram;
20import org.eclipse.gmf.runtime.notation.Edge;
21import org.eclipse.gmf.runtime.notation.View;
22import org.eclipse.jface.viewers.Viewer;
23import org.eclipse.ui.IMemento;
24import org.eclipse.ui.navigator.ICommonContentExtensionSite;
25import org.eclipse.ui.navigator.ICommonContentProvider;
26 
27import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.AbstractUserActionSuccessorEditPart;
28import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.BranchEditPart;
29import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.BranchTransitionEditPart;
30import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.BranchUsageBranchTransitionsCompartmentEditPart;
31import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.ClosedWorkloadEditPart;
32import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.DelayEditPart;
33import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.EntryLevelSystemCallEditPart;
34import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.EntryLevelSystemCallParameterUsageEditPart;
35import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.LoopEditPart;
36import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.OpenWorkloadEditPart;
37import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.ScenarioBehaviour2EditPart;
38import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.ScenarioBehaviour3EditPart;
39import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.ScenarioBehaviourEditPart;
40import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.ScenarioBehaviourScenarioBehaviourStepsCompartment2EditPart;
41import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.ScenarioBehaviourScenarioBehaviourStepsCompartment3EditPart;
42import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.ScenarioBehaviourScenarioBehaviourStepsCompartmentEditPart;
43import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.StartEditPart;
44import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.StopEditPart;
45import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.UsageScenario2EditPart;
46import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.UsageScenarioEditPart;
47import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.UsageScenarioUsageScenarioCompartmentEditPart;
48import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.VariableCharacterisationEditPart;
49import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.VariableUsageEditPart;
50import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.VariableUsageVariableCharacterisationEditPart;
51import de.uka.ipd.sdq.pcm.gmf.usage.part.Messages;
52import de.uka.ipd.sdq.pcm.gmf.usage.part.PalladioComponentModelVisualIDRegistry;
53 
54/**
55 * @generated
56 */
57public class PalladioComponentModelNavigatorContentProvider implements
58                ICommonContentProvider {
59 
60        /**
61         * @generated
62         */
63        private static final Object[] EMPTY_ARRAY = new Object[0];
64 
65        /**
66         * @generated
67         */
68        private Viewer myViewer;
69        /**
70         * @generated
71         */
72        private AdapterFactoryEditingDomain myEditingDomain;
73        /**
74         * @generated
75         */
76        private WorkspaceSynchronizer myWorkspaceSynchronizer;
77        /**
78         * @generated
79         */
80        private Runnable myViewerRefreshRunnable;
81 
82        /**
83         * @generated
84         */
85        public PalladioComponentModelNavigatorContentProvider() {
86                TransactionalEditingDomain editingDomain = GMFEditingDomainFactory.INSTANCE
87                                .createEditingDomain();
88                myEditingDomain = (AdapterFactoryEditingDomain) editingDomain;
89                myEditingDomain.setResourceToReadOnlyMap(new HashMap() {
90                        public Object get(Object key) {
91                                if (!containsKey(key)) {
92                                        put(key, Boolean.TRUE);
93                                }
94                                return super.get(key);
95                        }
96                });
97                myViewerRefreshRunnable = new Runnable() {
98                        public void run() {
99                                if (myViewer != null) {
100                                        myViewer.refresh();
101                                }
102                        }
103                };
104                myWorkspaceSynchronizer = new WorkspaceSynchronizer(editingDomain,
105                                new WorkspaceSynchronizer.Delegate() {
106                                        public void dispose() {
107                                        }
108 
109                                        public boolean handleResourceChanged(final Resource resource) {
110                                                for (Iterator it = myEditingDomain.getResourceSet()
111                                                                .getResources().iterator(); it.hasNext();) {
112                                                        Resource nextResource = (Resource) it.next();
113                                                        nextResource.unload();
114                                                }
115                                                if (myViewer != null) {
116                                                        myViewer.getControl().getDisplay().asyncExec(
117                                                                        myViewerRefreshRunnable);
118                                                }
119                                                return true;
120                                        }
121 
122                                        public boolean handleResourceDeleted(Resource resource) {
123                                                for (Iterator it = myEditingDomain.getResourceSet()
124                                                                .getResources().iterator(); it.hasNext();) {
125                                                        Resource nextResource = (Resource) it.next();
126                                                        nextResource.unload();
127                                                }
128                                                if (myViewer != null) {
129                                                        myViewer.getControl().getDisplay().asyncExec(
130                                                                        myViewerRefreshRunnable);
131                                                }
132                                                return true;
133                                        }
134 
135                                        public boolean handleResourceMoved(Resource resource,
136                                                        final URI newURI) {
137                                                for (Iterator it = myEditingDomain.getResourceSet()
138                                                                .getResources().iterator(); it.hasNext();) {
139                                                        Resource nextResource = (Resource) it.next();
140                                                        nextResource.unload();
141                                                }
142                                                if (myViewer != null) {
143                                                        myViewer.getControl().getDisplay().asyncExec(
144                                                                        myViewerRefreshRunnable);
145                                                }
146                                                return true;
147                                        }
148                                });
149        }
150 
151        /**
152         * @generated
153         */
154        public void dispose() {
155                myWorkspaceSynchronizer.dispose();
156                myWorkspaceSynchronizer = null;
157                myViewerRefreshRunnable = null;
158                for (Iterator it = myEditingDomain.getResourceSet().getResources()
159                                .iterator(); it.hasNext();) {
160                        Resource resource = (Resource) it.next();
161                        resource.unload();
162                }
163                ((TransactionalEditingDomain) myEditingDomain).dispose();
164                myEditingDomain = null;
165        }
166 
167        /**
168         * @generated
169         */
170        public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
171                myViewer = viewer;
172        }
173 
174        /**
175         * @generated
176         */
177        public Object[] getElements(Object inputElement) {
178                return getChildren(inputElement);
179        }
180 
181        /**
182         * @generated
183         */
184        public void restoreState(IMemento aMemento) {
185        }
186 
187        /**
188         * @generated
189         */
190        public void saveState(IMemento aMemento) {
191        }
192 
193        /**
194         * @generated
195         */
196        public void init(ICommonContentExtensionSite aConfig) {
197        }
198 
199        /**
200         * @generated
201         */
202        public Object[] getChildren(Object parentElement) {
203                if (parentElement instanceof IFile) {
204                        IFile file = (IFile) parentElement;
205                        URI fileURI = URI.createPlatformResourceURI(file.getFullPath()
206                                        .toString(), true);
207                        Resource resource = myEditingDomain.getResourceSet().getResource(
208                                        fileURI, true);
209                        Collection result = new ArrayList();
210                        result.addAll(createNavigatorItems(selectViewsByType(resource
211                                        .getContents(), UsageScenarioEditPart.MODEL_ID), file,
212                                        false));
213                        return result.toArray();
214                }
215 
216                if (parentElement instanceof PalladioComponentModelNavigatorGroup) {
217                        PalladioComponentModelNavigatorGroup group = (PalladioComponentModelNavigatorGroup) parentElement;
218                        return group.getChildren();
219                }
220 
221                if (parentElement instanceof PalladioComponentModelNavigatorItem) {
222                        PalladioComponentModelNavigatorItem navigatorItem = (PalladioComponentModelNavigatorItem) parentElement;
223                        if (navigatorItem.isLeaf() || !isOwnView(navigatorItem.getView())) {
224                                return EMPTY_ARRAY;
225                        }
226                        return getViewChildren(navigatorItem.getView(), parentElement);
227                }
228 
229                return EMPTY_ARRAY;
230        }
231 
232        /**
233         * @generated
234         */
235        private Object[] getViewChildren(View view, Object parentElement) {
236                switch (PalladioComponentModelVisualIDRegistry.getVisualID(view)) {
237 
238                case UsageScenarioEditPart.VISUAL_ID: {
239                        Collection result = new ArrayList();
240                        PalladioComponentModelNavigatorGroup links = new PalladioComponentModelNavigatorGroup(
241                                        Messages.NavigatorGroupName_UsageModel_1000_links,
242                                        "icons/linksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
243                        Collection connectedViews = getChildrenByType(Collections
244                                        .singleton(view), PalladioComponentModelVisualIDRegistry
245                                        .getType(UsageScenario2EditPart.VISUAL_ID));
246                        result.addAll(createNavigatorItems(connectedViews, parentElement,
247                                        false));
248                        connectedViews = getDiagramLinksByType(
249                                        Collections.singleton(view),
250                                        PalladioComponentModelVisualIDRegistry
251                                                        .getType(AbstractUserActionSuccessorEditPart.VISUAL_ID));
252                        links
253                                        .addChildren(createNavigatorItems(connectedViews, links,
254                                                        false));
255                        if (!links.isEmpty()) {
256                                result.add(links);
257                        }
258                        return result.toArray();
259                }
260 
261                case UsageScenario2EditPart.VISUAL_ID: {
262                        Collection result = new ArrayList();
263                        Collection connectedViews = getChildrenByType(
264                                        Collections.singleton(view),
265                                        PalladioComponentModelVisualIDRegistry
266                                                        .getType(UsageScenarioUsageScenarioCompartmentEditPart.VISUAL_ID));
267                        connectedViews = getChildrenByType(connectedViews,
268                                        PalladioComponentModelVisualIDRegistry
269                                                        .getType(ScenarioBehaviourEditPart.VISUAL_ID));
270                        result.addAll(createNavigatorItems(connectedViews, parentElement,
271                                        false));
272                        connectedViews = getChildrenByType(
273                                        Collections.singleton(view),
274                                        PalladioComponentModelVisualIDRegistry
275                                                        .getType(UsageScenarioUsageScenarioCompartmentEditPart.VISUAL_ID));
276                        connectedViews = getChildrenByType(connectedViews,
277                                        PalladioComponentModelVisualIDRegistry
278                                                        .getType(ClosedWorkloadEditPart.VISUAL_ID));
279                        result.addAll(createNavigatorItems(connectedViews, parentElement,
280                                        false));
281                        connectedViews = getChildrenByType(
282                                        Collections.singleton(view),
283                                        PalladioComponentModelVisualIDRegistry
284                                                        .getType(UsageScenarioUsageScenarioCompartmentEditPart.VISUAL_ID));
285                        connectedViews = getChildrenByType(connectedViews,
286                                        PalladioComponentModelVisualIDRegistry
287                                                        .getType(OpenWorkloadEditPart.VISUAL_ID));
288                        result.addAll(createNavigatorItems(connectedViews, parentElement,
289                                        false));
290                        return result.toArray();
291                }
292 
293                case ScenarioBehaviourEditPart.VISUAL_ID: {
294                        Collection result = new ArrayList();
295                        Collection connectedViews = getChildrenByType(
296                                        Collections.singleton(view),
297                                        PalladioComponentModelVisualIDRegistry
298                                                        .getType(ScenarioBehaviourScenarioBehaviourStepsCompartmentEditPart.VISUAL_ID));
299                        connectedViews = getChildrenByType(connectedViews,
300                                        PalladioComponentModelVisualIDRegistry
301                                                        .getType(StartEditPart.VISUAL_ID));
302                        result.addAll(createNavigatorItems(connectedViews, parentElement,
303                                        false));
304                        connectedViews = getChildrenByType(
305                                        Collections.singleton(view),
306                                        PalladioComponentModelVisualIDRegistry
307                                                        .getType(ScenarioBehaviourScenarioBehaviourStepsCompartmentEditPart.VISUAL_ID));
308                        connectedViews = getChildrenByType(connectedViews,
309                                        PalladioComponentModelVisualIDRegistry
310                                                        .getType(StopEditPart.VISUAL_ID));
311                        result.addAll(createNavigatorItems(connectedViews, parentElement,
312                                        false));
313                        connectedViews = getChildrenByType(
314                                        Collections.singleton(view),
315                                        PalladioComponentModelVisualIDRegistry
316                                                        .getType(ScenarioBehaviourScenarioBehaviourStepsCompartmentEditPart.VISUAL_ID));
317                        connectedViews = getChildrenByType(connectedViews,
318                                        PalladioComponentModelVisualIDRegistry
319                                                        .getType(EntryLevelSystemCallEditPart.VISUAL_ID));
320                        result.addAll(createNavigatorItems(connectedViews, parentElement,
321                                        false));
322                        connectedViews = getChildrenByType(
323                                        Collections.singleton(view),
324                                        PalladioComponentModelVisualIDRegistry
325                                                        .getType(ScenarioBehaviourScenarioBehaviourStepsCompartmentEditPart.VISUAL_ID));
326                        connectedViews = getChildrenByType(connectedViews,
327                                        PalladioComponentModelVisualIDRegistry
328                                                        .getType(LoopEditPart.VISUAL_ID));
329                        result.addAll(createNavigatorItems(connectedViews, parentElement,
330                                        false));
331                        connectedViews = getChildrenByType(
332                                        Collections.singleton(view),
333                                        PalladioComponentModelVisualIDRegistry
334                                                        .getType(ScenarioBehaviourScenarioBehaviourStepsCompartmentEditPart.VISUAL_ID));
335                        connectedViews = getChildrenByType(connectedViews,
336                                        PalladioComponentModelVisualIDRegistry
337                                                        .getType(BranchEditPart.VISUAL_ID));
338                        result.addAll(createNavigatorItems(connectedViews, parentElement,
339                                        false));
340                        connectedViews = getChildrenByType(
341                                        Collections.singleton(view),
342                                        PalladioComponentModelVisualIDRegistry
343                                                        .getType(ScenarioBehaviourScenarioBehaviourStepsCompartmentEditPart.VISUAL_ID));
344                        connectedViews = getChildrenByType(connectedViews,
345                                        PalladioComponentModelVisualIDRegistry
346                                                        .getType(DelayEditPart.VISUAL_ID));
347                        result.addAll(createNavigatorItems(connectedViews, parentElement,
348                                        false));
349                        return result.toArray();
350                }
351 
352                case StartEditPart.VISUAL_ID: {
353                        Collection result = new ArrayList();
354                        PalladioComponentModelNavigatorGroup incominglinks = new PalladioComponentModelNavigatorGroup(
355                                        Messages.NavigatorGroupName_Start_3001_incominglinks,
356                                        "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
357                        PalladioComponentModelNavigatorGroup outgoinglinks = new PalladioComponentModelNavigatorGroup(
358                                        Messages.NavigatorGroupName_Start_3001_outgoinglinks,
359                                        "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
360                        Collection connectedViews = getIncomingLinksByType(Collections
361                                        .singleton(view), PalladioComponentModelVisualIDRegistry
362                                        .getType(AbstractUserActionSuccessorEditPart.VISUAL_ID));
363                        incominglinks.addChildren(createNavigatorItems(connectedViews,
364                                        incominglinks, true));
365                        connectedViews = getOutgoingLinksByType(
366                                        Collections.singleton(view),
367                                        PalladioComponentModelVisualIDRegistry
368                                                        .getType(AbstractUserActionSuccessorEditPart.VISUAL_ID));
369                        outgoinglinks.addChildren(createNavigatorItems(connectedViews,
370                                        outgoinglinks, true));
371                        if (!incominglinks.isEmpty()) {
372                                result.add(incominglinks);
373                        }
374                        if (!outgoinglinks.isEmpty()) {
375                                result.add(outgoinglinks);
376                        }
377                        return result.toArray();
378                }
379 
380                case StopEditPart.VISUAL_ID: {
381                        Collection result = new ArrayList();
382                        PalladioComponentModelNavigatorGroup incominglinks = new PalladioComponentModelNavigatorGroup(
383                                        Messages.NavigatorGroupName_Stop_3002_incominglinks,
384                                        "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
385                        PalladioComponentModelNavigatorGroup outgoinglinks = new PalladioComponentModelNavigatorGroup(
386                                        Messages.NavigatorGroupName_Stop_3002_outgoinglinks,
387                                        "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
388                        Collection connectedViews = getIncomingLinksByType(Collections
389                                        .singleton(view), PalladioComponentModelVisualIDRegistry
390                                        .getType(AbstractUserActionSuccessorEditPart.VISUAL_ID));
391                        incominglinks.addChildren(createNavigatorItems(connectedViews,
392                                        incominglinks, true));
393                        connectedViews = getOutgoingLinksByType(
394                                        Collections.singleton(view),
395                                        PalladioComponentModelVisualIDRegistry
396                                                        .getType(AbstractUserActionSuccessorEditPart.VISUAL_ID));
397                        outgoinglinks.addChildren(createNavigatorItems(connectedViews,
398                                        outgoinglinks, true));
399                        if (!incominglinks.isEmpty()) {
400                                result.add(incominglinks);
401                        }
402                        if (!outgoinglinks.isEmpty()) {
403                                result.add(outgoinglinks);
404                        }
405                        return result.toArray();
406                }
407 
408                case EntryLevelSystemCallEditPart.VISUAL_ID: {
409                        Collection result = new ArrayList();
410                        PalladioComponentModelNavigatorGroup incominglinks = new PalladioComponentModelNavigatorGroup(
411                                        Messages.NavigatorGroupName_EntryLevelSystemCall_3003_incominglinks,
412                                        "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
413                        PalladioComponentModelNavigatorGroup outgoinglinks = new PalladioComponentModelNavigatorGroup(
414                                        Messages.NavigatorGroupName_EntryLevelSystemCall_3003_outgoinglinks,
415                                        "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
416                        Collection connectedViews = getChildrenByType(
417                                        Collections.singleton(view),
418                                        PalladioComponentModelVisualIDRegistry
419                                                        .getType(EntryLevelSystemCallParameterUsageEditPart.VISUAL_ID));
420                        connectedViews = getChildrenByType(connectedViews,
421                                        PalladioComponentModelVisualIDRegistry
422                                                        .getType(VariableUsageEditPart.VISUAL_ID));
423                        result.addAll(createNavigatorItems(connectedViews, parentElement,
424                                        false));
425                        connectedViews = getIncomingLinksByType(
426                                        Collections.singleton(view),
427                                        PalladioComponentModelVisualIDRegistry
428                                                        .getType(AbstractUserActionSuccessorEditPart.VISUAL_ID));
429                        incominglinks.addChildren(createNavigatorItems(connectedViews,
430                                        incominglinks, true));
431                        connectedViews = getOutgoingLinksByType(
432                                        Collections.singleton(view),
433                                        PalladioComponentModelVisualIDRegistry
434                                                        .getType(AbstractUserActionSuccessorEditPart.VISUAL_ID));
435                        outgoinglinks.addChildren(createNavigatorItems(connectedViews,
436                                        outgoinglinks, true));
437                        if (!incominglinks.isEmpty()) {
438                                result.add(incominglinks);
439                        }
440                        if (!outgoinglinks.isEmpty()) {
441                                result.add(outgoinglinks);
442                        }
443                        return result.toArray();
444                }
445 
446                case VariableUsageEditPart.VISUAL_ID: {
447                        Collection result = new ArrayList();
448                        Collection connectedViews = getChildrenByType(
449                                        Collections.singleton(view),
450                                        PalladioComponentModelVisualIDRegistry
451                                                        .getType(VariableUsageVariableCharacterisationEditPart.VISUAL_ID));
452                        connectedViews = getChildrenByType(
453                                        connectedViews,
454                                        PalladioComponentModelVisualIDRegistry
455                                                        .getType(VariableCharacterisationEditPart.VISUAL_ID));
456                        result.addAll(createNavigatorItems(connectedViews, parentElement,
457                                        false));
458                        return result.toArray();
459                }
460 
461                case LoopEditPart.VISUAL_ID: {
462                        Collection result = new ArrayList();
463                        PalladioComponentModelNavigatorGroup incominglinks = new PalladioComponentModelNavigatorGroup(
464                                        Messages.NavigatorGroupName_Loop_3005_incominglinks,
465                                        "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
466                        PalladioComponentModelNavigatorGroup outgoinglinks = new PalladioComponentModelNavigatorGroup(
467                                        Messages.NavigatorGroupName_Loop_3005_outgoinglinks,
468                                        "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
469                        Collection connectedViews = getChildrenByType(Collections
470                                        .singleton(view), PalladioComponentModelVisualIDRegistry
471                                        .getType(ScenarioBehaviour2EditPart.VISUAL_ID));
472                        result.addAll(createNavigatorItems(connectedViews, parentElement,
473                                        false));
474                        connectedViews = getIncomingLinksByType(
475                                        Collections.singleton(view),
476                                        PalladioComponentModelVisualIDRegistry
477                                                        .getType(AbstractUserActionSuccessorEditPart.VISUAL_ID));
478                        incominglinks.addChildren(createNavigatorItems(connectedViews,
479                                        incominglinks, true));
480                        connectedViews = getOutgoingLinksByType(
481                                        Collections.singleton(view),
482                                        PalladioComponentModelVisualIDRegistry
483                                                        .getType(AbstractUserActionSuccessorEditPart.VISUAL_ID));
484                        outgoinglinks.addChildren(createNavigatorItems(connectedViews,
485                                        outgoinglinks, true));
486                        if (!incominglinks.isEmpty()) {
487                                result.add(incominglinks);
488                        }
489                        if (!outgoinglinks.isEmpty()) {
490                                result.add(outgoinglinks);
491                        }
492                        return result.toArray();
493                }
494 
495                case ScenarioBehaviour2EditPart.VISUAL_ID: {
496                        Collection result = new ArrayList();
497                        Collection connectedViews = getChildrenByType(
498                                        Collections.singleton(view),
499                                        PalladioComponentModelVisualIDRegistry
500                                                        .getType(ScenarioBehaviourScenarioBehaviourStepsCompartment2EditPart.VISUAL_ID));
501                        connectedViews = getChildrenByType(connectedViews,
502                                        PalladioComponentModelVisualIDRegistry
503                                                        .getType(StartEditPart.VISUAL_ID));
504                        result.addAll(createNavigatorItems(connectedViews, parentElement,
505                                        false));
506                        connectedViews = getChildrenByType(
507                                        Collections.singleton(view),
508                                        PalladioComponentModelVisualIDRegistry
509                                                        .getType(ScenarioBehaviourScenarioBehaviourStepsCompartment2EditPart.VISUAL_ID));
510                        connectedViews = getChildrenByType(connectedViews,
511                                        PalladioComponentModelVisualIDRegistry
512                                                        .getType(StopEditPart.VISUAL_ID));
513                        result.addAll(createNavigatorItems(connectedViews, parentElement,
514                                        false));
515                        connectedViews = getChildrenByType(
516                                        Collections.singleton(view),
517                                        PalladioComponentModelVisualIDRegistry
518                                                        .getType(ScenarioBehaviourScenarioBehaviourStepsCompartment2EditPart.VISUAL_ID));
519                        connectedViews = getChildrenByType(connectedViews,
520                                        PalladioComponentModelVisualIDRegistry
521                                                        .getType(EntryLevelSystemCallEditPart.VISUAL_ID));
522                        result.addAll(createNavigatorItems(connectedViews, parentElement,
523                                        false));
524                        connectedViews = getChildrenByType(
525                                        Collections.singleton(view),
526                                        PalladioComponentModelVisualIDRegistry
527                                                        .getType(ScenarioBehaviourScenarioBehaviourStepsCompartment2EditPart.VISUAL_ID));
528                        connectedViews = getChildrenByType(connectedViews,
529                                        PalladioComponentModelVisualIDRegistry
530                                                        .getType(LoopEditPart.VISUAL_ID));
531                        result.addAll(createNavigatorItems(connectedViews, parentElement,
532                                        false));
533                        connectedViews = getChildrenByType(
534                                        Collections.singleton(view),
535                                        PalladioComponentModelVisualIDRegistry
536                                                        .getType(ScenarioBehaviourScenarioBehaviourStepsCompartment2EditPart.VISUAL_ID));
537                        connectedViews = getChildrenByType(connectedViews,
538                                        PalladioComponentModelVisualIDRegistry
539                                                        .getType(BranchEditPart.VISUAL_ID));
540                        result.addAll(createNavigatorItems(connectedViews, parentElement,
541                                        false));
542                        connectedViews = getChildrenByType(
543                                        Collections.singleton(view),
544                                        PalladioComponentModelVisualIDRegistry
545                                                        .getType(ScenarioBehaviourScenarioBehaviourStepsCompartment2EditPart.VISUAL_ID));
546                        connectedViews = getChildrenByType(connectedViews,
547                                        PalladioComponentModelVisualIDRegistry
548                                                        .getType(DelayEditPart.VISUAL_ID));
549                        result.addAll(createNavigatorItems(connectedViews, parentElement,
550                                        false));
551                        return result.toArray();
552                }
553 
554                case BranchEditPart.VISUAL_ID: {
555                        Collection result = new ArrayList();
556                        PalladioComponentModelNavigatorGroup incominglinks = new PalladioComponentModelNavigatorGroup(
557                                        Messages.NavigatorGroupName_Branch_3008_incominglinks,
558                                        "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
559                        PalladioComponentModelNavigatorGroup outgoinglinks = new PalladioComponentModelNavigatorGroup(
560                                        Messages.NavigatorGroupName_Branch_3008_outgoinglinks,
561                                        "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
562                        Collection connectedViews = getChildrenByType(
563                                        Collections.singleton(view),
564                                        PalladioComponentModelVisualIDRegistry
565                                                        .getType(BranchUsageBranchTransitionsCompartmentEditPart.VISUAL_ID));
566                        connectedViews = getChildrenByType(connectedViews,
567                                        PalladioComponentModelVisualIDRegistry
568                                                        .getType(BranchTransitionEditPart.VISUAL_ID));
569                        result.addAll(createNavigatorItems(connectedViews, parentElement,
570                                        false));
571                        connectedViews = getIncomingLinksByType(
572                                        Collections.singleton(view),
573                                        PalladioComponentModelVisualIDRegistry
574                                                        .getType(AbstractUserActionSuccessorEditPart.VISUAL_ID));
575                        incominglinks.addChildren(createNavigatorItems(connectedViews,
576                                        incominglinks, true));
577                        connectedViews = getOutgoingLinksByType(
578                                        Collections.singleton(view),
579                                        PalladioComponentModelVisualIDRegistry
580                                                        .getType(AbstractUserActionSuccessorEditPart.VISUAL_ID));
581                        outgoinglinks.addChildren(createNavigatorItems(connectedViews,
582                                        outgoinglinks, true));
583                        if (!incominglinks.isEmpty()) {
584                                result.add(incominglinks);
585                        }
586                        if (!outgoinglinks.isEmpty()) {
587                                result.add(outgoinglinks);
588                        }
589                        return result.toArray();
590                }
591 
592                case BranchTransitionEditPart.VISUAL_ID: {
593                        Collection result = new ArrayList();
594                        Collection connectedViews = getChildrenByType(Collections
595                                        .singleton(view), PalladioComponentModelVisualIDRegistry
596                                        .getType(ScenarioBehaviour3EditPart.VISUAL_ID));
597                        result.addAll(createNavigatorItems(connectedViews, parentElement,
598                                        false));
599                        return result.toArray();
600                }
601 
602                case ScenarioBehaviour3EditPart.VISUAL_ID: {
603                        Collection result = new ArrayList();
604                        Collection connectedViews = getChildrenByType(
605                                        Collections.singleton(view),
606                                        PalladioComponentModelVisualIDRegistry
607                                                        .getType(ScenarioBehaviourScenarioBehaviourStepsCompartment3EditPart.VISUAL_ID));
608                        connectedViews = getChildrenByType(connectedViews,
609                                        PalladioComponentModelVisualIDRegistry
610                                                        .getType(StartEditPart.VISUAL_ID));
611                        result.addAll(createNavigatorItems(connectedViews, parentElement,
612                                        false));
613                        connectedViews = getChildrenByType(
614                                        Collections.singleton(view),
615                                        PalladioComponentModelVisualIDRegistry
616                                                        .getType(ScenarioBehaviourScenarioBehaviourStepsCompartment3EditPart.VISUAL_ID));
617                        connectedViews = getChildrenByType(connectedViews,
618                                        PalladioComponentModelVisualIDRegistry
619                                                        .getType(StopEditPart.VISUAL_ID));
620                        result.addAll(createNavigatorItems(connectedViews, parentElement,
621                                        false));
622                        connectedViews = getChildrenByType(
623                                        Collections.singleton(view),
624                                        PalladioComponentModelVisualIDRegistry
625                                                        .getType(ScenarioBehaviourScenarioBehaviourStepsCompartment3EditPart.VISUAL_ID));
626                        connectedViews = getChildrenByType(connectedViews,
627                                        PalladioComponentModelVisualIDRegistry
628                                                        .getType(EntryLevelSystemCallEditPart.VISUAL_ID));
629                        result.addAll(createNavigatorItems(connectedViews, parentElement,
630                                        false));
631                        connectedViews = getChildrenByType(
632                                        Collections.singleton(view),
633                                        PalladioComponentModelVisualIDRegistry
634                                                        .getType(ScenarioBehaviourScenarioBehaviourStepsCompartment3EditPart.VISUAL_ID));
635                        connectedViews = getChildrenByType(connectedViews,
636                                        PalladioComponentModelVisualIDRegistry
637                                                        .getType(LoopEditPart.VISUAL_ID));
638                        result.addAll(createNavigatorItems(connectedViews, parentElement,
639                                        false));
640                        connectedViews = getChildrenByType(
641                                        Collections.singleton(view),
642                                        PalladioComponentModelVisualIDRegistry
643                                                        .getType(ScenarioBehaviourScenarioBehaviourStepsCompartment3EditPart.VISUAL_ID));
644                        connectedViews = getChildrenByType(connectedViews,
645                                        PalladioComponentModelVisualIDRegistry
646                                                        .getType(BranchEditPart.VISUAL_ID));
647                        result.addAll(createNavigatorItems(connectedViews, parentElement,
648                                        false));
649                        connectedViews = getChildrenByType(
650                                        Collections.singleton(view),
651                                        PalladioComponentModelVisualIDRegistry
652                                                        .getType(ScenarioBehaviourScenarioBehaviourStepsCompartment3EditPart.VISUAL_ID));
653                        connectedViews = getChildrenByType(connectedViews,
654                                        PalladioComponentModelVisualIDRegistry
655                                                        .getType(DelayEditPart.VISUAL_ID));
656                        result.addAll(createNavigatorItems(connectedViews, parentElement,
657                                        false));
658                        return result.toArray();
659                }
660 
661                case DelayEditPart.VISUAL_ID: {
662                        Collection result = new ArrayList();
663                        PalladioComponentModelNavigatorGroup incominglinks = new PalladioComponentModelNavigatorGroup(
664                                        Messages.NavigatorGroupName_Delay_3017_incominglinks,
665                                        "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
666                        PalladioComponentModelNavigatorGroup outgoinglinks = new PalladioComponentModelNavigatorGroup(
667                                        Messages.NavigatorGroupName_Delay_3017_outgoinglinks,
668                                        "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
669                        Collection connectedViews = getIncomingLinksByType(Collections
670                                        .singleton(view), PalladioComponentModelVisualIDRegistry
671                                        .getType(AbstractUserActionSuccessorEditPart.VISUAL_ID));
672                        incominglinks.addChildren(createNavigatorItems(connectedViews,
673                                        incominglinks, true));
674                        connectedViews = getOutgoingLinksByType(
675                                        Collections.singleton(view),
676                                        PalladioComponentModelVisualIDRegistry
677                                                        .getType(AbstractUserActionSuccessorEditPart.VISUAL_ID));
678                        outgoinglinks.addChildren(createNavigatorItems(connectedViews,
679                                        outgoinglinks, true));
680                        if (!incominglinks.isEmpty()) {
681                                result.add(incominglinks);
682                        }
683                        if (!outgoinglinks.isEmpty()) {
684                                result.add(outgoinglinks);
685                        }
686                        return result.toArray();
687                }
688 
689                case AbstractUserActionSuccessorEditPart.VISUAL_ID: {
690                        Collection result = new ArrayList();
691                        PalladioComponentModelNavigatorGroup target = new PalladioComponentModelNavigatorGroup(
692                                        Messages.NavigatorGroupName_AbstractUserActionSuccessor_4002_target,
693                                        "icons/linkTargetNavigatorGroup.gif", parentElement); //$NON-NLS-1$
694                        PalladioComponentModelNavigatorGroup source = new PalladioComponentModelNavigatorGroup(
695                                        Messages.NavigatorGroupName_AbstractUserActionSuccessor_4002_source,
696                                        "icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$
697                        Collection connectedViews = getLinksTargetByType(Collections
698                                        .singleton(view), PalladioComponentModelVisualIDRegistry
699                                        .getType(StartEditPart.VISUAL_ID));
700                        target.addChildren(createNavigatorItems(connectedViews, target,
701                                        true));
702                        connectedViews = getLinksTargetByType(Collections.singleton(view),
703                                        PalladioComponentModelVisualIDRegistry
704                                                        .getType(StopEditPart.VISUAL_ID));
705                        target.addChildren(createNavigatorItems(connectedViews, target,
706                                        true));
707                        connectedViews = getLinksTargetByType(Collections.singleton(view),
708                                        PalladioComponentModelVisualIDRegistry
709                                                        .getType(EntryLevelSystemCallEditPart.VISUAL_ID));
710                        target.addChildren(createNavigatorItems(connectedViews, target,
711                                        true));
712                        connectedViews = getLinksTargetByType(Collections.singleton(view),
713                                        PalladioComponentModelVisualIDRegistry
714                                                        .getType(LoopEditPart.VISUAL_ID));
715                        target.addChildren(createNavigatorItems(connectedViews, target,
716                                        true));
717                        connectedViews = getLinksTargetByType(Collections.singleton(view),
718                                        PalladioComponentModelVisualIDRegistry
719                                                        .getType(BranchEditPart.VISUAL_ID));
720                        target.addChildren(createNavigatorItems(connectedViews, target,
721                                        true));
722                        connectedViews = getLinksTargetByType(Collections.singleton(view),
723                                        PalladioComponentModelVisualIDRegistry
724                                                        .getType(DelayEditPart.VISUAL_ID));
725                        target.addChildren(createNavigatorItems(connectedViews, target,
726                                        true));
727                        connectedViews = getLinksSourceByType(Collections.singleton(view),
728                                        PalladioComponentModelVisualIDRegistry
729                                                        .getType(StartEditPart.VISUAL_ID));
730                        source.addChildren(createNavigatorItems(connectedViews, source,
731                                        true));
732                        connectedViews = getLinksSourceByType(Collections.singleton(view),
733                                        PalladioComponentModelVisualIDRegistry
734                                                        .getType(StopEditPart.VISUAL_ID));
735                        source.addChildren(createNavigatorItems(connectedViews, source,
736                                        true));
737                        connectedViews = getLinksSourceByType(Collections.singleton(view),
738                                        PalladioComponentModelVisualIDRegistry
739                                                        .getType(EntryLevelSystemCallEditPart.VISUAL_ID));
740                        source.addChildren(createNavigatorItems(connectedViews, source,
741                                        true));
742                        connectedViews = getLinksSourceByType(Collections.singleton(view),
743                                        PalladioComponentModelVisualIDRegistry
744                                                        .getType(LoopEditPart.VISUAL_ID));
745                        source.addChildren(createNavigatorItems(connectedViews, source,
746                                        true));
747                        connectedViews = getLinksSourceByType(Collections.singleton(view),
748                                        PalladioComponentModelVisualIDRegistry
749                                                        .getType(BranchEditPart.VISUAL_ID));
750                        source.addChildren(createNavigatorItems(connectedViews, source,
751                                        true));
752                        connectedViews = getLinksSourceByType(Collections.singleton(view),
753                                        PalladioComponentModelVisualIDRegistry
754                                                        .getType(DelayEditPart.VISUAL_ID));
755                        source.addChildren(createNavigatorItems(connectedViews, source,
756                                        true));
757                        if (!target.isEmpty()) {
758                                result.add(target);
759                        }
760                        if (!source.isEmpty()) {
761                                result.add(source);
762                        }
763                        return result.toArray();
764                }
765                }
766                return EMPTY_ARRAY;
767        }
768 
769        /**
770         * @generated
771         */
772        private Collection getLinksSourceByType(Collection edges, String type) {
773                Collection result = new ArrayList();
774                for (Iterator it = edges.iterator(); it.hasNext();) {
775                        Edge nextEdge = (Edge) it.next();
776                        View nextEdgeSource = nextEdge.getSource();
777                        if (type.equals(nextEdgeSource.getType())
778                                        && isOwnView(nextEdgeSource)) {
779                                result.add(nextEdgeSource);
780                        }
781                }
782                return result;
783        }
784 
785        /**
786         * @generated
787         */
788        private Collection getLinksTargetByType(Collection edges, String type) {
789                Collection result = new ArrayList();
790                for (Iterator it = edges.iterator(); it.hasNext();) {
791                        Edge nextEdge = (Edge) it.next();
792                        View nextEdgeTarget = nextEdge.getTarget();
793                        if (type.equals(nextEdgeTarget.getType())
794                                        && isOwnView(nextEdgeTarget)) {
795                                result.add(nextEdgeTarget);
796                        }
797                }
798                return result;
799        }
800 
801        /**
802         * @generated
803         */
804        private Collection getOutgoingLinksByType(Collection nodes, String type) {
805                Collection result = new ArrayList();
806                for (Iterator it = nodes.iterator(); it.hasNext();) {
807                        View nextNode = (View) it.next();
808                        result.addAll(selectViewsByType(nextNode.getSourceEdges(), type));
809                }
810                return result;
811        }
812 
813        /**
814         * @generated
815         */
816        private Collection getIncomingLinksByType(Collection nodes, String type) {
817                Collection result = new ArrayList();
818                for (Iterator it = nodes.iterator(); it.hasNext();) {
819                        View nextNode = (View) it.next();
820                        result.addAll(selectViewsByType(nextNode.getTargetEdges(), type));
821                }
822                return result;
823        }
824 
825        /**
826         * @generated
827         */
828        private Collection getChildrenByType(Collection nodes, String type) {
829                Collection result = new ArrayList();
830                for (Iterator it = nodes.iterator(); it.hasNext();) {
831                        View nextNode = (View) it.next();
832                        result.addAll(selectViewsByType(nextNode.getChildren(), type));
833                }
834                return result;
835        }
836 
837        /**
838         * @generated
839         */
840        private Collection getDiagramLinksByType(Collection diagrams, String type) {
841                Collection result = new ArrayList();
842                for (Iterator it = diagrams.iterator(); it.hasNext();) {
843                        Diagram nextDiagram = (Diagram) it.next();
844                        result.addAll(selectViewsByType(nextDiagram.getEdges(), type));
845                }
846                return result;
847        }
848 
849        /**
850         * @generated
851         */
852        private Collection selectViewsByType(Collection views, String type) {
853                Collection result = new ArrayList();
854                for (Iterator it = views.iterator(); it.hasNext();) {
855                        View nextView = (View) it.next();
856                        if (type.equals(nextView.getType()) && isOwnView(nextView)) {
857                                result.add(nextView);
858                        }
859                }
860                return result;
861        }
862 
863        /**
864         * @generated
865         */
866        private boolean isOwnView(View view) {
867                return UsageScenarioEditPart.MODEL_ID
868                                .equals(PalladioComponentModelVisualIDRegistry.getModelID(view));
869        }
870 
871        /**
872         * @generated
873         */
874        private Collection createNavigatorItems(Collection views, Object parent,
875                        boolean isLeafs) {
876                Collection result = new ArrayList();
877                for (Iterator it = views.iterator(); it.hasNext();) {
878                        result.add(new PalladioComponentModelNavigatorItem(
879                                        (View) it.next(), parent, isLeafs));
880                }
881                return result;
882        }
883 
884        /**
885         * @generated
886         */
887        public Object getParent(Object element) {
888                if (element instanceof PalladioComponentModelAbstractNavigatorItem) {
889                        PalladioComponentModelAbstractNavigatorItem abstractNavigatorItem = (PalladioComponentModelAbstractNavigatorItem) element;
890                        return abstractNavigatorItem.getParent();
891                }
892                return null;
893        }
894 
895        /**
896         * @generated
897         */
898        public boolean hasChildren(Object element) {
899                return element instanceof IFile || getChildren(element).length > 0;
900        }
901 
902}

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