1 | /* |
2 | * Copyright 2007, IPD, SDQ, University of Karlsruhe |
3 | */ |
4 | package de.uka.ipd.sdq.pcm.gmf.repository.navigator; |
5 | |
6 | import org.eclipse.core.runtime.IAdapterFactory; |
7 | import org.eclipse.core.runtime.Platform; |
8 | import org.eclipse.core.runtime.PlatformObject; |
9 | import org.eclipse.emf.ecore.EObject; |
10 | import org.eclipse.emf.ecore.util.EcoreUtil; |
11 | import org.eclipse.ui.views.properties.IPropertySource; |
12 | import org.eclipse.ui.views.properties.IPropertySourceProvider; |
13 | |
14 | /** |
15 | * @generated |
16 | */ |
17 | public class PalladioComponentModelDomainNavigatorItem extends PlatformObject { |
18 | |
19 | /** |
20 | * @generated |
21 | */ |
22 | static { |
23 | final Class[] supportedTypes = new Class[] { EObject.class, |
24 | IPropertySource.class }; |
25 | Platform.getAdapterManager().registerAdapters( |
26 | new IAdapterFactory() { |
27 | |
28 | public Object getAdapter(Object adaptableObject, |
29 | Class adapterType) { |
30 | if (adaptableObject instanceof de.uka.ipd.sdq.pcm.gmf.repository.navigator.PalladioComponentModelDomainNavigatorItem) { |
31 | de.uka.ipd.sdq.pcm.gmf.repository.navigator.PalladioComponentModelDomainNavigatorItem domainNavigatorItem = (de.uka.ipd.sdq.pcm.gmf.repository.navigator.PalladioComponentModelDomainNavigatorItem) adaptableObject; |
32 | EObject eObject = domainNavigatorItem.getEObject(); |
33 | if (adapterType == EObject.class) { |
34 | return eObject; |
35 | } |
36 | if (adapterType == IPropertySource.class) { |
37 | return domainNavigatorItem |
38 | .getPropertySourceProvider() |
39 | .getPropertySource(eObject); |
40 | } |
41 | } |
42 | |
43 | return null; |
44 | } |
45 | |
46 | public Class[] getAdapterList() { |
47 | return supportedTypes; |
48 | } |
49 | }, |
50 | de.uka.ipd.sdq.pcm.gmf.repository.navigator.PalladioComponentModelDomainNavigatorItem.class); |
51 | } |
52 | |
53 | /** |
54 | * @generated |
55 | */ |
56 | private Object myParent; |
57 | |
58 | /** |
59 | * @generated |
60 | */ |
61 | private EObject myEObject; |
62 | |
63 | /** |
64 | * @generated |
65 | */ |
66 | private IPropertySourceProvider myPropertySourceProvider; |
67 | |
68 | /** |
69 | * @generated |
70 | */ |
71 | public PalladioComponentModelDomainNavigatorItem(EObject eObject, |
72 | Object parent, IPropertySourceProvider propertySourceProvider) { |
73 | myParent = parent; |
74 | myEObject = eObject; |
75 | myPropertySourceProvider = propertySourceProvider; |
76 | } |
77 | |
78 | /** |
79 | * @generated |
80 | */ |
81 | public Object getParent() { |
82 | return myParent; |
83 | } |
84 | |
85 | /** |
86 | * @generated |
87 | */ |
88 | public EObject getEObject() { |
89 | return myEObject; |
90 | } |
91 | |
92 | /** |
93 | * @generated |
94 | */ |
95 | public IPropertySourceProvider getPropertySourceProvider() { |
96 | return myPropertySourceProvider; |
97 | } |
98 | |
99 | /** |
100 | * @generated |
101 | */ |
102 | public boolean equals(Object obj) { |
103 | if (obj instanceof de.uka.ipd.sdq.pcm.gmf.repository.navigator.PalladioComponentModelDomainNavigatorItem) { |
104 | return EcoreUtil |
105 | .getURI(getEObject()) |
106 | .equals( |
107 | EcoreUtil |
108 | .getURI(((de.uka.ipd.sdq.pcm.gmf.repository.navigator.PalladioComponentModelDomainNavigatorItem) obj) |
109 | .getEObject())); |
110 | } |
111 | return super.equals(obj); |
112 | } |
113 | |
114 | /** |
115 | * @generated |
116 | */ |
117 | public int hashCode() { |
118 | return EcoreUtil.getURI(getEObject()).hashCode(); |
119 | } |
120 | |
121 | } |