KickJava   Java API By Example, From Geeks To Geeks.

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


1 /**
2  * <copyright>
3  *
4  * Copyright (c) 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: EDataObjectSimpleAnyTypeItemProvider.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.Collection JavaDoc;
21 import java.util.List JavaDoc;
22
23 import org.eclipse.emf.common.notify.AdapterFactory;
24 import org.eclipse.emf.common.notify.Notification;
25
26 import org.eclipse.emf.common.util.ResourceLocator;
27
28 import org.eclipse.emf.ecore.sdo.EDataObjectSimpleAnyType;
29 import org.eclipse.emf.ecore.sdo.SDOPackage;
30
31 import org.eclipse.emf.ecore.xml.type.XMLTypePackage;
32
33 import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
34 import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
35 import org.eclipse.emf.edit.provider.IItemLabelProvider;
36 import org.eclipse.emf.edit.provider.IItemPropertySource;
37 import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
38 import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
39 import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
40 import org.eclipse.emf.edit.provider.ItemProviderAdapter;
41
42 import org.eclipse.emf.edit.provider.ViewerNotification;
43
44 /**
45  * This is the item provider adapter for a {@link org.eclipse.emf.ecore.sdo.EDataObjectSimpleAnyType} object.
46  * <!-- begin-user-doc -->
47  * <!-- end-user-doc -->
48  * @generated
49  */

50 public class EDataObjectSimpleAnyTypeItemProvider
51   extends ItemProviderAdapter
52   implements
53     IEditingDomainItemProvider,
54     IStructuredItemContentProvider,
55     ITreeItemContentProvider,
56     IItemLabelProvider,
57     IItemPropertySource
58 {
59   /**
60    * This constructs an instance from a factory and a notifier.
61    * <!-- begin-user-doc -->
62    * <!-- end-user-doc -->
63    * @generated
64    */

65   public EDataObjectSimpleAnyTypeItemProvider(AdapterFactory adapterFactory)
66   {
67     super(adapterFactory);
68   }
69
70   /**
71    * This returns the property descriptors for the adapted class.
72    * <!-- begin-user-doc -->
73    * <!-- end-user-doc -->
74    * @generated
75    */

76   public List JavaDoc getPropertyDescriptors(Object JavaDoc object)
77   {
78     if (itemPropertyDescriptors == null)
79     {
80       super.getPropertyDescriptors(object);
81
82       addRawValuePropertyDescriptor(object);
83       addValuePropertyDescriptor(object);
84       addInstanceTypePropertyDescriptor(object);
85     }
86     return itemPropertyDescriptors;
87   }
88
89   /**
90    * This adds a property descriptor for the Raw Value feature.
91    * <!-- begin-user-doc -->
92    * <!-- end-user-doc -->
93    * @generated
94    */

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

116   protected void addValuePropertyDescriptor(Object JavaDoc object)
117   {
118     itemPropertyDescriptors.add
119       (createItemPropertyDescriptor
120         (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
121          getResourceLocator(),
122          getString("_UI_SimpleAnyType_value_feature"),
123          getString("_UI_PropertyDescriptor_description", "_UI_SimpleAnyType_value_feature", "_UI_SimpleAnyType_type"),
124          XMLTypePackage.eINSTANCE.getSimpleAnyType_Value(),
125          true,
126          ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
127          null,
128          null));
129   }
130
131   /**
132    * This adds a property descriptor for the Instance Type feature.
133    * <!-- begin-user-doc -->
134    * <!-- end-user-doc -->
135    * @generated
136    */

137   protected void addInstanceTypePropertyDescriptor(Object JavaDoc object)
138   {
139     itemPropertyDescriptors.add
140       (createItemPropertyDescriptor
141         (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
142          getResourceLocator(),
143          getString("_UI_SimpleAnyType_instanceType_feature"),
144          getString("_UI_PropertyDescriptor_description", "_UI_SimpleAnyType_instanceType_feature", "_UI_SimpleAnyType_type"),
145          XMLTypePackage.eINSTANCE.getSimpleAnyType_InstanceType(),
146          true,
147          null,
148          null,
149          null));
150   }
151
152   /**
153    * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
154    * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
155    * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
156    * <!-- begin-user-doc -->
157    * <!-- end-user-doc -->
158    * @generated
159    */

160   public Collection JavaDoc getChildrenFeatures(Object JavaDoc object)
161   {
162     if (childrenFeatures == null)
163     {
164       super.getChildrenFeatures(object);
165       childrenFeatures.add(XMLTypePackage.eINSTANCE.getAnyType_Mixed());
166     }
167     return childrenFeatures;
168   }
169
170   /**
171    * This returns EDataObjectSimpleAnyType.gif.
172    * <!-- begin-user-doc -->
173    * <!-- end-user-doc -->
174    * @generated
175    */

176   public Object JavaDoc getImage(Object JavaDoc object)
177   {
178     return getResourceLocator().getImage("full/obj16/EDataObjectSimpleAnyType");
179   }
180
181   /**
182    * This returns the label text for the adapted class.
183    * <!-- begin-user-doc -->
184    * <!-- end-user-doc -->
185    * @generated
186    */

187   public String JavaDoc getText(Object JavaDoc object)
188   {
189     String JavaDoc label = ((EDataObjectSimpleAnyType)object).getRawValue();
190     return label == null || label.length() == 0 ?
191       getString("_UI_EDataObjectSimpleAnyType_type") :
192       getString("_UI_EDataObjectSimpleAnyType_type") + " " + label;
193   }
194
195   /**
196    * This handles model notifications by calling {@link #updateChildren} to update any cached
197    * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
198    * <!-- begin-user-doc -->
199    * <!-- end-user-doc -->
200    * @generated
201    */

202   public void notifyChanged(Notification notification)
203   {
204     updateChildren(notification);
205
206     switch (notification.getFeatureID(EDataObjectSimpleAnyType.class))
207     {
208       case SDOPackage.EDATA_OBJECT_SIMPLE_ANY_TYPE__RAW_VALUE:
209       case SDOPackage.EDATA_OBJECT_SIMPLE_ANY_TYPE__VALUE:
210         fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
211         return;
212       case SDOPackage.EDATA_OBJECT_SIMPLE_ANY_TYPE__MIXED:
213         fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
214         return;
215     }
216     super.notifyChanged(notification);
217   }
218
219   /**
220    * Return the resource locator for this item provider's resources.
221    * <!-- begin-user-doc -->
222    * <!-- end-user-doc -->
223    * @generated
224    */

225   public ResourceLocator getResourceLocator()
226   {
227     return SDOEditPlugin.INSTANCE;
228   }
229
230 }
231
Popular Tags