KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > Olj > provider > VariablesTypeItemProvider


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

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

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

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

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

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

101     protected void addPrefixPropertyDescriptor(Object JavaDoc object) {
102         itemPropertyDescriptors.add
103             (new ItemPropertyDescriptor
104                 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
105                  getResourceLocator(),
106                  getString("_UI_VariablesType_prefix_feature"),
107                  getString("_UI_PropertyDescriptor_description", "_UI_VariablesType_prefix_feature", "_UI_VariablesType_type"),
108                  OljPackage.eINSTANCE.getVariablesType_Prefix(),
109                  true,
110                  ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
111     }
112
113     /**
114      * This adds a property descriptor for the Replace In Constants feature.
115      * <!-- begin-user-doc -->
116      * <!-- end-user-doc -->
117      * @generated
118      */

119     protected void addReplaceInConstantsPropertyDescriptor(Object JavaDoc object) {
120         itemPropertyDescriptors.add
121             (new ItemPropertyDescriptor
122                 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
123                  getResourceLocator(),
124                  getString("_UI_VariablesType_replaceInConstants_feature"),
125                  getString("_UI_PropertyDescriptor_description", "_UI_VariablesType_replaceInConstants_feature", "_UI_VariablesType_type"),
126                  OljPackage.eINSTANCE.getVariablesType_ReplaceInConstants(),
127                  true,
128                  ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
129     }
130
131     /**
132      * This adds a property descriptor for the Replace In Data feature.
133      * <!-- begin-user-doc -->
134      * <!-- end-user-doc -->
135      * @generated
136      */

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

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

173     protected void addReplaceInSQLPropertyDescriptor(Object JavaDoc object) {
174         itemPropertyDescriptors.add
175             (new ItemPropertyDescriptor
176                 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
177                  getResourceLocator(),
178                  getString("_UI_VariablesType_replaceInSQL_feature"),
179                  getString("_UI_PropertyDescriptor_description", "_UI_VariablesType_replaceInSQL_feature", "_UI_VariablesType_type"),
180                  OljPackage.eINSTANCE.getVariablesType_ReplaceInSQL(),
181                  true,
182                  ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
183     }
184
185     /**
186      * This adds a property descriptor for the Suffix feature.
187      * <!-- begin-user-doc -->
188      * <!-- end-user-doc -->
189      * @generated
190      */

191     protected void addSuffixPropertyDescriptor(Object JavaDoc object) {
192         itemPropertyDescriptors.add
193             (new ItemPropertyDescriptor
194                 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
195                  getResourceLocator(),
196                  getString("_UI_VariablesType_suffix_feature"),
197                  getString("_UI_PropertyDescriptor_description", "_UI_VariablesType_suffix_feature", "_UI_VariablesType_type"),
198                  OljPackage.eINSTANCE.getVariablesType_Suffix(),
199                  true,
200                  ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
201     }
202
203     /**
204      * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
205      * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
206      * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
207      * <!-- begin-user-doc -->
208      * <!-- end-user-doc -->
209      * @generated
210      */

211     public Collection JavaDoc getChildrenFeatures(Object JavaDoc object) {
212         if (childrenFeatures == null) {
213             super.getChildrenFeatures(object);
214             childrenFeatures.add(OljPackage.eINSTANCE.getVariablesType_Variable());
215         }
216         return childrenFeatures;
217     }
218
219     /**
220      * This returns VariablesType.gif.
221      * <!-- begin-user-doc -->
222      * <!-- end-user-doc -->
223      * @generated
224      */

225     public Object JavaDoc getImage(Object JavaDoc object) {
226         return getResourceLocator().getImage("full/obj16/VariablesType");
227     }
228
229     /**
230      * This returns the label text for the adapted class.
231      * <!-- begin-user-doc -->
232      * <!-- end-user-doc -->
233      * @generated
234      */

235     public String JavaDoc getText(Object JavaDoc object) {
236         String JavaDoc label = ((VariablesType)object).getOverride();
237         return label == null || label.length() == 0 ?
238             getString("_UI_VariablesType_type") :
239             getString("_UI_VariablesType_type") + " " + label;
240     }
241
242     /**
243      * This handles model notifications by calling {@link #updateChildren} to update any cached
244      * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
245      * <!-- begin-user-doc -->
246      * <!-- end-user-doc -->
247      * @generated
248      */

249     public void notifyChanged(Notification notification) {
250         updateChildren(notification);
251
252         switch (notification.getFeatureID(VariablesType.class)) {
253             case OljPackage.VARIABLES_TYPE__OVERRIDE:
254             case OljPackage.VARIABLES_TYPE__PREFIX:
255             case OljPackage.VARIABLES_TYPE__REPLACE_IN_CONSTANTS:
256             case OljPackage.VARIABLES_TYPE__REPLACE_IN_DATA:
257             case OljPackage.VARIABLES_TYPE__REPLACE_IN_JDBC:
258             case OljPackage.VARIABLES_TYPE__REPLACE_IN_SQL:
259             case OljPackage.VARIABLES_TYPE__SUFFIX:
260                 fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
261                 return;
262             case OljPackage.VARIABLES_TYPE__VARIABLE:
263                 fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
264                 return;
265         }
266         super.notifyChanged(notification);
267     }
268
269     /**
270      * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
271      * describing all of the children that can be created under this object.
272      * <!-- begin-user-doc -->
273      * <!-- end-user-doc -->
274      * @generated
275      */

276     protected void collectNewChildDescriptors(Collection JavaDoc newChildDescriptors, Object JavaDoc object) {
277         super.collectNewChildDescriptors(newChildDescriptors, object);
278
279         newChildDescriptors.add
280             (createChildParameter
281                 (OljPackage.eINSTANCE.getVariablesType_Variable(),
282                  OljFactory.eINSTANCE.createVariableType()));
283     }
284
285     /**
286      * Return the resource locator for this item provider's resources.
287      * <!-- begin-user-doc -->
288      * <!-- end-user-doc -->
289      * @generated
290      */

291     public ResourceLocator getResourceLocator() {
292         return OljEditPlugin.INSTANCE;
293     }
294
295 }
296
Popular Tags