KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > Olj > provider > SqlTypeItemProvider


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.SqlType;
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.ecore.EStructuralFeature;
23
24 import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
25 import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
26 import org.eclipse.emf.edit.provider.IItemLabelProvider;
27 import org.eclipse.emf.edit.provider.IItemPropertySource;
28 import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
29 import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
30 import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
31 import org.eclipse.emf.edit.provider.ItemProviderAdapter;
32 import org.eclipse.emf.edit.provider.ViewerNotification;
33
34 /**
35  * This is the item provider adpater for a {@link Olj.SqlType} object.
36  * <!-- begin-user-doc -->
37  * <!-- end-user-doc -->
38  * @generated
39  */

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

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

64     public List JavaDoc getPropertyDescriptors(Object JavaDoc object) {
65         if (itemPropertyDescriptors == null) {
66             super.getPropertyDescriptors(object);
67
68             addCommitPropertyDescriptor(object);
69             addLogModePropertyDescriptor(object);
70             addNamePropertyDescriptor(object);
71             addOnErrorContinuePropertyDescriptor(object);
72             addReturnCodePropertyDescriptor(object);
73         }
74         return itemPropertyDescriptors;
75     }
76
77     /**
78      * This adds a property descriptor for the Commit feature.
79      * <!-- begin-user-doc -->
80      * <!-- end-user-doc -->
81      * @generated
82      */

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

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

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

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

155     protected void addReturnCodePropertyDescriptor(Object JavaDoc object) {
156         itemPropertyDescriptors.add
157             (new ItemPropertyDescriptor
158                 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
159                  getResourceLocator(),
160                  getString("_UI_SqlType_returnCode_feature"),
161                  getString("_UI_PropertyDescriptor_description", "_UI_SqlType_returnCode_feature", "_UI_SqlType_type"),
162                  OljPackage.eINSTANCE.getSqlType_ReturnCode(),
163                  true,
164                  ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
165     }
166
167     /**
168      * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
169      * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
170      * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
171      * <!-- begin-user-doc -->
172      * <!-- end-user-doc -->
173      * @generated
174      */

175     public Collection JavaDoc getChildrenFeatures(Object JavaDoc object) {
176         if (childrenFeatures == null) {
177             super.getChildrenFeatures(object);
178             childrenFeatures.add(OljPackage.eINSTANCE.getSqlType_JdbcTargetParameters());
179             childrenFeatures.add(OljPackage.eINSTANCE.getSqlType_Include());
180             childrenFeatures.add(OljPackage.eINSTANCE.getSqlType_SqlStmt());
181         }
182         return childrenFeatures;
183     }
184
185     /**
186      * <!-- begin-user-doc -->
187      * <!-- end-user-doc -->
188      * @generated
189      */

190     protected EStructuralFeature getChildFeature(Object JavaDoc object, Object JavaDoc child) {
191         // Check the type of the specified child object and return the proper feature to use for
192
// adding (see {@link AddCommand}) it as a child.
193

194         return super.getChildFeature(object, child);
195     }
196
197     /**
198      * This returns SqlType.gif.
199      * <!-- begin-user-doc -->
200      * <!-- end-user-doc -->
201      * @generated
202      */

203     public Object JavaDoc getImage(Object JavaDoc object) {
204         return getResourceLocator().getImage("full/obj16/SqlType");
205     }
206
207     /**
208      * This returns the label text for the adapted class.
209      * <!-- begin-user-doc -->
210      * <!-- end-user-doc -->
211      * @generated
212      */

213     public String JavaDoc getText(Object JavaDoc object) {
214         String JavaDoc label = ((SqlType)object).getName();
215         return label == null || label.length() == 0 ?
216             getString("_UI_SqlType_type") :
217             getString("_UI_SqlType_type") + " " + label;
218     }
219
220     /**
221      * This handles model notifications by calling {@link #updateChildren} to update any cached
222      * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
223      * <!-- begin-user-doc -->
224      * <!-- end-user-doc -->
225      * @generated
226      */

227     public void notifyChanged(Notification notification) {
228         updateChildren(notification);
229
230         switch (notification.getFeatureID(SqlType.class)) {
231             case OljPackage.SQL_TYPE__COMMIT:
232             case OljPackage.SQL_TYPE__LOG_MODE:
233             case OljPackage.SQL_TYPE__NAME:
234             case OljPackage.SQL_TYPE__ON_ERROR_CONTINUE:
235             case OljPackage.SQL_TYPE__RETURN_CODE:
236                 fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
237                 return;
238             case OljPackage.SQL_TYPE__JDBC_TARGET_PARAMETERS:
239             case OljPackage.SQL_TYPE__INCLUDE:
240             case OljPackage.SQL_TYPE__SQL_STMT:
241                 fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
242                 return;
243         }
244         super.notifyChanged(notification);
245     }
246
247     /**
248      * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
249      * describing all of the children that can be created under this object.
250      * <!-- begin-user-doc -->
251      * <!-- end-user-doc -->
252      * @generated
253      */

254     protected void collectNewChildDescriptors(Collection JavaDoc newChildDescriptors, Object JavaDoc object) {
255         super.collectNewChildDescriptors(newChildDescriptors, object);
256
257         newChildDescriptors.add
258             (createChildParameter
259                 (OljPackage.eINSTANCE.getSqlType_JdbcTargetParameters(),
260                  OljFactory.eINSTANCE.createJdbcTargetParametersType()));
261
262         newChildDescriptors.add
263             (createChildParameter
264                 (OljPackage.eINSTANCE.getSqlType_Include(),
265                  OljFactory.eINSTANCE.createIncludeType()));
266
267         newChildDescriptors.add
268             (createChildParameter
269                 (OljPackage.eINSTANCE.getSqlType_SqlStmt(),
270                  OljFactory.eINSTANCE.createSqlStmtType()));
271     }
272
273     /**
274      * Return the resource locator for this item provider's resources.
275      * <!-- begin-user-doc -->
276      * <!-- end-user-doc -->
277      * @generated
278      */

279     public ResourceLocator getResourceLocator() {
280         return OljEditPlugin.INSTANCE;
281     }
282
283 }
284
Popular Tags