KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > emf > ecore > sdo > provider > EPropertyItemProvider


1 /**
2  * <copyright>
3  *
4  * Copyright (c) 2003-2004 IBM Corporation and others.
5  * All rights reserved. This program and the accompanying materials
6  * are made available under the terms of the Eclipse Public License v1.0
7  * which accompanies this distribution, and is available at
8  * http://www.eclipse.org/legal/epl-v10.html
9  *
10  * Contributors:
11  * IBM - Initial API and implementation
12  *
13  * </copyright>
14  *
15  * $Id: EPropertyItemProvider.java,v 1.7 2005/06/08 06:17:15 nickb Exp $
16  */

17 package org.eclipse.emf.ecore.sdo.provider;
18
19
20 import java.util.List JavaDoc;
21
22 import org.eclipse.emf.common.notify.AdapterFactory;
23 import org.eclipse.emf.common.notify.Notification;
24 import org.eclipse.emf.common.util.ResourceLocator;
25 import org.eclipse.emf.ecore.sdo.EProperty;
26 import org.eclipse.emf.ecore.sdo.SDOPackage;
27 import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
28 import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
29 import org.eclipse.emf.edit.provider.IItemLabelProvider;
30 import org.eclipse.emf.edit.provider.IItemPropertySource;
31 import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
32 import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
33 import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
34 import org.eclipse.emf.edit.provider.ItemProviderAdapter;
35
36
37 import org.eclipse.emf.edit.provider.ViewerNotification;
38
39 /**
40  * This is the item provider adapter for a {@link org.eclipse.emf.ecore.sdo.EProperty} object.
41  * <!-- begin-user-doc -->
42  * <!-- end-user-doc -->
43  * @generated
44  */

45 public class EPropertyItemProvider
46   extends ItemProviderAdapter
47   implements
48     IEditingDomainItemProvider,
49     IStructuredItemContentProvider,
50     ITreeItemContentProvider,
51     IItemLabelProvider,
52     IItemPropertySource
53 {
54   /**
55    * This constructs an instance from a factory and a notifier.
56    * <!-- begin-user-doc -->
57    * <!-- end-user-doc -->
58    * @generated
59    */

60   public EPropertyItemProvider(AdapterFactory adapterFactory)
61   {
62     super(adapterFactory);
63   }
64
65   /**
66    * This returns the property descriptors for the adapted class.
67    * <!-- begin-user-doc -->
68    * <!-- end-user-doc -->
69    * @generated
70    */

71   public List JavaDoc getPropertyDescriptors(Object JavaDoc object)
72   {
73     if (itemPropertyDescriptors == null)
74     {
75       super.getPropertyDescriptors(object);
76
77       addNamePropertyDescriptor(object);
78       addManyPropertyDescriptor(object);
79       addContainmentPropertyDescriptor(object);
80       addDefaultPropertyDescriptor(object);
81       addTypePropertyDescriptor(object);
82       addContainingTypePropertyDescriptor(object);
83       addEStructuralFeaturePropertyDescriptor(object);
84     }
85     return itemPropertyDescriptors;
86   }
87
88   /**
89    * This adds a property descriptor for the Name feature.
90    * <!-- begin-user-doc -->
91    * <!-- end-user-doc -->
92    * @generated
93    */

94   protected void addNamePropertyDescriptor(Object JavaDoc object)
95   {
96     itemPropertyDescriptors.add
97       (createItemPropertyDescriptor
98         (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
99          getResourceLocator(),
100          getString("_UI_Property_name_feature"),
101          getString("_UI_PropertyDescriptor_description", "_UI_Property_name_feature", "_UI_Property_type"),
102          SDOPackage.eINSTANCE.getProperty_Name(),
103          true,
104          ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
105          null,
106          null));
107   }
108
109   /**
110    * This adds a property descriptor for the Many feature.
111    * <!-- begin-user-doc -->
112    * <!-- end-user-doc -->
113    * @generated
114    */

115   protected void addManyPropertyDescriptor(Object JavaDoc object)
116   {
117     itemPropertyDescriptors.add
118       (createItemPropertyDescriptor
119         (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
120          getResourceLocator(),
121          getString("_UI_Property_many_feature"),
122          getString("_UI_PropertyDescriptor_description", "_UI_Property_many_feature", "_UI_Property_type"),
123          SDOPackage.eINSTANCE.getProperty_Many(),
124          false,
125          ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
126          null,
127          null));
128   }
129
130   /**
131    * This adds a property descriptor for the Containment feature.
132    * <!-- begin-user-doc -->
133    * <!-- end-user-doc -->
134    * @generated
135    */

136   protected void addContainmentPropertyDescriptor(Object JavaDoc object)
137   {
138     itemPropertyDescriptors.add
139       (createItemPropertyDescriptor
140         (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
141          getResourceLocator(),
142          getString("_UI_Property_containment_feature"),
143          getString("_UI_PropertyDescriptor_description", "_UI_Property_containment_feature", "_UI_Property_type"),
144          SDOPackage.eINSTANCE.getProperty_Containment(),
145          false,
146          ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
147          null,
148          null));
149   }
150
151   /**
152    * This adds a property descriptor for the Default feature.
153    * <!-- begin-user-doc -->
154    * <!-- end-user-doc -->
155    * @generated
156    */

157   protected void addDefaultPropertyDescriptor(Object JavaDoc object)
158   {
159     itemPropertyDescriptors.add
160       (createItemPropertyDescriptor
161         (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
162          getResourceLocator(),
163          getString("_UI_Property_default_feature"),
164          getString("_UI_PropertyDescriptor_description", "_UI_Property_default_feature", "_UI_Property_type"),
165          SDOPackage.eINSTANCE.getProperty_Default(),
166          false,
167          ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
168          null,
169          null));
170   }
171
172   /**
173    * This adds a property descriptor for the Type feature.
174    * <!-- begin-user-doc -->
175    * <!-- end-user-doc -->
176    * @generated
177    */

178   protected void addTypePropertyDescriptor(Object JavaDoc object)
179   {
180     itemPropertyDescriptors.add
181       (createItemPropertyDescriptor
182         (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
183          getResourceLocator(),
184          getString("_UI_Property_type_feature"),
185          getString("_UI_PropertyDescriptor_description", "_UI_Property_type_feature", "_UI_Property_type"),
186          SDOPackage.eINSTANCE.getProperty_Type(),
187          false,
188          null,
189          null,
190          null));
191   }
192
193   /**
194    * This adds a property descriptor for the Containing Type feature.
195    * <!-- begin-user-doc -->
196    * <!-- end-user-doc -->
197    * @generated
198    */

199   protected void addContainingTypePropertyDescriptor(Object JavaDoc object)
200   {
201     itemPropertyDescriptors.add
202       (createItemPropertyDescriptor
203         (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
204          getResourceLocator(),
205          getString("_UI_Property_containingType_feature"),
206          getString("_UI_PropertyDescriptor_description", "_UI_Property_containingType_feature", "_UI_Property_type"),
207          SDOPackage.eINSTANCE.getProperty_ContainingType(),
208          false,
209          null,
210          null,
211          null));
212   }
213
214   /**
215    * This adds a property descriptor for the EStructural Feature feature.
216    * <!-- begin-user-doc -->
217    * <!-- end-user-doc -->
218    * @generated
219    */

220   protected void addEStructuralFeaturePropertyDescriptor(Object JavaDoc object)
221   {
222     itemPropertyDescriptors.add
223       (createItemPropertyDescriptor
224         (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
225          getResourceLocator(),
226          getString("_UI_EProperty_eStructuralFeature_feature"),
227          getString("_UI_PropertyDescriptor_description", "_UI_EProperty_eStructuralFeature_feature", "_UI_EProperty_type"),
228          SDOPackage.eINSTANCE.getEProperty_EStructuralFeature(),
229          true,
230          null,
231          null,
232          null));
233   }
234
235   /**
236    * This returns EProperty.gif.
237    * <!-- begin-user-doc -->
238    * <!-- end-user-doc -->
239    * @generated
240    */

241   public Object JavaDoc getImage(Object JavaDoc object)
242   {
243     return getResourceLocator().getImage("full/obj16/EProperty");
244   }
245
246   /**
247    * This returns the label text for the adapted class.
248    * <!-- begin-user-doc -->
249    * <!-- end-user-doc -->
250    * @generated
251    */

252   public String JavaDoc getText(Object JavaDoc object)
253   {
254     String JavaDoc label = ((EProperty)object).getName();
255     return label == null || label.length() == 0 ?
256       getString("_UI_EProperty_type") :
257       getString("_UI_EProperty_type") + " " + label;
258   }
259
260   /**
261    * This handles model notifications by calling {@link #updateChildren} to update any cached
262    * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
263    * <!-- begin-user-doc -->
264    * <!-- end-user-doc -->
265    * @generated
266    */

267   public void notifyChanged(Notification notification)
268   {
269     updateChildren(notification);
270
271     switch (notification.getFeatureID(EProperty.class))
272     {
273       case SDOPackage.EPROPERTY__NAME:
274       case SDOPackage.EPROPERTY__MANY:
275       case SDOPackage.EPROPERTY__CONTAINMENT:
276       case SDOPackage.EPROPERTY__DEFAULT:
277         fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
278         return;
279     }
280     super.notifyChanged(notification);
281   }
282
283   /**
284    * Return the resource locator for this item provider's resources.
285    * <!-- begin-user-doc -->
286    * <!-- end-user-doc -->
287    * @generated
288    */

289   public ResourceLocator getResourceLocator()
290   {
291     return SDOEditPlugin.INSTANCE;
292   }
293
294 }
295
Popular Tags