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

COVERAGE SUMMARY FOR SOURCE FILE [PalladioComponentModelElementTypes.java]

nameclass, %method, %block, %line, %
PalladioComponentModelElementTypes.java0%   (0/1)0%   (0/13)0%   (0/524)0%   (0/191)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class PalladioComponentModelElementTypes0%   (0/1)0%   (0/13)0%   (0/524)0%   (0/191)
<static initializer> 0%   (0/1)0%   (0/73)0%   (0/25)
PalladioComponentModelElementTypes (): void 0%   (0/1)0%   (0/3)0%   (0/2)
getElement (IAdaptable): ENamedElement 0%   (0/1)0%   (0/159)0%   (0/62)
getElementType (String): IElementType 0%   (0/1)0%   (0/4)0%   (0/1)
getElementType (int): IElementType 0%   (0/1)0%   (0/52)0%   (0/26)
getImage (ENamedElement): Image 0%   (0/1)0%   (0/26)0%   (0/9)
getImage (IAdaptable): Image 0%   (0/1)0%   (0/10)0%   (0/4)
getImageDescriptor (ENamedElement): ImageDescriptor 0%   (0/1)0%   (0/22)0%   (0/8)
getImageDescriptor (IAdaptable): ImageDescriptor 0%   (0/1)0%   (0/10)0%   (0/4)
getImageRegistry (): ImageRegistry 0%   (0/1)0%   (0/8)0%   (0/3)
getImageRegistryKey (ENamedElement): String 0%   (0/1)0%   (0/3)0%   (0/1)
getProvidedImageDescriptor (ENamedElement): ImageDescriptor 0%   (0/1)0%   (0/48)0%   (0/17)
isKnownElementType (IElementType): boolean 0%   (0/1)0%   (0/106)0%   (0/29)

1/*
2 * Copyright 2007, IPD, SDQ, University of Karlsruhe
3 */
4package de.uka.ipd.sdq.pcm.gmf.repository.providers;
5 
6import java.util.HashSet;
7import java.util.IdentityHashMap;
8import java.util.Map;
9import java.util.Set;
10 
11import org.eclipse.core.runtime.IAdaptable;
12import org.eclipse.emf.ecore.EClass;
13import org.eclipse.emf.ecore.EClassifier;
14import org.eclipse.emf.ecore.ENamedElement;
15import org.eclipse.emf.ecore.EStructuralFeature;
16import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
17import org.eclipse.gmf.runtime.emf.type.core.IElementType;
18import org.eclipse.jface.resource.ImageDescriptor;
19import org.eclipse.jface.resource.ImageRegistry;
20import org.eclipse.swt.graphics.Image;
21 
22import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.BasicComponentEditPart;
23import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.CompleteComponentTypeEditPart;
24import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.CompleteComponentTypeParentProvidesComponentTypesEditPart;
25import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.CompositeComponentEditPart;
26import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.EventGroupEditPart;
27import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.EventTypeEditPart;
28import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.ImplementationComponentTypeParentCompleteComponentTypesEditPart;
29import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.InfrastructureInterfaceEditPart;
30import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.InfrastructureProvidedRoleEditPart;
31import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.InfrastructureRequiredRoleEditPart;
32import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.InfrastructureSignatureEditPart;
33import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.OperationInterfaceEditPart;
34import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.OperationProvidedRoleEditPart;
35import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.OperationRequiredRoleEditPart;
36import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.OperationSignatureEditPart;
37import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.PassiveResourceEditPart;
38import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.ProvidesComponentTypeEditPart;
39import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.RepositoryEditPart;
40import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.ResourceDemandingSEFFEditPart;
41import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.SinkRoleEditPart;
42import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.SourceRoleEditPart;
43import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.SubSystemEditPart;
44import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.VariableCharacterisationEditPart;
45import de.uka.ipd.sdq.pcm.gmf.repository.edit.parts.VariableUsageEditPart;
46import de.uka.ipd.sdq.pcm.gmf.repository.part.PalladioComponentModelRepositoryDiagramEditorPlugin;
47import de.uka.ipd.sdq.pcm.parameter.ParameterPackage;
48import de.uka.ipd.sdq.pcm.repository.RepositoryPackage;
49import de.uka.ipd.sdq.pcm.seff.SeffPackage;
50import de.uka.ipd.sdq.pcm.subsystem.SubsystemPackage;
51 
52/**
53 * @generated
54 */
55public class PalladioComponentModelElementTypes extends ElementInitializers {
56 
57        /**
58         * @generated
59         */
60        private PalladioComponentModelElementTypes() {
61        }
62 
63        /**
64         * @generated
65         */
66        private static Map elements;
67 
68        /**
69         * @generated
70         */
71        private static ImageRegistry imageRegistry;
72 
73        /**
74         * @generated
75         */
76        private static Set KNOWN_ELEMENT_TYPES;
77 
78        /**
79         * @generated
80         */
81        public static final IElementType Repository_1000 = getElementType("de.uka.ipd.sdq.pcm.gmf.repository.Repository_1000"); //$NON-NLS-1$
82 
83        /**
84         * @generated
85         */
86        public static final IElementType OperationInterface_2107 = getElementType("de.uka.ipd.sdq.pcm.gmf.repository.OperationInterface_2107"); //$NON-NLS-1$
87 
88        /**
89         * @generated
90         */
91        public static final IElementType EventGroup_2108 = getElementType("de.uka.ipd.sdq.pcm.gmf.repository.EventGroup_2108"); //$NON-NLS-1$
92 
93        /**
94         * @generated
95         */
96        public static final IElementType BasicComponent_2102 = getElementType("de.uka.ipd.sdq.pcm.gmf.repository.BasicComponent_2102"); //$NON-NLS-1$
97 
98        /**
99         * @generated
100         */
101        public static final IElementType CompositeComponent_2103 = getElementType("de.uka.ipd.sdq.pcm.gmf.repository.CompositeComponent_2103"); //$NON-NLS-1$
102 
103        /**
104         * @generated
105         */
106        public static final IElementType CompleteComponentType_2104 = getElementType("de.uka.ipd.sdq.pcm.gmf.repository.CompleteComponentType_2104"); //$NON-NLS-1$
107 
108        /**
109         * @generated
110         */
111        public static final IElementType ProvidesComponentType_2105 = getElementType("de.uka.ipd.sdq.pcm.gmf.repository.ProvidesComponentType_2105"); //$NON-NLS-1$
112 
113        /**
114         * @generated
115         */
116        public static final IElementType SubSystem_2106 = getElementType("de.uka.ipd.sdq.pcm.gmf.repository.SubSystem_2106"); //$NON-NLS-1$
117 
118        /**
119         * @generated
120         */
121        public static final IElementType InfrastructureInterface_2109 = getElementType("de.uka.ipd.sdq.pcm.gmf.repository.InfrastructureInterface_2109"); //$NON-NLS-1$
122 
123        /**
124         * @generated
125         */
126        public static final IElementType OperationSignature_3106 = getElementType("de.uka.ipd.sdq.pcm.gmf.repository.OperationSignature_3106"); //$NON-NLS-1$
127 
128        /**
129         * @generated
130         */
131        public static final IElementType EventType_3107 = getElementType("de.uka.ipd.sdq.pcm.gmf.repository.EventType_3107"); //$NON-NLS-1$
132 
133        /**
134         * @generated
135         */
136        public static final IElementType ResourceDemandingSEFF_3102 = getElementType("de.uka.ipd.sdq.pcm.gmf.repository.ResourceDemandingSEFF_3102"); //$NON-NLS-1$
137 
138        /**
139         * @generated
140         */
141        public static final IElementType PassiveResource_3103 = getElementType("de.uka.ipd.sdq.pcm.gmf.repository.PassiveResource_3103"); //$NON-NLS-1$
142 
143        /**
144         * @generated
145         */
146        public static final IElementType VariableUsage_3104 = getElementType("de.uka.ipd.sdq.pcm.gmf.repository.VariableUsage_3104"); //$NON-NLS-1$
147 
148        /**
149         * @generated
150         */
151        public static final IElementType VariableCharacterisation_3105 = getElementType("de.uka.ipd.sdq.pcm.gmf.repository.VariableCharacterisation_3105"); //$NON-NLS-1$
152 
153        /**
154         * @generated
155         */
156        public static final IElementType InfrastructureSignature_3108 = getElementType("de.uka.ipd.sdq.pcm.gmf.repository.InfrastructureSignature_3108"); //$NON-NLS-1$
157 
158        /**
159         * @generated
160         */
161        public static final IElementType OperationProvidedRole_4105 = getElementType("de.uka.ipd.sdq.pcm.gmf.repository.OperationProvidedRole_4105"); //$NON-NLS-1$
162 
163        /**
164         * @generated
165         */
166        public static final IElementType InfrastructureProvidedRole_4111 = getElementType("de.uka.ipd.sdq.pcm.gmf.repository.InfrastructureProvidedRole_4111"); //$NON-NLS-1$
167 
168        /**
169         * @generated
170         */
171        public static final IElementType InfrastructureRequiredRole_4112 = getElementType("de.uka.ipd.sdq.pcm.gmf.repository.InfrastructureRequiredRole_4112"); //$NON-NLS-1$
172 
173        /**
174         * @generated
175         */
176        public static final IElementType SinkRole_4109 = getElementType("de.uka.ipd.sdq.pcm.gmf.repository.SinkRole_4109"); //$NON-NLS-1$
177 
178        /**
179         * @generated
180         */
181        public static final IElementType OperationRequiredRole_4106 = getElementType("de.uka.ipd.sdq.pcm.gmf.repository.OperationRequiredRole_4106"); //$NON-NLS-1$
182 
183        /**
184         * @generated
185         */
186        public static final IElementType ImplementationComponentTypeParentCompleteComponentTypes_4103 = getElementType("de.uka.ipd.sdq.pcm.gmf.repository.ImplementationComponentTypeParentCompleteComponentTypes_4103"); //$NON-NLS-1$
187 
188        /**
189         * @generated
190         */
191        public static final IElementType CompleteComponentTypeParentProvidesComponentTypes_4104 = getElementType("de.uka.ipd.sdq.pcm.gmf.repository.CompleteComponentTypeParentProvidesComponentTypes_4104"); //$NON-NLS-1$
192 
193        /**
194         * @generated
195         */
196        public static final IElementType SourceRole_4110 = getElementType("de.uka.ipd.sdq.pcm.gmf.repository.SourceRole_4110"); //$NON-NLS-1$
197 
198        /**
199         * @generated
200         */
201        private static ImageRegistry getImageRegistry() {
202                if (imageRegistry == null) {
203                        imageRegistry = new ImageRegistry();
204                }
205                return imageRegistry;
206        }
207 
208        /**
209         * @generated
210         */
211        private static String getImageRegistryKey(ENamedElement element) {
212                return element.getName();
213        }
214 
215        /**
216         * @generated
217         */
218        private static ImageDescriptor getProvidedImageDescriptor(
219                        ENamedElement element) {
220                if (element instanceof EStructuralFeature) {
221                        EStructuralFeature feature = ((EStructuralFeature) element);
222                        EClass eContainingClass = feature.getEContainingClass();
223                        EClassifier eType = feature.getEType();
224                        if (eContainingClass != null && !eContainingClass.isAbstract()) {
225                                element = eContainingClass;
226                        } else if (eType instanceof EClass
227                                        && !((EClass) eType).isAbstract()) {
228                                element = eType;
229                        }
230                }
231                if (element instanceof EClass) {
232                        EClass eClass = (EClass) element;
233                        if (!eClass.isAbstract()) {
234                                return PalladioComponentModelRepositoryDiagramEditorPlugin
235                                                .getInstance().getItemImageDescriptor(
236                                                                eClass.getEPackage().getEFactoryInstance()
237                                                                                .create(eClass));
238                        }
239                }
240                // TODO : support structural features
241                return null;
242        }
243 
244        /**
245         * @generated
246         */
247        public static ImageDescriptor getImageDescriptor(ENamedElement element) {
248                String key = getImageRegistryKey(element);
249                ImageDescriptor imageDescriptor = getImageRegistry().getDescriptor(key);
250                if (imageDescriptor == null) {
251                        imageDescriptor = getProvidedImageDescriptor(element);
252                        if (imageDescriptor == null) {
253                                imageDescriptor = ImageDescriptor.getMissingImageDescriptor();
254                        }
255                        getImageRegistry().put(key, imageDescriptor);
256                }
257                return imageDescriptor;
258        }
259 
260        /**
261         * @generated
262         */
263        public static Image getImage(ENamedElement element) {
264                String key = getImageRegistryKey(element);
265                Image image = getImageRegistry().get(key);
266                if (image == null) {
267                        ImageDescriptor imageDescriptor = getProvidedImageDescriptor(element);
268                        if (imageDescriptor == null) {
269                                imageDescriptor = ImageDescriptor.getMissingImageDescriptor();
270                        }
271                        getImageRegistry().put(key, imageDescriptor);
272                        image = getImageRegistry().get(key);
273                }
274                return image;
275        }
276 
277        /**
278         * @generated
279         */
280        public static ImageDescriptor getImageDescriptor(IAdaptable hint) {
281                ENamedElement element = getElement(hint);
282                if (element == null) {
283                        return null;
284                }
285                return getImageDescriptor(element);
286        }
287 
288        /**
289         * @generated
290         */
291        public static Image getImage(IAdaptable hint) {
292                ENamedElement element = getElement(hint);
293                if (element == null) {
294                        return null;
295                }
296                return getImage(element);
297        }
298 
299        /**
300         * Returns 'type' of the ecore object associated with the hint.
301         * 
302         * @generated
303         */
304        public static ENamedElement getElement(IAdaptable hint) {
305                Object type = hint.getAdapter(IElementType.class);
306                if (elements == null) {
307                        elements = new IdentityHashMap();
308 
309                        elements.put(Repository_1000, RepositoryPackage.eINSTANCE
310                                        .getRepository());
311 
312                        elements.put(OperationInterface_2107, RepositoryPackage.eINSTANCE
313                                        .getOperationInterface());
314 
315                        elements.put(EventGroup_2108, RepositoryPackage.eINSTANCE
316                                        .getEventGroup());
317 
318                        elements.put(BasicComponent_2102, RepositoryPackage.eINSTANCE
319                                        .getBasicComponent());
320 
321                        elements.put(CompositeComponent_2103, RepositoryPackage.eINSTANCE
322                                        .getCompositeComponent());
323 
324                        elements.put(CompleteComponentType_2104,
325                                        RepositoryPackage.eINSTANCE.getCompleteComponentType());
326 
327                        elements.put(ProvidesComponentType_2105,
328                                        RepositoryPackage.eINSTANCE.getProvidesComponentType());
329 
330                        elements.put(SubSystem_2106, SubsystemPackage.eINSTANCE
331                                        .getSubSystem());
332 
333                        elements.put(InfrastructureInterface_2109,
334                                        RepositoryPackage.eINSTANCE.getInfrastructureInterface());
335 
336                        elements.put(OperationSignature_3106, RepositoryPackage.eINSTANCE
337                                        .getOperationSignature());
338 
339                        elements.put(EventType_3107, RepositoryPackage.eINSTANCE
340                                        .getEventType());
341 
342                        elements.put(ResourceDemandingSEFF_3102, SeffPackage.eINSTANCE
343                                        .getResourceDemandingSEFF());
344 
345                        elements.put(PassiveResource_3103, RepositoryPackage.eINSTANCE
346                                        .getPassiveResource());
347 
348                        elements.put(VariableUsage_3104, ParameterPackage.eINSTANCE
349                                        .getVariableUsage());
350 
351                        elements.put(VariableCharacterisation_3105,
352                                        ParameterPackage.eINSTANCE.getVariableCharacterisation());
353 
354                        elements.put(InfrastructureSignature_3108,
355                                        RepositoryPackage.eINSTANCE.getInfrastructureSignature());
356 
357                        elements.put(OperationProvidedRole_4105,
358                                        RepositoryPackage.eINSTANCE.getOperationProvidedRole());
359 
360                        elements
361                                        .put(InfrastructureProvidedRole_4111,
362                                                        RepositoryPackage.eINSTANCE
363                                                                        .getInfrastructureProvidedRole());
364 
365                        elements
366                                        .put(InfrastructureRequiredRole_4112,
367                                                        RepositoryPackage.eINSTANCE
368                                                                        .getInfrastructureRequiredRole());
369 
370                        elements.put(SinkRole_4109, RepositoryPackage.eINSTANCE
371                                        .getSinkRole());
372 
373                        elements.put(OperationRequiredRole_4106,
374                                        RepositoryPackage.eINSTANCE.getOperationRequiredRole());
375 
376                        elements
377                                        .put(
378                                                        ImplementationComponentTypeParentCompleteComponentTypes_4103,
379                                                        RepositoryPackage.eINSTANCE
380                                                                        .getImplementationComponentType_ParentCompleteComponentTypes());
381 
382                        elements
383                                        .put(
384                                                        CompleteComponentTypeParentProvidesComponentTypes_4104,
385                                                        RepositoryPackage.eINSTANCE
386                                                                        .getCompleteComponentType_ParentProvidesComponentTypes());
387 
388                        elements.put(SourceRole_4110, RepositoryPackage.eINSTANCE
389                                        .getSourceRole());
390                }
391                return (ENamedElement) elements.get(type);
392        }
393 
394        /**
395         * @generated
396         */
397        private static IElementType getElementType(String id) {
398                return ElementTypeRegistry.getInstance().getType(id);
399        }
400 
401        /**
402         * @generated
403         */
404        public static boolean isKnownElementType(IElementType elementType) {
405                if (KNOWN_ELEMENT_TYPES == null) {
406                        KNOWN_ELEMENT_TYPES = new HashSet();
407                        KNOWN_ELEMENT_TYPES.add(Repository_1000);
408                        KNOWN_ELEMENT_TYPES.add(OperationInterface_2107);
409                        KNOWN_ELEMENT_TYPES.add(EventGroup_2108);
410                        KNOWN_ELEMENT_TYPES.add(BasicComponent_2102);
411                        KNOWN_ELEMENT_TYPES.add(CompositeComponent_2103);
412                        KNOWN_ELEMENT_TYPES.add(CompleteComponentType_2104);
413                        KNOWN_ELEMENT_TYPES.add(ProvidesComponentType_2105);
414                        KNOWN_ELEMENT_TYPES.add(SubSystem_2106);
415                        KNOWN_ELEMENT_TYPES.add(InfrastructureInterface_2109);
416                        KNOWN_ELEMENT_TYPES.add(OperationSignature_3106);
417                        KNOWN_ELEMENT_TYPES.add(EventType_3107);
418                        KNOWN_ELEMENT_TYPES.add(ResourceDemandingSEFF_3102);
419                        KNOWN_ELEMENT_TYPES.add(PassiveResource_3103);
420                        KNOWN_ELEMENT_TYPES.add(VariableUsage_3104);
421                        KNOWN_ELEMENT_TYPES.add(VariableCharacterisation_3105);
422                        KNOWN_ELEMENT_TYPES.add(InfrastructureSignature_3108);
423                        KNOWN_ELEMENT_TYPES.add(OperationProvidedRole_4105);
424                        KNOWN_ELEMENT_TYPES.add(InfrastructureProvidedRole_4111);
425                        KNOWN_ELEMENT_TYPES.add(InfrastructureRequiredRole_4112);
426                        KNOWN_ELEMENT_TYPES.add(SinkRole_4109);
427                        KNOWN_ELEMENT_TYPES.add(OperationRequiredRole_4106);
428                        KNOWN_ELEMENT_TYPES
429                                        .add(ImplementationComponentTypeParentCompleteComponentTypes_4103);
430                        KNOWN_ELEMENT_TYPES
431                                        .add(CompleteComponentTypeParentProvidesComponentTypes_4104);
432                        KNOWN_ELEMENT_TYPES.add(SourceRole_4110);
433                }
434                return KNOWN_ELEMENT_TYPES.contains(elementType);
435        }
436 
437        /**
438         * @generated
439         */
440        public static IElementType getElementType(int visualID) {
441                switch (visualID) {
442                case RepositoryEditPart.VISUAL_ID:
443                        return Repository_1000;
444                case OperationInterfaceEditPart.VISUAL_ID:
445                        return OperationInterface_2107;
446                case EventGroupEditPart.VISUAL_ID:
447                        return EventGroup_2108;
448                case BasicComponentEditPart.VISUAL_ID:
449                        return BasicComponent_2102;
450                case CompositeComponentEditPart.VISUAL_ID:
451                        return CompositeComponent_2103;
452                case CompleteComponentTypeEditPart.VISUAL_ID:
453                        return CompleteComponentType_2104;
454                case ProvidesComponentTypeEditPart.VISUAL_ID:
455                        return ProvidesComponentType_2105;
456                case SubSystemEditPart.VISUAL_ID:
457                        return SubSystem_2106;
458                case InfrastructureInterfaceEditPart.VISUAL_ID:
459                        return InfrastructureInterface_2109;
460                case OperationSignatureEditPart.VISUAL_ID:
461                        return OperationSignature_3106;
462                case EventTypeEditPart.VISUAL_ID:
463                        return EventType_3107;
464                case ResourceDemandingSEFFEditPart.VISUAL_ID:
465                        return ResourceDemandingSEFF_3102;
466                case PassiveResourceEditPart.VISUAL_ID:
467                        return PassiveResource_3103;
468                case VariableUsageEditPart.VISUAL_ID:
469                        return VariableUsage_3104;
470                case VariableCharacterisationEditPart.VISUAL_ID:
471                        return VariableCharacterisation_3105;
472                case InfrastructureSignatureEditPart.VISUAL_ID:
473                        return InfrastructureSignature_3108;
474                case OperationProvidedRoleEditPart.VISUAL_ID:
475                        return OperationProvidedRole_4105;
476                case InfrastructureProvidedRoleEditPart.VISUAL_ID:
477                        return InfrastructureProvidedRole_4111;
478                case InfrastructureRequiredRoleEditPart.VISUAL_ID:
479                        return InfrastructureRequiredRole_4112;
480                case SinkRoleEditPart.VISUAL_ID:
481                        return SinkRole_4109;
482                case OperationRequiredRoleEditPart.VISUAL_ID:
483                        return OperationRequiredRole_4106;
484                case ImplementationComponentTypeParentCompleteComponentTypesEditPart.VISUAL_ID:
485                        return ImplementationComponentTypeParentCompleteComponentTypes_4103;
486                case CompleteComponentTypeParentProvidesComponentTypesEditPart.VISUAL_ID:
487                        return CompleteComponentTypeParentProvidesComponentTypes_4104;
488                case SourceRoleEditPart.VISUAL_ID:
489                        return SourceRole_4110;
490                }
491                return null;
492        }
493 
494}

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