KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > Olj > provider > TransformationTypeItemProvider


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.TransformationType;
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.TransformationType} object.
36  * <!-- begin-user-doc -->
37  * <!-- end-user-doc -->
38  * @generated
39  */

40 public class TransformationTypeItemProvider
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 TransformationTypeItemProvider(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             addNamePropertyDescriptor(object);
69             addTransformatorClassNamePropertyDescriptor(object);
70             addTransformatorConfigPropertyDescriptor(object);
71         }
72         return itemPropertyDescriptors;
73     }
74
75     /**
76      * This adds a property descriptor for the Name feature.
77      * <!-- begin-user-doc -->
78      * <!-- end-user-doc -->
79      * @generated
80      */

81     protected void addNamePropertyDescriptor(Object JavaDoc object) {
82         itemPropertyDescriptors.add
83             (new ItemPropertyDescriptor
84                 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
85                  getResourceLocator(),
86                  getString("_UI_TransformationType_name_feature"),
87                  getString("_UI_PropertyDescriptor_description", "_UI_TransformationType_name_feature", "_UI_TransformationType_type"),
88                  OljPackage.eINSTANCE.getTransformationType_Name(),
89                  true,
90                  ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
91     }
92
93     /**
94      * This adds a property descriptor for the Transformator Class Name feature.
95      * <!-- begin-user-doc -->
96      * <!-- end-user-doc -->
97      * @generated
98      */

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

117     protected void addTransformatorConfigPropertyDescriptor(Object JavaDoc object) {
118         itemPropertyDescriptors.add
119             (new ItemPropertyDescriptor
120                 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
121                  getResourceLocator(),
122                  getString("_UI_TransformationType_transformatorConfig_feature"),
123                  getString("_UI_PropertyDescriptor_description", "_UI_TransformationType_transformatorConfig_feature", "_UI_TransformationType_type"),
124                  OljPackage.eINSTANCE.getTransformationType_TransformatorConfig(),
125                  true,
126                  ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
127     }
128
129     /**
130      * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
131      * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
132      * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
133      * <!-- begin-user-doc -->
134      * <!-- end-user-doc -->
135      * @generated
136      */

137     public Collection JavaDoc getChildrenFeatures(Object JavaDoc object) {
138         if (childrenFeatures == null) {
139             super.getChildrenFeatures(object);
140             childrenFeatures.add(OljPackage.eINSTANCE.getTransformationType_SourceColumns());
141             childrenFeatures.add(OljPackage.eINSTANCE.getTransformationType_TargetColumns());
142             childrenFeatures.add(OljPackage.eINSTANCE.getTransformationType_JavaScript());
143         }
144         return childrenFeatures;
145     }
146
147     /**
148      * <!-- begin-user-doc -->
149      * <!-- end-user-doc -->
150      * @generated
151      */

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

156         return super.getChildFeature(object, child);
157     }
158
159     /**
160      * This returns TransformationType.gif.
161      * <!-- begin-user-doc -->
162      * <!-- end-user-doc -->
163      * @generated
164      */

165     public Object JavaDoc getImage(Object JavaDoc object) {
166         return getResourceLocator().getImage("full/obj16/TransformationType");
167     }
168
169     /**
170      * This returns the label text for the adapted class.
171      * <!-- begin-user-doc -->
172      * <!-- end-user-doc -->
173      * @generated
174      */

175     public String JavaDoc getText(Object JavaDoc object) {
176         String JavaDoc label = ((TransformationType)object).getName();
177         return label == null || label.length() == 0 ?
178             getString("_UI_TransformationType_type") :
179             getString("_UI_TransformationType_type") + " " + label;
180     }
181
182     /**
183      * This handles model notifications by calling {@link #updateChildren} to update any cached
184      * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
185      * <!-- begin-user-doc -->
186      * <!-- end-user-doc -->
187      * @generated
188      */

189     public void notifyChanged(Notification notification) {
190         updateChildren(notification);
191
192         switch (notification.getFeatureID(TransformationType.class)) {
193             case OljPackage.TRANSFORMATION_TYPE__NAME:
194             case OljPackage.TRANSFORMATION_TYPE__TRANSFORMATOR_CLASS_NAME:
195             case OljPackage.TRANSFORMATION_TYPE__TRANSFORMATOR_CONFIG:
196                 fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
197                 return;
198             case OljPackage.TRANSFORMATION_TYPE__SOURCE_COLUMNS:
199             case OljPackage.TRANSFORMATION_TYPE__TARGET_COLUMNS:
200             case OljPackage.TRANSFORMATION_TYPE__JAVA_SCRIPT:
201                 fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
202                 return;
203         }
204         super.notifyChanged(notification);
205     }
206
207     /**
208      * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
209      * describing all of the children that can be created under this object.
210      * <!-- begin-user-doc -->
211      * <!-- end-user-doc -->
212      * @generated
213      */

214     protected void collectNewChildDescriptors(Collection JavaDoc newChildDescriptors, Object JavaDoc object) {
215         super.collectNewChildDescriptors(newChildDescriptors, object);
216
217         newChildDescriptors.add
218             (createChildParameter
219                 (OljPackage.eINSTANCE.getTransformationType_SourceColumns(),
220                  OljFactory.eINSTANCE.createSourceColumnsType()));
221
222         newChildDescriptors.add
223             (createChildParameter
224                 (OljPackage.eINSTANCE.getTransformationType_TargetColumns(),
225                  OljFactory.eINSTANCE.createTargetColumnsType()));
226
227         newChildDescriptors.add
228             (createChildParameter
229                 (OljPackage.eINSTANCE.getTransformationType_JavaScript(),
230                  OljFactory.eINSTANCE.createJavaScriptType()));
231     }
232
233     /**
234      * Return the resource locator for this item provider's resources.
235      * <!-- begin-user-doc -->
236      * <!-- end-user-doc -->
237      * @generated
238      */

239     public ResourceLocator getResourceLocator() {
240         return OljEditPlugin.INSTANCE;
241     }
242
243 }
244
Popular Tags