KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > Olj > provider > CounterColumnsTypeItemProvider


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

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

38 public class CounterColumnsTypeItemProvider
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 CounterColumnsTypeItemProvider(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             addCounterNameColumnPropertyDescriptor(object);
67             addCounterTableNamePropertyDescriptor(object);
68             addCounterValueColumnPropertyDescriptor(object);
69         }
70         return itemPropertyDescriptors;
71     }
72
73     /**
74      * This adds a property descriptor for the Counter Name Column feature.
75      * <!-- begin-user-doc -->
76      * <!-- end-user-doc -->
77      * @generated
78      */

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

97     protected void addCounterTableNamePropertyDescriptor(Object JavaDoc object) {
98         itemPropertyDescriptors.add
99             (new ItemPropertyDescriptor
100                 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
101                  getResourceLocator(),
102                  getString("_UI_CounterColumnsType_counterTableName_feature"),
103                  getString("_UI_PropertyDescriptor_description", "_UI_CounterColumnsType_counterTableName_feature", "_UI_CounterColumnsType_type"),
104                  OljPackage.eINSTANCE.getCounterColumnsType_CounterTableName(),
105                  true,
106                  ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
107     }
108
109     /**
110      * This adds a property descriptor for the Counter Value Column feature.
111      * <!-- begin-user-doc -->
112      * <!-- end-user-doc -->
113      * @generated
114      */

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

135     public Collection JavaDoc getChildrenFeatures(Object JavaDoc object) {
136         if (childrenFeatures == null) {
137             super.getChildrenFeatures(object);
138             childrenFeatures.add(OljPackage.eINSTANCE.getCounterColumnsType_Group());
139         }
140         return childrenFeatures;
141     }
142
143     /**
144      * This returns CounterColumnsType.gif.
145      * <!-- begin-user-doc -->
146      * <!-- end-user-doc -->
147      * @generated
148      */

149     public Object JavaDoc getImage(Object JavaDoc object) {
150         return getResourceLocator().getImage("full/obj16/CounterColumnsType");
151     }
152
153     /**
154      * This returns the label text for the adapted class.
155      * <!-- begin-user-doc -->
156      * <!-- end-user-doc -->
157      * @generated
158      */

159     public String JavaDoc getText(Object JavaDoc object) {
160         String JavaDoc label = ((CounterColumnsType)object).getCounterTableName();
161         return label == null || label.length() == 0 ?
162             getString("_UI_CounterColumnsType_type") :
163             getString("_UI_CounterColumnsType_type") + " " + label;
164     }
165
166     /**
167      * This handles model notifications by calling {@link #updateChildren} to update any cached
168      * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
169      * <!-- begin-user-doc -->
170      * <!-- end-user-doc -->
171      * @generated
172      */

173     public void notifyChanged(Notification notification) {
174         updateChildren(notification);
175
176         switch (notification.getFeatureID(CounterColumnsType.class)) {
177             case OljPackage.COUNTER_COLUMNS_TYPE__COUNTER_NAME_COLUMN:
178             case OljPackage.COUNTER_COLUMNS_TYPE__COUNTER_TABLE_NAME:
179             case OljPackage.COUNTER_COLUMNS_TYPE__COUNTER_VALUE_COLUMN:
180                 fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
181                 return;
182             case OljPackage.COUNTER_COLUMNS_TYPE__GROUP:
183                 fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
184                 return;
185         }
186         super.notifyChanged(notification);
187     }
188
189     /**
190      * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
191      * describing all of the children that can be created under this object.
192      * <!-- begin-user-doc -->
193      * <!-- end-user-doc -->
194      * @generated
195      */

196     protected void collectNewChildDescriptors(Collection JavaDoc newChildDescriptors, Object JavaDoc object) {
197         super.collectNewChildDescriptors(newChildDescriptors, object);
198
199         newChildDescriptors.add
200             (createChildParameter
201                 (OljPackage.eINSTANCE.getCounterColumnsType_CounterColumn(),
202                  OljFactory.eINSTANCE.createCounterColumnType()));
203
204         newChildDescriptors.add
205             (createChildParameter
206                 (OljPackage.eINSTANCE.getCounterColumnsType_SubCounterColumn(),
207                  OljFactory.eINSTANCE.createSubCounterColumnType()));
208     }
209
210     /**
211      * Return the resource locator for this item provider's resources.
212      * <!-- begin-user-doc -->
213      * <!-- end-user-doc -->
214      * @generated
215      */

216     public ResourceLocator getResourceLocator() {
217         return OljEditPlugin.INSTANCE;
218     }
219
220 }
221
Popular Tags