|
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.IEditingDomainItemProvider; |
|
27 import org.eclipse.emf.edit.provider.IItemLabelProvider; |
|
28 import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
|
29 import org.eclipse.emf.edit.provider.IItemPropertySource; |
|
30 import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
|
31 import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
|
32 |
|
33 import cenrep.Version; |
|
34 |
|
35 /** |
|
36 * This is the item provider adapter for a {@link cenrep.Version} object. |
|
37 * <!-- begin-user-doc --> |
|
38 * <!-- end-user-doc --> |
|
39 * @generated |
|
40 */ |
|
41 public class VersionItemProvider |
|
42 extends ContentItemProvider |
|
43 implements |
|
44 IEditingDomainItemProvider, |
|
45 IStructuredItemContentProvider, |
|
46 ITreeItemContentProvider, |
|
47 IItemLabelProvider, |
|
48 IItemPropertySource { |
|
49 /** |
|
50 * This constructs an instance from a factory and a notifier. |
|
51 * <!-- begin-user-doc --> |
|
52 * <!-- end-user-doc --> |
|
53 * @generated |
|
54 */ |
|
55 public VersionItemProvider(AdapterFactory adapterFactory) { |
|
56 super(adapterFactory); |
|
57 } |
|
58 |
|
59 /** |
|
60 * This returns the property descriptors for the adapted class. |
|
61 * <!-- begin-user-doc --> |
|
62 * <!-- end-user-doc --> |
|
63 * @generated |
|
64 */ |
|
65 @Override |
|
66 public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
|
67 if (itemPropertyDescriptors == null) { |
|
68 super.getPropertyDescriptors(object); |
|
69 |
|
70 } |
|
71 return itemPropertyDescriptors; |
|
72 } |
|
73 |
|
74 /** |
|
75 * This returns Version.gif. |
|
76 * <!-- begin-user-doc --> |
|
77 * <!-- end-user-doc --> |
|
78 * @generated |
|
79 */ |
|
80 @Override |
|
81 public Object getImage(Object object) { |
|
82 return overlayImage(object, getResourceLocator().getImage("full/obj16/Version")); |
|
83 } |
|
84 |
|
85 /** |
|
86 * This returns the label text for the adapted class. |
|
87 * <!-- begin-user-doc --> |
|
88 * <!-- end-user-doc --> |
|
89 * @generated |
|
90 */ |
|
91 @Override |
|
92 public String getText(Object object) { |
|
93 String label = ((Version)object).getValue(); |
|
94 return label == null || label.length() == 0 ? |
|
95 getString("_UI_Version_type") : |
|
96 getString("_UI_Version_type") + " " + label; |
|
97 } |
|
98 |
|
99 /** |
|
100 * This handles model notifications by calling {@link #updateChildren} to update any cached |
|
101 * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
|
102 * <!-- begin-user-doc --> |
|
103 * <!-- end-user-doc --> |
|
104 * @generated |
|
105 */ |
|
106 @Override |
|
107 public void notifyChanged(Notification notification) { |
|
108 updateChildren(notification); |
|
109 super.notifyChanged(notification); |
|
110 } |
|
111 |
|
112 /** |
|
113 * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
|
114 * that can be created under this object. |
|
115 * <!-- begin-user-doc --> |
|
116 * <!-- end-user-doc --> |
|
117 * @generated |
|
118 */ |
|
119 @Override |
|
120 protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
|
121 super.collectNewChildDescriptors(newChildDescriptors, object); |
|
122 } |
|
123 |
|
124 /** |
|
125 * Return the resource locator for this item provider's resources. |
|
126 * <!-- begin-user-doc --> |
|
127 * <!-- end-user-doc --> |
|
128 * @generated |
|
129 */ |
|
130 @Override |
|
131 public ResourceLocator getResourceLocator() { |
|
132 return CRPluginModelEditPlugin.INSTANCE; |
|
133 } |
|
134 |
|
135 } |