KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > emf > codegen > ecore > genmodel > provider > GenEnumLiteralItemProvider


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

17 package org.eclipse.emf.codegen.ecore.genmodel.provider;
18
19
20 import java.util.List JavaDoc;
21
22 import org.eclipse.emf.codegen.ecore.genmodel.GenEnumLiteral;
23 import org.eclipse.emf.codegen.ecore.genmodel.GenModelPackage;
24 import org.eclipse.emf.common.notify.AdapterFactory;
25 import org.eclipse.emf.common.notify.Notification;
26 import org.eclipse.emf.common.util.ResourceLocator;
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
34 import org.eclipse.emf.edit.provider.ViewerNotification;
35
36 // import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
37

38
39 /**
40  * This is the item provider adapter for a {@link org.eclipse.emf.codegen.ecore.genmodel.GenEnumLiteral} object.
41  * <!-- begin-user-doc -->
42  * <!-- end-user-doc -->
43  * @generated
44  */

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

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

67   public List JavaDoc getPropertyDescriptors(Object JavaDoc object)
68   {
69     if (itemPropertyDescriptors == null)
70     {
71       super.getPropertyDescriptors(object);
72
73       addEcoreEnumLiteralPropertyDescriptor(object);
74     }
75     return itemPropertyDescriptors;
76   }
77
78   /**
79    * This adds a property descriptor for the Ecore Enum Literal feature.
80    * <!-- begin-user-doc -->
81    * <!-- end-user-doc -->
82    * @generated
83    */

84   protected void addEcoreEnumLiteralPropertyDescriptor(Object JavaDoc object)
85   {
86     itemPropertyDescriptors.add
87       (createItemPropertyDescriptor
88         (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
89          getResourceLocator(),
90          getString("_UI_GenEnumLiteral_ecoreEnumLiteral_feature"),
91          getString("_UI_GenEnumLiteral_ecoreEnumLiteral_description"),
92          GenModelPackage.eINSTANCE.getGenEnumLiteral_EcoreEnumLiteral(),
93          false,
94          null,
95          getString("_UI_EcorePropertyCategory"),
96          null));
97   }
98
99   /**
100    */

101   public Object JavaDoc getImage(Object JavaDoc object)
102   {
103     return new UnderlayedImage(getResourceLocator().getImage("full/obj16/EEnumLiteral"));
104   }
105
106   /**
107    * This returns the label text for the adapted class.
108    */

109   public String JavaDoc getText(Object JavaDoc object)
110   {
111     GenEnumLiteral genEnumLiteral = (GenEnumLiteral)object;
112     return genEnumLiteral.getEcoreEnumLiteral().getName() + " = " + genEnumLiteral.getEcoreEnumLiteral().getValue();
113   }
114
115   /**
116    * This handles model notifications by calling {@link #updateChildren} to update any cached
117    * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
118    * <!-- begin-user-doc -->
119    * <!-- end-user-doc -->
120    * @generated
121    */

122   public void notifyChanged(Notification notification)
123   {
124     updateChildren(notification);
125
126     switch (notification.getFeatureID(GenEnumLiteral.class))
127     {
128       case GenModelPackage.GEN_ENUM_LITERAL__ECORE_ENUM_LITERAL:
129         fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
130         return;
131     }
132     super.notifyChanged(notification);
133   }
134
135   /**
136    * Return the resource locator for this item provider's resources.
137    * <!-- begin-user-doc -->
138    * <!-- end-user-doc -->
139    * @generated
140    */

141   public ResourceLocator getResourceLocator()
142   {
143     return GenModelEditPlugin.INSTANCE;
144   }
145
146 }
147
Popular Tags