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

COVERAGE SUMMARY FOR SOURCE FILE [PalladioComponentModelNavigatorLabelProvider.java]

nameclass, %method, %block, %line, %
PalladioComponentModelNavigatorLabelProvider.java0%   (0/1)0%   (0/21)0%   (0/401)0%   (0/135)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class PalladioComponentModelNavigatorLabelProvider0%   (0/1)0%   (0/21)0%   (0/401)0%   (0/135)
<static initializer> 0%   (0/1)0%   (0/11)0%   (0/9)
PalladioComponentModelNavigatorLabelProvider (): void 0%   (0/1)0%   (0/3)0%   (0/1)
getCommunicationLinkResourceSpecification_3002Text (View): String 0%   (0/1)0%   (0/34)0%   (0/12)
getDescription (Object): String 0%   (0/1)0%   (0/2)0%   (0/1)
getImage (Object): Image 0%   (0/1)0%   (0/35)0%   (0/10)
getImage (String, IElementType): Image 0%   (0/1)0%   (0/33)0%   (0/12)
getImage (View): Image 0%   (0/1)0%   (0/38)0%   (0/14)
getLinkingResourceConnectedResourceContainers_LinkingResource_4002Text (View)... 0%   (0/1)0%   (0/2)0%   (0/1)
getLinkingResource_2003Text (View): String 0%   (0/1)0%   (0/34)0%   (0/11)
getProcessingResourceSpecification_3001Text (View): String 0%   (0/1)0%   (0/34)0%   (0/12)
getResourceContainer_2001Text (View): String 0%   (0/1)0%   (0/34)0%   (0/12)
getResourceEnvironment_1000Text (View): String 0%   (0/1)0%   (0/14)0%   (0/7)
getText (Object): String 0%   (0/1)0%   (0/31)0%   (0/9)
getText (View): String 0%   (0/1)0%   (0/42)0%   (0/10)
getUnknownElementText (View): String 0%   (0/1)0%   (0/11)0%   (0/1)
getUnresolvedDomainElementProxyText (View): String 0%   (0/1)0%   (0/11)0%   (0/1)
init (ICommonContentExtensionSite): void 0%   (0/1)0%   (0/1)0%   (0/1)
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)
updateLabel (ViewerLabel, TreePath): void 0%   (0/1)0%   (0/24)0%   (0/8)

1/*
2 * Copyright 2009, SDQ, IPD, Uni Karlsruhe (TH)
3 */
4package de.uka.ipd.sdq.pcm.gmf.resource.navigator;
5 
6import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
7import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
8import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
9import org.eclipse.gmf.runtime.emf.type.core.IElementType;
10import org.eclipse.gmf.runtime.notation.View;
11import org.eclipse.jface.resource.ImageDescriptor;
12import org.eclipse.jface.resource.ImageRegistry;
13import org.eclipse.jface.viewers.ITreePathLabelProvider;
14import org.eclipse.jface.viewers.LabelProvider;
15import org.eclipse.jface.viewers.TreePath;
16import org.eclipse.jface.viewers.ViewerLabel;
17import org.eclipse.swt.graphics.Image;
18import org.eclipse.ui.IMemento;
19import org.eclipse.ui.navigator.ICommonContentExtensionSite;
20import org.eclipse.ui.navigator.ICommonLabelProvider;
21 
22import de.uka.ipd.sdq.pcm.gmf.resource.edit.parts.CommunicationLinkResourceSpecificationEditPart;
23import de.uka.ipd.sdq.pcm.gmf.resource.edit.parts.CommunicationLinkResourceSpecificationFailureProbabilityEditPart;
24import de.uka.ipd.sdq.pcm.gmf.resource.edit.parts.LinkingResource2EditPart;
25import de.uka.ipd.sdq.pcm.gmf.resource.edit.parts.LinkingResourceConnectedResourceContainers_LinkingResourceEditPart;
26import de.uka.ipd.sdq.pcm.gmf.resource.edit.parts.LinkingResourceEntityNameEditPart;
27import de.uka.ipd.sdq.pcm.gmf.resource.edit.parts.ProcessingResourceSpecificationEditPart;
28import de.uka.ipd.sdq.pcm.gmf.resource.edit.parts.ProcessingResourceSpecificationMTTFEditPart;
29import de.uka.ipd.sdq.pcm.gmf.resource.edit.parts.ResourceContainerEditPart;
30import de.uka.ipd.sdq.pcm.gmf.resource.edit.parts.ResourceContainerEntityNameEditPart;
31import de.uka.ipd.sdq.pcm.gmf.resource.edit.parts.ResourceEnvironmentEditPart;
32import de.uka.ipd.sdq.pcm.gmf.resource.part.PalladioComponentModelDiagramEditorPlugin;
33import de.uka.ipd.sdq.pcm.gmf.resource.part.PalladioComponentModelVisualIDRegistry;
34import de.uka.ipd.sdq.pcm.gmf.resource.providers.PalladioComponentModelElementTypes;
35import de.uka.ipd.sdq.pcm.gmf.resource.providers.PalladioComponentModelParserProvider;
36import de.uka.ipd.sdq.pcm.resourceenvironment.LinkingResource;
37import de.uka.ipd.sdq.pcm.resourceenvironment.ResourceEnvironment;
38 
39/**
40 * @generated
41 */
42public class PalladioComponentModelNavigatorLabelProvider extends LabelProvider
43                implements ICommonLabelProvider, ITreePathLabelProvider {
44 
45        /**
46         * @generated
47         */
48        static {
49                PalladioComponentModelDiagramEditorPlugin
50                                .getInstance()
51                                .getImageRegistry()
52                                .put(
53                                                "Navigator?UnknownElement", ImageDescriptor.getMissingImageDescriptor()); //$NON-NLS-1$
54                PalladioComponentModelDiagramEditorPlugin
55                                .getInstance()
56                                .getImageRegistry()
57                                .put(
58                                                "Navigator?ImageNotFound", ImageDescriptor.getMissingImageDescriptor()); //$NON-NLS-1$
59        }
60 
61        /**
62         * @generated
63         */
64        public void updateLabel(ViewerLabel label, TreePath elementPath) {
65                Object element = elementPath.getLastSegment();
66                if (element instanceof PalladioComponentModelNavigatorItem
67                                && !isOwnView(((PalladioComponentModelNavigatorItem) element)
68                                                .getView())) {
69                        return;
70                }
71                label.setText(getText(element));
72                label.setImage(getImage(element));
73        }
74 
75        /**
76         * @generated
77         */
78        public Image getImage(Object element) {
79                if (element instanceof PalladioComponentModelNavigatorGroup) {
80                        PalladioComponentModelNavigatorGroup group = (PalladioComponentModelNavigatorGroup) element;
81                        return PalladioComponentModelDiagramEditorPlugin.getInstance()
82                                        .getBundledImage(group.getIcon());
83                }
84 
85                if (element instanceof PalladioComponentModelNavigatorItem) {
86                        PalladioComponentModelNavigatorItem navigatorItem = (PalladioComponentModelNavigatorItem) element;
87                        if (!isOwnView(navigatorItem.getView())) {
88                                return super.getImage(element);
89                        }
90                        return getImage(navigatorItem.getView());
91                }
92 
93                return super.getImage(element);
94        }
95 
96        /**
97         * @generated
98         */
99        public Image getImage(View view) {
100                switch (PalladioComponentModelVisualIDRegistry.getVisualID(view)) {
101                case ResourceEnvironmentEditPart.VISUAL_ID:
102                        return getImage(
103                                        "Navigator?Diagram?http://sdq.ipd.uka.de/PalladioComponentModel/ResourceEnvironment/4.0?ResourceEnvironment", PalladioComponentModelElementTypes.ResourceEnvironment_1000); //$NON-NLS-1$
104                case ResourceContainerEditPart.VISUAL_ID:
105                        return getImage(
106                                        "Navigator?TopLevelNode?http://sdq.ipd.uka.de/PalladioComponentModel/ResourceEnvironment/4.0?ResourceContainer", PalladioComponentModelElementTypes.ResourceContainer_2001); //$NON-NLS-1$
107                case LinkingResource2EditPart.VISUAL_ID:
108                        return getImage(
109                                        "Navigator?TopLevelNode?http://sdq.ipd.uka.de/PalladioComponentModel/ResourceEnvironment/4.0?LinkingResource", PalladioComponentModelElementTypes.LinkingResource_2003); //$NON-NLS-1$
110                case ProcessingResourceSpecificationEditPart.VISUAL_ID:
111                        return getImage(
112                                        "Navigator?Node?http://sdq.ipd.uka.de/PalladioComponentModel/ResourceEnvironment/4.0?ProcessingResourceSpecification", PalladioComponentModelElementTypes.ProcessingResourceSpecification_3001); //$NON-NLS-1$
113                case CommunicationLinkResourceSpecificationEditPart.VISUAL_ID:
114                        return getImage(
115                                        "Navigator?Node?http://sdq.ipd.uka.de/PalladioComponentModel/ResourceEnvironment/4.0?CommunicationLinkResourceSpecification", PalladioComponentModelElementTypes.CommunicationLinkResourceSpecification_3002); //$NON-NLS-1$
116                case LinkingResourceConnectedResourceContainers_LinkingResourceEditPart.VISUAL_ID:
117                        return getImage(
118                                        "Navigator?Link?http://sdq.ipd.uka.de/PalladioComponentModel/ResourceEnvironment/4.0?LinkingResource?connectedResourceContainers_LinkingResource", PalladioComponentModelElementTypes.LinkingResourceConnectedResourceContainers_LinkingResource_4002); //$NON-NLS-1$
119                }
120                return getImage("Navigator?UnknownElement", null); //$NON-NLS-1$
121        }
122 
123        /**
124         * @generated
125         */
126        private Image getImage(String key, IElementType elementType) {
127                ImageRegistry imageRegistry = PalladioComponentModelDiagramEditorPlugin
128                                .getInstance().getImageRegistry();
129                Image image = imageRegistry.get(key);
130                if (image == null
131                                && elementType != null
132                                && PalladioComponentModelElementTypes
133                                                .isKnownElementType(elementType)) {
134                        image = PalladioComponentModelElementTypes.getImage(elementType);
135                        imageRegistry.put(key, image);
136                }
137 
138                if (image == null) {
139                        image = imageRegistry.get("Navigator?ImageNotFound"); //$NON-NLS-1$
140                        imageRegistry.put(key, image);
141                }
142                return image;
143        }
144 
145        /**
146         * @generated
147         */
148        public String getText(Object element) {
149                if (element instanceof PalladioComponentModelNavigatorGroup) {
150                        PalladioComponentModelNavigatorGroup group = (PalladioComponentModelNavigatorGroup) element;
151                        return group.getGroupName();
152                }
153 
154                if (element instanceof PalladioComponentModelNavigatorItem) {
155                        PalladioComponentModelNavigatorItem navigatorItem = (PalladioComponentModelNavigatorItem) element;
156                        if (!isOwnView(navigatorItem.getView())) {
157                                return null;
158                        }
159                        return getText(navigatorItem.getView());
160                }
161 
162                return super.getText(element);
163        }
164 
165        /**
166         * @generated
167         */
168        public String getText(View view) {
169                if (view.getElement() != null && view.getElement().eIsProxy()) {
170                        return getUnresolvedDomainElementProxyText(view);
171                }
172                switch (PalladioComponentModelVisualIDRegistry.getVisualID(view)) {
173                case ResourceEnvironmentEditPart.VISUAL_ID:
174                        return getResourceEnvironment_1000Text(view);
175                case ResourceContainerEditPart.VISUAL_ID:
176                        return getResourceContainer_2001Text(view);
177                case LinkingResource2EditPart.VISUAL_ID:
178                        return getLinkingResource_2003Text(view);
179                case ProcessingResourceSpecificationEditPart.VISUAL_ID:
180                        return getProcessingResourceSpecification_3001Text(view);
181                case CommunicationLinkResourceSpecificationEditPart.VISUAL_ID:
182                        return getCommunicationLinkResourceSpecification_3002Text(view);
183                case LinkingResourceConnectedResourceContainers_LinkingResourceEditPart.VISUAL_ID:
184                        return getLinkingResourceConnectedResourceContainers_LinkingResource_4002Text(view);
185                }
186                return getUnknownElementText(view);
187        }
188 
189        /**
190         * @generated
191         */
192        private String getResourceEnvironment_1000Text(View view) {
193                ResourceEnvironment domainModelElement = (ResourceEnvironment) view
194                                .getElement();
195                if (domainModelElement != null) {
196                        return domainModelElement.getEntityName();
197                } else {
198                        PalladioComponentModelDiagramEditorPlugin.getInstance().logError(
199                                        "No domain element for view with visualID = " + 1000); //$NON-NLS-1$
200                        return ""; //$NON-NLS-1$
201                }
202        }
203 
204        /**
205         * @generated
206         */
207        private String getResourceContainer_2001Text(View view) {
208                IParser parser = PalladioComponentModelParserProvider
209                                .getParser(
210                                                PalladioComponentModelElementTypes.ResourceContainer_2001,
211                                                view.getElement() != null ? view.getElement() : view,
212                                                PalladioComponentModelVisualIDRegistry
213                                                                .getType(ResourceContainerEntityNameEditPart.VISUAL_ID));
214                if (parser != null) {
215                        return parser.getPrintString(new EObjectAdapter(
216                                        view.getElement() != null ? view.getElement() : view),
217                                        ParserOptions.NONE.intValue());
218                } else {
219                        PalladioComponentModelDiagramEditorPlugin.getInstance().logError(
220                                        "Parser was not found for label " + 5001); //$NON-NLS-1$
221                        return ""; //$NON-NLS-1$
222                }
223        }
224 
225        /**
226         * @generated
227         */
228        private String getLinkingResource_2003Text(View view) {
229                IParser parser = PalladioComponentModelParserProvider.getParser(
230                                PalladioComponentModelElementTypes.LinkingResource_2003, view
231                                                .getElement() != null ? view.getElement() : view,
232                                PalladioComponentModelVisualIDRegistry
233                                                .getType(LinkingResourceEntityNameEditPart.VISUAL_ID));
234                if (parser != null) {
235                        return parser.getPrintString(new EObjectAdapter(
236                                        view.getElement() != null ? view.getElement() : view),
237                                        ParserOptions.NONE.intValue());
238                } else {
239                        PalladioComponentModelDiagramEditorPlugin.getInstance().logError(
240                                        "Parser was not found for label " + 5012); //$NON-NLS-1$
241                        return ""; //$NON-NLS-1$
242                }
243        }
244 
245        /**
246         * @generated
247         */
248        private String getProcessingResourceSpecification_3001Text(View view) {
249                IParser parser = PalladioComponentModelParserProvider
250                                .getParser(
251                                                PalladioComponentModelElementTypes.ProcessingResourceSpecification_3001,
252                                                view.getElement() != null ? view.getElement() : view,
253                                                PalladioComponentModelVisualIDRegistry
254                                                                .getType(ProcessingResourceSpecificationMTTFEditPart.VISUAL_ID));
255                if (parser != null) {
256                        return parser.getPrintString(new EObjectAdapter(
257                                        view.getElement() != null ? view.getElement() : view),
258                                        ParserOptions.NONE.intValue());
259                } else {
260                        PalladioComponentModelDiagramEditorPlugin.getInstance().logError(
261                                        "Parser was not found for label " + 5002); //$NON-NLS-1$
262                        return ""; //$NON-NLS-1$
263                }
264        }
265 
266        /**
267         * @generated
268         */
269        private String getCommunicationLinkResourceSpecification_3002Text(View view) {
270                IParser parser = PalladioComponentModelParserProvider
271                                .getParser(
272                                                PalladioComponentModelElementTypes.CommunicationLinkResourceSpecification_3002,
273                                                view.getElement() != null ? view.getElement() : view,
274                                                PalladioComponentModelVisualIDRegistry
275                                                                .getType(CommunicationLinkResourceSpecificationFailureProbabilityEditPart.VISUAL_ID));
276                if (parser != null) {
277                        return parser.getPrintString(new EObjectAdapter(
278                                        view.getElement() != null ? view.getElement() : view),
279                                        ParserOptions.NONE.intValue());
280                } else {
281                        PalladioComponentModelDiagramEditorPlugin.getInstance().logError(
282                                        "Parser was not found for label " + 5005); //$NON-NLS-1$
283                        return ""; //$NON-NLS-1$
284                }
285        }
286 
287        /**
288         * @generated
289         */
290        private String getLinkingResourceConnectedResourceContainers_LinkingResource_4002Text(
291                        View view) {
292                return ""; //$NON-NLS-1$
293        }
294 
295        /**
296         * @generated
297         */
298        private String getUnknownElementText(View view) {
299                return "<UnknownElement Visual_ID = " + view.getType() + ">"; //$NON-NLS-1$  //$NON-NLS-2$
300        }
301 
302        /**
303         * @generated
304         */
305        private String getUnresolvedDomainElementProxyText(View view) {
306                return "<Unresolved domain element Visual_ID = " + view.getType() + ">"; //$NON-NLS-1$  //$NON-NLS-2$
307        }
308 
309        /**
310         * @generated
311         */
312        public void init(ICommonContentExtensionSite aConfig) {
313        }
314 
315        /**
316         * @generated
317         */
318        public void restoreState(IMemento aMemento) {
319        }
320 
321        /**
322         * @generated
323         */
324        public void saveState(IMemento aMemento) {
325        }
326 
327        /**
328         * @generated
329         */
330        public String getDescription(Object anElement) {
331                return null;
332        }
333 
334        /**
335         * @generated
336         */
337        private boolean isOwnView(View view) {
338                return ResourceEnvironmentEditPart.MODEL_ID
339                                .equals(PalladioComponentModelVisualIDRegistry.getModelID(view));
340        }
341 
342}

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