|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 package cenrep.provider; |
|
18 |
|
19 |
|
20 import java.util.Collection; |
|
21 import java.util.List; |
|
22 |
|
23 import org.eclipse.emf.common.notify.AdapterFactory; |
|
24 import org.eclipse.emf.common.notify.Notification; |
|
25 import org.eclipse.emf.common.util.ResourceLocator; |
|
26 import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
|
27 import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
|
28 import org.eclipse.emf.edit.provider.IItemLabelProvider; |
|
29 import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
|
30 import org.eclipse.emf.edit.provider.IItemPropertySource; |
|
31 import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
|
32 import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
|
33 |
|
34 import cenrep.CenrepPackage; |
|
35 import cenrep.Meta; |
|
36 |
|
37 /** |
|
38 * This is the item provider adapter for a {@link cenrep.Meta} object. |
|
39 * <!-- begin-user-doc --> |
|
40 * <!-- end-user-doc --> |
|
41 * @generated |
|
42 */ |
|
43 public class MetaItemProvider |
|
44 extends CommonAttrsItemProvider |
|
45 implements |
|
46 IEditingDomainItemProvider, |
|
47 IStructuredItemContentProvider, |
|
48 ITreeItemContentProvider, |
|
49 IItemLabelProvider, |
|
50 IItemPropertySource { |
|
51 /** |
|
52 * This constructs an instance from a factory and a notifier. |
|
53 * <!-- begin-user-doc --> |
|
54 * <!-- end-user-doc --> |
|
55 * @generated |
|
56 */ |
|
57 public MetaItemProvider(AdapterFactory adapterFactory) { |
|
58 super(adapterFactory); |
|
59 } |
|
60 |
|
61 /** |
|
62 * This returns the property descriptors for the adapted class. |
|
63 * <!-- begin-user-doc --> |
|
64 * <!-- end-user-doc --> |
|
65 * @generated |
|
66 */ |
|
67 @Override |
|
68 public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
|
69 if (itemPropertyDescriptors == null) { |
|
70 super.getPropertyDescriptors(object); |
|
71 |
|
72 addIdentificationPropertyDescriptor(object); |
|
73 addDatePropertyDescriptor(object); |
|
74 addPlatformPropertyDescriptor(object); |
|
75 addOwnerPropertyDescriptor(object); |
|
76 addEditorPropertyDescriptor(object); |
|
77 addStatusPropertyDescriptor(object); |
|
78 addVersionPropertyDescriptor(object); |
|
79 addProductPropertyDescriptor(object); |
|
80 addReleasePropertyDescriptor(object); |
|
81 } |
|
82 return itemPropertyDescriptors; |
|
83 } |
|
84 |
|
85 /** |
|
86 * This adds a property descriptor for the Identification feature. |
|
87 * <!-- begin-user-doc --> |
|
88 * <!-- end-user-doc --> |
|
89 * @generated |
|
90 */ |
|
91 protected void addIdentificationPropertyDescriptor(Object object) { |
|
92 itemPropertyDescriptors.add |
|
93 (createItemPropertyDescriptor |
|
94 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
|
95 getResourceLocator(), |
|
96 getString("_UI_Meta_identification_feature"), |
|
97 getString("_UI_PropertyDescriptor_description", "_UI_Meta_identification_feature", "_UI_Meta_type"), |
|
98 CenrepPackage.Literals.META__IDENTIFICATION, |
|
99 true, |
|
100 false, |
|
101 true, |
|
102 null, |
|
103 null, |
|
104 null)); |
|
105 } |
|
106 |
|
107 /** |
|
108 * This adds a property descriptor for the Date feature. |
|
109 * <!-- begin-user-doc --> |
|
110 * <!-- end-user-doc --> |
|
111 * @generated |
|
112 */ |
|
113 protected void addDatePropertyDescriptor(Object object) { |
|
114 itemPropertyDescriptors.add |
|
115 (createItemPropertyDescriptor |
|
116 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
|
117 getResourceLocator(), |
|
118 getString("_UI_Meta_date_feature"), |
|
119 getString("_UI_PropertyDescriptor_description", "_UI_Meta_date_feature", "_UI_Meta_type"), |
|
120 CenrepPackage.Literals.META__DATE, |
|
121 true, |
|
122 false, |
|
123 true, |
|
124 null, |
|
125 null, |
|
126 null)); |
|
127 } |
|
128 |
|
129 /** |
|
130 * This adds a property descriptor for the Platform feature. |
|
131 * <!-- begin-user-doc --> |
|
132 * <!-- end-user-doc --> |
|
133 * @generated |
|
134 */ |
|
135 protected void addPlatformPropertyDescriptor(Object object) { |
|
136 itemPropertyDescriptors.add |
|
137 (createItemPropertyDescriptor |
|
138 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
|
139 getResourceLocator(), |
|
140 getString("_UI_Meta_platform_feature"), |
|
141 getString("_UI_PropertyDescriptor_description", "_UI_Meta_platform_feature", "_UI_Meta_type"), |
|
142 CenrepPackage.Literals.META__PLATFORM, |
|
143 true, |
|
144 false, |
|
145 true, |
|
146 null, |
|
147 null, |
|
148 null)); |
|
149 } |
|
150 |
|
151 /** |
|
152 * This adds a property descriptor for the Owner feature. |
|
153 * <!-- begin-user-doc --> |
|
154 * <!-- end-user-doc --> |
|
155 * @generated |
|
156 */ |
|
157 protected void addOwnerPropertyDescriptor(Object object) { |
|
158 itemPropertyDescriptors.add |
|
159 (createItemPropertyDescriptor |
|
160 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
|
161 getResourceLocator(), |
|
162 getString("_UI_Meta_owner_feature"), |
|
163 getString("_UI_PropertyDescriptor_description", "_UI_Meta_owner_feature", "_UI_Meta_type"), |
|
164 CenrepPackage.Literals.META__OWNER, |
|
165 true, |
|
166 false, |
|
167 true, |
|
168 null, |
|
169 null, |
|
170 null)); |
|
171 } |
|
172 |
|
173 /** |
|
174 * This adds a property descriptor for the Editor feature. |
|
175 * <!-- begin-user-doc --> |
|
176 * <!-- end-user-doc --> |
|
177 * @generated |
|
178 */ |
|
179 protected void addEditorPropertyDescriptor(Object object) { |
|
180 itemPropertyDescriptors.add |
|
181 (createItemPropertyDescriptor |
|
182 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
|
183 getResourceLocator(), |
|
184 getString("_UI_Meta_editor_feature"), |
|
185 getString("_UI_PropertyDescriptor_description", "_UI_Meta_editor_feature", "_UI_Meta_type"), |
|
186 CenrepPackage.Literals.META__EDITOR, |
|
187 true, |
|
188 false, |
|
189 true, |
|
190 null, |
|
191 null, |
|
192 null)); |
|
193 } |
|
194 |
|
195 /** |
|
196 * This adds a property descriptor for the Status feature. |
|
197 * <!-- begin-user-doc --> |
|
198 * <!-- end-user-doc --> |
|
199 * @generated |
|
200 */ |
|
201 protected void addStatusPropertyDescriptor(Object object) { |
|
202 itemPropertyDescriptors.add |
|
203 (createItemPropertyDescriptor |
|
204 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
|
205 getResourceLocator(), |
|
206 getString("_UI_Meta_status_feature"), |
|
207 getString("_UI_PropertyDescriptor_description", "_UI_Meta_status_feature", "_UI_Meta_type"), |
|
208 CenrepPackage.Literals.META__STATUS, |
|
209 true, |
|
210 false, |
|
211 true, |
|
212 null, |
|
213 null, |
|
214 null)); |
|
215 } |
|
216 |
|
217 /** |
|
218 * This adds a property descriptor for the Version feature. |
|
219 * <!-- begin-user-doc --> |
|
220 * <!-- end-user-doc --> |
|
221 * @generated |
|
222 */ |
|
223 protected void addVersionPropertyDescriptor(Object object) { |
|
224 itemPropertyDescriptors.add |
|
225 (createItemPropertyDescriptor |
|
226 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
|
227 getResourceLocator(), |
|
228 getString("_UI_Meta_version_feature"), |
|
229 getString("_UI_PropertyDescriptor_description", "_UI_Meta_version_feature", "_UI_Meta_type"), |
|
230 CenrepPackage.Literals.META__VERSION, |
|
231 true, |
|
232 false, |
|
233 true, |
|
234 null, |
|
235 null, |
|
236 null)); |
|
237 } |
|
238 |
|
239 /** |
|
240 * This adds a property descriptor for the Product feature. |
|
241 * <!-- begin-user-doc --> |
|
242 * <!-- end-user-doc --> |
|
243 * @generated |
|
244 */ |
|
245 protected void addProductPropertyDescriptor(Object object) { |
|
246 itemPropertyDescriptors.add |
|
247 (createItemPropertyDescriptor |
|
248 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
|
249 getResourceLocator(), |
|
250 getString("_UI_Meta_product_feature"), |
|
251 getString("_UI_PropertyDescriptor_description", "_UI_Meta_product_feature", "_UI_Meta_type"), |
|
252 CenrepPackage.Literals.META__PRODUCT, |
|
253 true, |
|
254 false, |
|
255 true, |
|
256 null, |
|
257 null, |
|
258 null)); |
|
259 } |
|
260 |
|
261 /** |
|
262 * This adds a property descriptor for the Release feature. |
|
263 * <!-- begin-user-doc --> |
|
264 * <!-- end-user-doc --> |
|
265 * @generated |
|
266 */ |
|
267 protected void addReleasePropertyDescriptor(Object object) { |
|
268 itemPropertyDescriptors.add |
|
269 (createItemPropertyDescriptor |
|
270 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
|
271 getResourceLocator(), |
|
272 getString("_UI_Meta_release_feature"), |
|
273 getString("_UI_PropertyDescriptor_description", "_UI_Meta_release_feature", "_UI_Meta_type"), |
|
274 CenrepPackage.Literals.META__RELEASE, |
|
275 true, |
|
276 false, |
|
277 true, |
|
278 null, |
|
279 null, |
|
280 null)); |
|
281 } |
|
282 |
|
283 /** |
|
284 * This returns Meta.gif. |
|
285 * <!-- begin-user-doc --> |
|
286 * <!-- end-user-doc --> |
|
287 * @generated |
|
288 */ |
|
289 @Override |
|
290 public Object getImage(Object object) { |
|
291 return overlayImage(object, getResourceLocator().getImage("full/obj16/Meta")); |
|
292 } |
|
293 |
|
294 /** |
|
295 * This returns the label text for the adapted class. |
|
296 * <!-- begin-user-doc --> |
|
297 * <!-- end-user-doc --> |
|
298 * @generated |
|
299 */ |
|
300 @Override |
|
301 public String getText(Object object) { |
|
302 String label = ((Meta)object).getId(); |
|
303 return label == null || label.length() == 0 ? |
|
304 getString("_UI_Meta_type") : |
|
305 getString("_UI_Meta_type") + " " + label; |
|
306 } |
|
307 |
|
308 /** |
|
309 * This handles model notifications by calling {@link #updateChildren} to update any cached |
|
310 * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
|
311 * <!-- begin-user-doc --> |
|
312 * <!-- end-user-doc --> |
|
313 * @generated |
|
314 */ |
|
315 @Override |
|
316 public void notifyChanged(Notification notification) { |
|
317 updateChildren(notification); |
|
318 super.notifyChanged(notification); |
|
319 } |
|
320 |
|
321 /** |
|
322 * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
|
323 * that can be created under this object. |
|
324 * <!-- begin-user-doc --> |
|
325 * <!-- end-user-doc --> |
|
326 * @generated |
|
327 */ |
|
328 @Override |
|
329 protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
|
330 super.collectNewChildDescriptors(newChildDescriptors, object); |
|
331 } |
|
332 |
|
333 /** |
|
334 * Return the resource locator for this item provider's resources. |
|
335 * <!-- begin-user-doc --> |
|
336 * <!-- end-user-doc --> |
|
337 * @generated |
|
338 */ |
|
339 @Override |
|
340 public ResourceLocator getResourceLocator() { |
|
341 return CRPluginModelEditPlugin.INSTANCE; |
|
342 } |
|
343 |
|
344 } |