KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > Olj > provider > VariableTypeItemProvider


1 /**
2  * <copyright>
3  * </copyright>
4  *
5  * $Id$
6  */

7 package Olj.provider;
8
9
10 import Olj.OljPackage;
11 import Olj.VariableType;
12
13 import java.util.Collection JavaDoc;
14 import java.util.List JavaDoc;
15
16 import org.eclipse.emf.common.notify.AdapterFactory;
17 import org.eclipse.emf.common.notify.Notification;
18
19 import org.eclipse.emf.common.util.ResourceLocator;
20
21 import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
22 import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
23 import org.eclipse.emf.edit.provider.IItemLabelProvider;
24 import org.eclipse.emf.edit.provider.IItemPropertySource;
25 import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
26 import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
27 import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
28 import org.eclipse.emf.edit.provider.ItemProviderAdapter;
29 import org.eclipse.emf.edit.provider.ViewerNotification;
30
31 /**
32  * This is the item provider adpater for a {@link Olj.VariableType} object.
33  * <!-- begin-user-doc -->
34  * <!-- end-user-doc -->
35  * @generated
36  */

37 public class VariableTypeItemProvider
38     extends ItemProviderAdapter
39     implements
40         IEditingDomainItemProvider,
41         IStructuredItemContentProvider,
42         ITreeItemContentProvider,
43         IItemLabelProvider,
44         IItemPropertySource {
45     /**
46      * This constructs an instance from a factory and a notifier.
47      * <!-- begin-user-doc -->
48      * <!-- end-user-doc -->
49      * @generated
50      */

51     public VariableTypeItemProvider(AdapterFactory adapterFactory) {
52         super(adapterFactory);
53     }
54
55     /**
56      * This returns the property descriptors for the adapted class.
57      * <!-- begin-user-doc -->
58      * <!-- end-user-doc -->
59      * @generated
60      */

61     public List JavaDoc getPropertyDescriptors(Object JavaDoc object) {
62         if (itemPropertyDescriptors == null) {
63             super.getPropertyDescriptors(object);
64
65             addDefaultValuePropertyDescriptor(object);
66             addNamePropertyDescriptor(object);
67             addOverridePropertyDescriptor(object);
68             addPrefixPropertyDescriptor(object);
69             addReplaceInConstantsPropertyDescriptor(object);
70             addReplaceInDataPropertyDescriptor(object);
71             addReplaceInJDBCPropertyDescriptor(object);
72             addReplaceInSQLPropertyDescriptor(object);
73             addSuffixPropertyDescriptor(object);
74             addValuePropertyDescriptor(object);
75         }
76         return itemPropertyDescriptors;
77     }
78
79     /**
80      * This adds a property descriptor for the Default Value feature.
81      * <!-- begin-user-doc -->
82      * <!-- end-user-doc -->
83      * @generated
84      */

85     protected void addDefaultValuePropertyDescriptor(Object JavaDoc object) {
86         itemPropertyDescriptors.add
87             (new ItemPropertyDescriptor
88                 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
89                  getResourceLocator(),
90                  getString("_UI_VariableType_defaultValue_feature"),
91                  getString("_UI_PropertyDescriptor_description", "_UI_VariableType_defaultValue_feature", "_UI_VariableType_type"),
92                  OljPackage.eINSTANCE.getVariableType_DefaultValue(),
93                  true,
94                  ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
95     }
96
97     /**
98      * This adds a property descriptor for the Name feature.
99      * <!-- begin-user-doc -->
100      * <!-- end-user-doc -->
101      * @generated
102      */

103     protected void addNamePropertyDescriptor(Object JavaDoc object) {
104         itemPropertyDescriptors.add
105             (new ItemPropertyDescriptor
106                 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
107                  getResourceLocator(),
108                  getString("_UI_VariableType_name_feature"),
109                  getString("_UI_PropertyDescriptor_description", "_UI_VariableType_name_feature", "_UI_VariableType_type"),
110                  OljPackage.eINSTANCE.getVariableType_Name(),
111                  true,
112                  ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
113     }
114
115     /**
116      * This adds a property descriptor for the Override feature.
117      * <!-- begin-user-doc -->
118      * <!-- end-user-doc -->
119      * @generated
120      */

121     protected void addOverridePropertyDescriptor(Object JavaDoc object) {
122         itemPropertyDescriptors.add
123             (new ItemPropertyDescriptor
124                 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
125                  getResourceLocator(),
126                  getString("_UI_VariableType_override_feature"),
127                  getString("_UI_PropertyDescriptor_description", "_UI_VariableType_override_feature", "_UI_VariableType_type"),
128                  OljPackage.eINSTANCE.getVariableType_Override(),
129                  true,
130                  ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
131     }
132
133     /**
134      * This adds a property descriptor for the Prefix feature.
135      * <!-- begin-user-doc -->
136      * <!-- end-user-doc -->
137      * @generated
138      */

139     protected void addPrefixPropertyDescriptor(Object JavaDoc object) {
140         itemPropertyDescriptors.add
141             (new ItemPropertyDescriptor
142                 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
143                  getResourceLocator(),
144                  getString("_UI_VariableType_prefix_feature"),
145                  getString("_UI_PropertyDescriptor_description", "_UI_VariableType_prefix_feature", "_UI_VariableType_type"),
146                  OljPackage.eINSTANCE.getVariableType_Prefix(),
147                  true,
148                  ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
149     }
150
151     /**
152      * This adds a property descriptor for the Replace In Constants feature.
153      * <!-- begin-user-doc -->
154      * <!-- end-user-doc -->
155      * @generated
156      */

157     protected void addReplaceInConstantsPropertyDescriptor(Object JavaDoc object) {
158         itemPropertyDescriptors.add
159             (new ItemPropertyDescriptor
160                 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
161                  getResourceLocator(),
162                  getString("_UI_VariableType_replaceInConstants_feature"),
163                  getString("_UI_PropertyDescriptor_description", "_UI_VariableType_replaceInConstants_feature", "_UI_VariableType_type"),
164                  OljPackage.eINSTANCE.getVariableType_ReplaceInConstants(),
165                  true,
166                  ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
167     }
168
169     /**
170      * This adds a property descriptor for the Replace In Data feature.
171      * <!-- begin-user-doc -->
172      * <!-- end-user-doc -->
173      * @generated
174      */

175     protected void addReplaceInDataPropertyDescriptor(Object JavaDoc object) {
176         itemPropertyDescriptors.add
177             (new ItemPropertyDescriptor
178                 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
179                  getResourceLocator(),
180                  getString("_UI_VariableType_replaceInData_feature"),
181                  getString("_UI_PropertyDescriptor_description", "_UI_VariableType_replaceInData_feature", "_UI_VariableType_type"),
182                  OljPackage.eINSTANCE.getVariableType_ReplaceInData(),
183                  true,
184                  ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
185     }
186
187     /**
188      * This adds a property descriptor for the Replace In JDBC feature.
189      * <!-- begin-user-doc -->
190      * <!-- end-user-doc -->
191      * @generated
192      */

193     protected void addReplaceInJDBCPropertyDescriptor(Object JavaDoc object) {
194         itemPropertyDescriptors.add
195             (new ItemPropertyDescriptor
196                 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
197                  getResourceLocator(),
198                  getString("_UI_VariableType_replaceInJDBC_feature"),
199                  getString("_UI_PropertyDescriptor_description", "_UI_VariableType_replaceInJDBC_feature", "_UI_VariableType_type"),
200                  OljPackage.eINSTANCE.getVariableType_ReplaceInJDBC(),
201                  true,
202                  ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
203     }
204
205     /**
206      * This adds a property descriptor for the Replace In SQL feature.
207      * <!-- begin-user-doc -->
208      * <!-- end-user-doc -->
209      * @generated
210      */

211     protected void addReplaceInSQLPropertyDescriptor(Object JavaDoc object) {
212         itemPropertyDescriptors.add
213             (new ItemPropertyDescriptor
214                 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
215                  getResourceLocator(),
216                  getString("_UI_VariableType_replaceInSQL_feature"),
217                  getString("_UI_PropertyDescriptor_description", "_UI_VariableType_replaceInSQL_feature", "_UI_VariableType_type"),
218                  OljPackage.eINSTANCE.getVariableType_ReplaceInSQL(),
219                  true,
220                  ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
221     }
222
223     /**
224      * This adds a property descriptor for the Suffix feature.
225      * <!-- begin-user-doc -->
226      * <!-- end-user-doc -->
227      * @generated
228      */

229     protected void addSuffixPropertyDescriptor(Object JavaDoc object) {
230         itemPropertyDescriptors.add
231             (new ItemPropertyDescriptor
232                 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
233                  getResourceLocator(),
234                  getString("_UI_VariableType_suffix_feature"),
235                  getString("_UI_PropertyDescriptor_description", "_UI_VariableType_suffix_feature", "_UI_VariableType_type"),
236                  OljPackage.eINSTANCE.getVariableType_Suffix(),
237                  true,
238                  ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
239     }
240
241     /**
242      * This adds a property descriptor for the Value feature.
243      * <!-- begin-user-doc -->
244      * <!-- end-user-doc -->
245      * @generated
246      */

247     protected void addValuePropertyDescriptor(Object JavaDoc object) {
248         itemPropertyDescriptors.add
249             (new ItemPropertyDescriptor
250                 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
251                  getResourceLocator(),
252                  getString("_UI_VariableType_value_feature"),
253                  getString("_UI_PropertyDescriptor_description", "_UI_VariableType_value_feature", "_UI_VariableType_type"),
254                  OljPackage.eINSTANCE.getVariableType_Value(),
255                  true,
256                  ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
257     }
258
259     /**
260      * This returns VariableType.gif.
261      * <!-- begin-user-doc -->
262      * <!-- end-user-doc -->
263      * @generated
264      */

265     public Object JavaDoc getImage(Object JavaDoc object) {
266         return getResourceLocator().getImage("full/obj16/VariableType");
267     }
268
269     /**
270      * This returns the label text for the adapted class.
271      * <!-- begin-user-doc -->
272      * <!-- end-user-doc -->
273      * @generated
274      */

275     public String JavaDoc getText(Object JavaDoc object) {
276         String JavaDoc label = ((VariableType)object).getName();
277         return label == null || label.length() == 0 ?
278             getString("_UI_VariableType_type") :
279             getString("_UI_VariableType_type") + " " + label;
280     }
281
282     /**
283      * This handles model notifications by calling {@link #updateChildren} to update any cached
284      * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
285      * <!-- begin-user-doc -->
286      * <!-- end-user-doc -->
287      * @generated
288      */

289     public void notifyChanged(Notification notification) {
290         updateChildren(notification);
291
292         switch (notification.getFeatureID(VariableType.class)) {
293             case OljPackage.VARIABLE_TYPE__DEFAULT_VALUE:
294             case OljPackage.VARIABLE_TYPE__NAME:
295             case OljPackage.VARIABLE_TYPE__OVERRIDE:
296             case OljPackage.VARIABLE_TYPE__PREFIX:
297             case OljPackage.VARIABLE_TYPE__REPLACE_IN_CONSTANTS:
298             case OljPackage.VARIABLE_TYPE__REPLACE_IN_DATA:
299             case OljPackage.VARIABLE_TYPE__REPLACE_IN_JDBC:
300             case OljPackage.VARIABLE_TYPE__REPLACE_IN_SQL:
301             case OljPackage.VARIABLE_TYPE__SUFFIX:
302             case OljPackage.VARIABLE_TYPE__VALUE:
303                 fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
304                 return;
305         }
306         super.notifyChanged(notification);
307     }
308
309     /**
310      * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
311      * describing all of the children that can be created under this object.
312      * <!-- begin-user-doc -->
313      * <!-- end-user-doc -->
314      * @generated
315      */

316     protected void collectNewChildDescriptors(Collection JavaDoc newChildDescriptors, Object JavaDoc object) {
317         super.collectNewChildDescriptors(newChildDescriptors, object);
318     }
319
320     /**
321      * Return the resource locator for this item provider's resources.
322      * <!-- begin-user-doc -->
323      * <!-- end-user-doc -->
324      * @generated
325      */

326     public ResourceLocator getResourceLocator() {
327         return OljEditPlugin.INSTANCE;
328     }
329
330 }
331
Popular Tags