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

COVERAGE SUMMARY FOR SOURCE FILE [PalladioComponentModelDomainNavigatorContentProvider.java]

nameclass, %method, %block, %line, %
PalladioComponentModelDomainNavigatorContentProvider.java0%   (0/4)0%   (0/24)0%   (0/332)0%   (0/91)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class PalladioComponentModelDomainNavigatorContentProvider0%   (0/1)0%   (0/15)0%   (0/195)0%   (0/59)
<static initializer> 0%   (0/1)0%   (0/4)0%   (0/2)
PalladioComponentModelDomainNavigatorContentProvider (): void 0%   (0/1)0%   (0/40)0%   (0/12)
access$0 (PalladioComponentModelDomainNavigatorContentProvider): Viewer 0%   (0/1)0%   (0/3)0%   (0/1)
access$1 (PalladioComponentModelDomainNavigatorContentProvider): AdapterFacto... 0%   (0/1)0%   (0/3)0%   (0/1)
access$2 (PalladioComponentModelDomainNavigatorContentProvider): Runnable 0%   (0/1)0%   (0/3)0%   (0/1)
dispose (): void 0%   (0/1)0%   (0/33)0%   (0/10)
getChildren (Object): Object [] 0%   (0/1)0%   (0/42)0%   (0/14)
getElements (Object): Object [] 0%   (0/1)0%   (0/4)0%   (0/1)
getParent (Object): Object 0%   (0/1)0%   (0/11)0%   (0/4)
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)
restoreState (IMemento): void 0%   (0/1)0%   (0/1)0%   (0/1)
saveState (IMemento): void 0%   (0/1)0%   (0/1)0%   (0/1)
wrapEObjects (Object [], Object): Object [] 0%   (0/1)0%   (0/33)0%   (0/7)
     
class PalladioComponentModelDomainNavigatorContentProvider$10%   (0/1)0%   (0/2)0%   (0/19)0%   (0/5)
PalladioComponentModelDomainNavigatorContentProvider$1 (PalladioComponentMode... 0%   (0/1)0%   (0/6)0%   (0/2)
get (Object): Object 0%   (0/1)0%   (0/13)0%   (0/3)
     
class PalladioComponentModelDomainNavigatorContentProvider$20%   (0/1)0%   (0/2)0%   (0/15)0%   (0/5)
PalladioComponentModelDomainNavigatorContentProvider$2 (PalladioComponentMode... 0%   (0/1)0%   (0/6)0%   (0/2)
run (): void 0%   (0/1)0%   (0/9)0%   (0/3)
     
class PalladioComponentModelDomainNavigatorContentProvider$30%   (0/1)0%   (0/5)0%   (0/103)0%   (0/27)
PalladioComponentModelDomainNavigatorContentProvider$3 (PalladioComponentMode... 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 2006 SDQ Research Group, University of Karlsruhe (TH)
3 */
4package de.uka.ipd.sdq.pcm.gmf.seff.navigator;
5 
6import java.util.ArrayList;
7import java.util.Collection;
8import java.util.HashMap;
9import java.util.Iterator;
10 
11import org.eclipse.core.resources.IFile;
12import org.eclipse.emf.common.util.URI;
13import org.eclipse.emf.ecore.EObject;
14import org.eclipse.emf.ecore.resource.Resource;
15import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
16import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
17import org.eclipse.emf.transaction.TransactionalEditingDomain;
18import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
19import org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory;
20import org.eclipse.jface.viewers.Viewer;
21import org.eclipse.ui.IMemento;
22import org.eclipse.ui.navigator.ICommonContentExtensionSite;
23import org.eclipse.ui.navigator.ICommonContentProvider;
24 
25import de.uka.ipd.sdq.pcm.gmf.seff.part.PalladioComponentModelSeffDiagramEditorPlugin;
26 
27/**
28 * @generated
29 */
30public class PalladioComponentModelDomainNavigatorContentProvider implements
31                ICommonContentProvider {
32 
33        /**
34         * @generated
35         */
36        private AdapterFactoryContentProvider myAdapterFctoryContentProvier;
37 
38        /**
39         * @generated
40         */
41        private static final Object[] EMPTY_ARRAY = new Object[0];
42 
43        /**
44         * @generated
45         */
46        private Viewer myViewer;
47 
48        /**
49         * @generated
50         */
51        private AdapterFactoryEditingDomain myEditingDomain;
52 
53        /**
54         * @generated
55         */
56        private WorkspaceSynchronizer myWorkspaceSynchronizer;
57 
58        /**
59         * @generated
60         */
61        private Runnable myViewerRefreshRunnable;
62 
63        /**
64         * @generated
65         */
66        public PalladioComponentModelDomainNavigatorContentProvider() {
67                myAdapterFctoryContentProvier = new AdapterFactoryContentProvider(
68                                PalladioComponentModelSeffDiagramEditorPlugin.getInstance()
69                                                .getItemProvidersAdapterFactory());
70                TransactionalEditingDomain editingDomain = GMFEditingDomainFactory.INSTANCE
71                                .createEditingDomain();
72                myEditingDomain = (AdapterFactoryEditingDomain) editingDomain;
73                myEditingDomain.setResourceToReadOnlyMap(new HashMap() {
74                        public Object get(Object key) {
75                                if (!containsKey(key)) {
76                                        put(key, Boolean.TRUE);
77                                }
78                                return super.get(key);
79                        }
80                });
81                myViewerRefreshRunnable = new Runnable() {
82                        public void run() {
83                                if (myViewer != null) {
84                                        myViewer.refresh();
85                                }
86                        }
87                };
88                myWorkspaceSynchronizer = new WorkspaceSynchronizer(editingDomain,
89                                new WorkspaceSynchronizer.Delegate() {
90                                        public void dispose() {
91                                        }
92 
93                                        public boolean handleResourceChanged(final Resource resource) {
94                                                for (Iterator it = myEditingDomain.getResourceSet()
95                                                                .getResources().iterator(); it.hasNext();) {
96                                                        Resource nextResource = (Resource) it.next();
97                                                        nextResource.unload();
98                                                }
99                                                if (myViewer != null) {
100                                                        myViewer.getControl().getDisplay().asyncExec(
101                                                                        myViewerRefreshRunnable);
102                                                }
103                                                return true;
104                                        }
105 
106                                        public boolean handleResourceDeleted(Resource resource) {
107                                                for (Iterator it = myEditingDomain.getResourceSet()
108                                                                .getResources().iterator(); it.hasNext();) {
109                                                        Resource nextResource = (Resource) it.next();
110                                                        nextResource.unload();
111                                                }
112                                                if (myViewer != null) {
113                                                        myViewer.getControl().getDisplay().asyncExec(
114                                                                        myViewerRefreshRunnable);
115                                                }
116                                                return true;
117                                        }
118 
119                                        public boolean handleResourceMoved(Resource resource,
120                                                        final URI newURI) {
121                                                for (Iterator it = myEditingDomain.getResourceSet()
122                                                                .getResources().iterator(); it.hasNext();) {
123                                                        Resource nextResource = (Resource) it.next();
124                                                        nextResource.unload();
125                                                }
126                                                if (myViewer != null) {
127                                                        myViewer.getControl().getDisplay().asyncExec(
128                                                                        myViewerRefreshRunnable);
129                                                }
130                                                return true;
131                                        }
132                                });
133        }
134 
135        /**
136         * @generated
137         */
138        public void dispose() {
139                myWorkspaceSynchronizer.dispose();
140                myWorkspaceSynchronizer = null;
141                myViewerRefreshRunnable = null;
142                for (Iterator it = myEditingDomain.getResourceSet().getResources()
143                                .iterator(); it.hasNext();) {
144                        Resource resource = (Resource) it.next();
145                        resource.unload();
146                }
147                ((TransactionalEditingDomain) myEditingDomain).dispose();
148                myEditingDomain = null;
149        }
150 
151        /**
152         * @generated
153         */
154        public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
155                myViewer = viewer;
156        }
157 
158        /**
159         * @generated
160         */
161        public Object[] getElements(Object inputElement) {
162                return getChildren(inputElement);
163        }
164 
165        /**
166         * @generated
167         */
168        public void restoreState(IMemento aMemento) {
169        }
170 
171        /**
172         * @generated
173         */
174        public void saveState(IMemento aMemento) {
175        }
176 
177        /**
178         * @generated
179         */
180        public void init(ICommonContentExtensionSite aConfig) {
181        }
182 
183        /**
184         * @generated
185         */
186        public Object[] getChildren(Object parentElement) {
187                if (parentElement instanceof IFile) {
188                        IFile file = (IFile) parentElement;
189                        URI fileURI = URI.createPlatformResourceURI(file.getFullPath()
190                                        .toString(), true);
191                        Resource resource = myEditingDomain.getResourceSet().getResource(
192                                        fileURI, true);
193                        return wrapEObjects(myAdapterFctoryContentProvier
194                                        .getChildren(resource), parentElement);
195                }
196 
197                if (parentElement instanceof PalladioComponentModelDomainNavigatorItem) {
198                        return wrapEObjects(
199                                        myAdapterFctoryContentProvier
200                                                        .getChildren(((PalladioComponentModelDomainNavigatorItem) parentElement)
201                                                                        .getEObject()), parentElement);
202                }
203                return EMPTY_ARRAY;
204        }
205 
206        /**
207         * @generated
208         */
209        public Object[] wrapEObjects(Object[] objects, Object parentElement) {
210                Collection result = new ArrayList();
211                for (int i = 0; i < objects.length; i++) {
212                        if (objects[i] instanceof EObject) {
213                                result.add(new PalladioComponentModelDomainNavigatorItem(
214                                                (EObject) objects[i], parentElement,
215                                                myAdapterFctoryContentProvier));
216                        }
217                }
218                return result.toArray();
219        }
220 
221        /**
222         * @generated
223         */
224        public Object getParent(Object element) {
225                if (element instanceof PalladioComponentModelAbstractNavigatorItem) {
226                        PalladioComponentModelAbstractNavigatorItem abstractNavigatorItem = (PalladioComponentModelAbstractNavigatorItem) element;
227                        return abstractNavigatorItem.getParent();
228                }
229                return null;
230        }
231 
232        /**
233         * @generated
234         */
235        public boolean hasChildren(Object element) {
236                return element instanceof IFile || getChildren(element).length > 0;
237        }
238 
239}

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