KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > emf > ecore > change > provider > FeatureMapEntryItemProvider


1 /**
2  * <copyright>
3  *
4  * Copyright (c) 2005 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: FeatureMapEntryItemProvider.java,v 1.2 2005/06/08 06:17:29 nickb Exp $
16  */

17 package org.eclipse.emf.ecore.change.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
25 import org.eclipse.emf.common.util.ResourceLocator;
26
27 import org.eclipse.emf.ecore.change.ChangePackage;
28 import org.eclipse.emf.ecore.change.FeatureMapEntry;
29
30 import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
31 import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
32 import org.eclipse.emf.edit.provider.IItemLabelProvider;
33 import org.eclipse.emf.edit.provider.IItemPropertySource;
34 import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
35 import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
36 import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
37 import org.eclipse.emf.edit.provider.ItemProviderAdapter;
38 import org.eclipse.emf.edit.provider.ViewerNotification;
39
40 /**
41  * This is the item provider adapter for a {@link org.eclipse.emf.ecore.change.FeatureMapEntry} object.
42  * <!-- begin-user-doc -->
43  * <!-- end-user-doc -->
44  * @generated
45  */

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

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

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

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

114   protected void addDataValuePropertyDescriptor(Object JavaDoc object)
115   {
116     itemPropertyDescriptors.add
117       (createItemPropertyDescriptor
118         (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
119          getResourceLocator(),
120          getString("_UI_FeatureMapEntry_dataValue_feature"),
121          getString("_UI_PropertyDescriptor_description", "_UI_FeatureMapEntry_dataValue_feature", "_UI_FeatureMapEntry_type"),
122          ChangePackage.eINSTANCE.getFeatureMapEntry_DataValue(),
123          true,
124          ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
125          null,
126          null));
127   }
128
129   /**
130    * This adds a property descriptor for the Value feature.
131    * <!-- begin-user-doc -->
132    * <!-- end-user-doc -->
133    * @generated
134    */

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

156   protected void addFeaturePropertyDescriptor(Object JavaDoc object)
157   {
158     itemPropertyDescriptors.add
159       (createItemPropertyDescriptor
160         (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
161          getResourceLocator(),
162          getString("_UI_FeatureMapEntry_feature_feature"),
163          getString("_UI_PropertyDescriptor_description", "_UI_FeatureMapEntry_feature_feature", "_UI_FeatureMapEntry_type"),
164          ChangePackage.eINSTANCE.getFeatureMapEntry_Feature(),
165          true,
166          null,
167          null,
168          null));
169   }
170
171   /**
172    * This adds a property descriptor for the Reference Value feature.
173    * <!-- begin-user-doc -->
174    * <!-- end-user-doc -->
175    * @generated
176    */

177   protected void addReferenceValuePropertyDescriptor(Object JavaDoc object)
178   {
179     itemPropertyDescriptors.add
180       (createItemPropertyDescriptor
181         (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
182          getResourceLocator(),
183          getString("_UI_FeatureMapEntry_referenceValue_feature"),
184          getString("_UI_PropertyDescriptor_description", "_UI_FeatureMapEntry_referenceValue_feature", "_UI_FeatureMapEntry_type"),
185          ChangePackage.eINSTANCE.getFeatureMapEntry_ReferenceValue(),
186          true,
187          null,
188          null,
189          null));
190   }
191
192   /**
193    * This returns FeatureMapEntry.gif.
194    * <!-- begin-user-doc -->
195    * <!-- end-user-doc -->
196    * @generated
197    */

198   public Object JavaDoc getImage(Object JavaDoc object)
199   {
200     return getResourceLocator().getImage("full/obj16/FeatureMapEntry");
201   }
202
203   /**
204    * This returns the label text for the adapted class.
205    * <!-- begin-user-doc -->
206    * <!-- end-user-doc -->
207    * @generated
208    */

209   public String JavaDoc getText(Object JavaDoc object)
210   {
211     String JavaDoc label = ((FeatureMapEntry)object).getFeatureName();
212     return label == null || label.length() == 0 ?
213       getString("_UI_FeatureMapEntry_type") :
214       getString("_UI_FeatureMapEntry_type") + " " + label;
215   }
216
217   /**
218    * This handles model notifications by calling {@link #updateChildren} to update any cached
219    * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
220    * <!-- begin-user-doc -->
221    * <!-- end-user-doc -->
222    * @generated
223    */

224   public void notifyChanged(Notification notification)
225   {
226     updateChildren(notification);
227
228     switch (notification.getFeatureID(FeatureMapEntry.class))
229     {
230       case ChangePackage.FEATURE_MAP_ENTRY__FEATURE_NAME:
231       case ChangePackage.FEATURE_MAP_ENTRY__DATA_VALUE:
232       case ChangePackage.FEATURE_MAP_ENTRY__VALUE:
233         fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
234         return;
235     }
236     super.notifyChanged(notification);
237   }
238
239   /**
240    * Return the resource locator for this item provider's resources.
241    * <!-- begin-user-doc -->
242    * <!-- end-user-doc -->
243    * @generated
244    */

245   public ResourceLocator getResourceLocator()
246   {
247     return ChangeEditPlugin.INSTANCE;
248   }
249
250 }
251
Popular Tags