KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > emf > ecore > provider > EEnumItemProvider


1 /**
2  * <copyright>
3  *
4  * Copyright (c) 2002-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: EEnumItemProvider.java,v 1.5 2005/06/08 06:15:46 nickb Exp $
16  */

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

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

55   public EEnumItemProvider(AdapterFactory adapterFactory)
56   {
57     super(adapterFactory);
58   }
59
60   /**
61    * This returns the property descriptors for the adapted class.
62    * <!-- begin-user-doc -->
63    * <!-- end-user-doc -->
64    * @generated
65    */

66   public List JavaDoc getPropertyDescriptors(Object JavaDoc object)
67   {
68     if (itemPropertyDescriptors == null)
69     {
70       super.getPropertyDescriptors(object);
71
72     }
73     return itemPropertyDescriptors;
74   }
75
76   /**
77    * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
78    * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
79    * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
80    * <!-- begin-user-doc -->
81    * <!-- end-user-doc -->
82    * @generated
83    */

84   public Collection JavaDoc getChildrenFeatures(Object JavaDoc object)
85   {
86     if (childrenFeatures == null)
87     {
88       super.getChildrenFeatures(object);
89       childrenFeatures.add(EcorePackage.eINSTANCE.getEEnum_ELiterals());
90     }
91     return childrenFeatures;
92   }
93
94   /**
95    * This returns EEnum.gif.
96    * <!-- begin-user-doc -->
97    * <!-- end-user-doc -->
98    * @generated
99    */

100   public Object JavaDoc getImage(Object JavaDoc object)
101   {
102     return getResourceLocator().getImage("full/obj16/EEnum");
103   }
104
105   /**
106    * This returns the label text for the adapted class.
107    * <!-- begin-user-doc -->
108    * <!-- end-user-doc -->
109    * @generated NOT
110    */

111   public String JavaDoc getText(Object JavaDoc object)
112   {
113     EEnum eEnum = (EEnum)object;
114     StringBuffer JavaDoc result = new StringBuffer JavaDoc();
115     result.append(eEnum.getName());
116     return result.toString();
117   }
118
119   /**
120    * This handles model notifications by calling {@link #updateChildren} to update any cached
121    * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
122    * <!-- begin-user-doc -->
123    * <!-- end-user-doc -->
124    * @generated
125    */

126   public void notifyChanged(Notification notification)
127   {
128     updateChildren(notification);
129
130     switch (notification.getFeatureID(EEnum.class))
131     {
132       case EcorePackage.EENUM__ELITERALS:
133         fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
134         return;
135     }
136     super.notifyChanged(notification);
137   }
138
139   /**
140    * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
141    * describing all of the children that can be created under this object.
142    * <!-- begin-user-doc -->
143    * <!-- end-user-doc -->
144    * @generated
145    */

146   protected void collectNewChildDescriptors(Collection JavaDoc newChildDescriptors, Object JavaDoc object)
147   {
148     super.collectNewChildDescriptors(newChildDescriptors, object);
149
150     newChildDescriptors.add
151       (createChildParameter
152         (EcorePackage.eINSTANCE.getEEnum_ELiterals(),
153          EcoreFactory.eINSTANCE.createEEnumLiteral()));
154   }
155
156   /**
157    * Return the resource locator for this item provider's resources.
158    * <!-- begin-user-doc -->
159    * <!-- end-user-doc -->
160    * @generated
161    */

162   public ResourceLocator getResourceLocator()
163   {
164     return EcoreEditPlugin.INSTANCE;
165   }
166
167 }
168
Popular Tags