KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > Olj > provider > JdbcSourceParametersTypeItemProvider


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

7 package Olj.provider;
8
9
10 import Olj.JdbcSourceParametersType;
11 import Olj.OljFactory;
12 import Olj.OljPackage;
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.JdbcSourceParametersType} object.
34  * <!-- begin-user-doc -->
35  * <!-- end-user-doc -->
36  * @generated
37  */

38 public class JdbcSourceParametersTypeItemProvider
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 JdbcSourceParametersTypeItemProvider(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             addDbVendorPropertyDescriptor(object);
67             addDriverNamePropertyDescriptor(object);
68         }
69         return itemPropertyDescriptors;
70     }
71
72     /**
73      * This adds a property descriptor for the Db Vendor feature.
74      * <!-- begin-user-doc -->
75      * <!-- end-user-doc -->
76      * @generated
77      */

78     protected void addDbVendorPropertyDescriptor(Object JavaDoc object) {
79         itemPropertyDescriptors.add
80             (new ItemPropertyDescriptor
81                 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
82                  getResourceLocator(),
83                  getString("_UI_JdbcSourceParametersType_dbVendor_feature"),
84                  getString("_UI_PropertyDescriptor_description", "_UI_JdbcSourceParametersType_dbVendor_feature", "_UI_JdbcSourceParametersType_type"),
85                  OljPackage.eINSTANCE.getJdbcSourceParametersType_DbVendor(),
86                  true,
87                  ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
88     }
89
90     /**
91      * This adds a property descriptor for the Driver Name feature.
92      * <!-- begin-user-doc -->
93      * <!-- end-user-doc -->
94      * @generated
95      */

96     protected void addDriverNamePropertyDescriptor(Object JavaDoc object) {
97         itemPropertyDescriptors.add
98             (new ItemPropertyDescriptor
99                 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
100                  getResourceLocator(),
101                  getString("_UI_JdbcSourceParametersType_driverName_feature"),
102                  getString("_UI_PropertyDescriptor_description", "_UI_JdbcSourceParametersType_driverName_feature", "_UI_JdbcSourceParametersType_type"),
103                  OljPackage.eINSTANCE.getJdbcSourceParametersType_DriverName(),
104                  true,
105                  ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
106     }
107
108     /**
109      * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
110      * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
111      * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
112      * <!-- begin-user-doc -->
113      * <!-- end-user-doc -->
114      * @generated
115      */

116     public Collection JavaDoc getChildrenFeatures(Object JavaDoc object) {
117         if (childrenFeatures == null) {
118             super.getChildrenFeatures(object);
119             childrenFeatures.add(OljPackage.eINSTANCE.getJdbcSourceParametersType_JdbcSourceParameter());
120         }
121         return childrenFeatures;
122     }
123
124     /**
125      * This returns JdbcSourceParametersType.gif.
126      * <!-- begin-user-doc -->
127      * <!-- end-user-doc -->
128      * @generated
129      */

130     public Object JavaDoc getImage(Object JavaDoc object) {
131         return getResourceLocator().getImage("full/obj16/JdbcSourceParametersType");
132     }
133
134     /**
135      * This returns the label text for the adapted class.
136      * <!-- begin-user-doc -->
137      * <!-- end-user-doc -->
138      * @generated
139      */

140     public String JavaDoc getText(Object JavaDoc object) {
141         String JavaDoc label = ((JdbcSourceParametersType)object).getDriverName();
142         return label == null || label.length() == 0 ?
143             getString("_UI_JdbcSourceParametersType_type") :
144             getString("_UI_JdbcSourceParametersType_type") + " " + label;
145     }
146
147     /**
148      * This handles model notifications by calling {@link #updateChildren} to update any cached
149      * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
150      * <!-- begin-user-doc -->
151      * <!-- end-user-doc -->
152      * @generated
153      */

154     public void notifyChanged(Notification notification) {
155         updateChildren(notification);
156
157         switch (notification.getFeatureID(JdbcSourceParametersType.class)) {
158             case OljPackage.JDBC_SOURCE_PARAMETERS_TYPE__DB_VENDOR:
159             case OljPackage.JDBC_SOURCE_PARAMETERS_TYPE__DRIVER_NAME:
160                 fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
161                 return;
162             case OljPackage.JDBC_SOURCE_PARAMETERS_TYPE__JDBC_SOURCE_PARAMETER:
163                 fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
164                 return;
165         }
166         super.notifyChanged(notification);
167     }
168
169     /**
170      * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
171      * describing all of the children that can be created under this object.
172      * <!-- begin-user-doc -->
173      * <!-- end-user-doc -->
174      * @generated
175      */

176     protected void collectNewChildDescriptors(Collection JavaDoc newChildDescriptors, Object JavaDoc object) {
177         super.collectNewChildDescriptors(newChildDescriptors, object);
178
179         newChildDescriptors.add
180             (createChildParameter
181                 (OljPackage.eINSTANCE.getJdbcSourceParametersType_JdbcSourceParameter(),
182                  OljFactory.eINSTANCE.createJdbcSourceParameterType()));
183     }
184
185     /**
186      * Return the resource locator for this item provider's resources.
187      * <!-- begin-user-doc -->
188      * <!-- end-user-doc -->
189      * @generated
190      */

191     public ResourceLocator getResourceLocator() {
192         return OljEditPlugin.INSTANCE;
193     }
194
195 }
196
Popular Tags