KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > Olj > provider > EchoTypeItemProvider


1 /**
2  * <copyright>
3  * </copyright>
4  *
5  * $Id$
6  */

7 package Olj.provider;
8
9
10 import Olj.EchoType;
11 import Olj.OljPackage;
12
13 import java.util.Collection JavaDoc;
14 import java.util.List JavaDoc;
15
16 import org.eclipse.emf.common.notify.AdapterFactory;
17 import org.eclipse.emf.common.notify.Notification;
18
19 import org.eclipse.emf.common.util.ResourceLocator;
20
21 import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
22 import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
23 import org.eclipse.emf.edit.provider.IItemLabelProvider;
24 import org.eclipse.emf.edit.provider.IItemPropertySource;
25 import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
26 import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
27 import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
28 import org.eclipse.emf.edit.provider.ItemProviderAdapter;
29 import org.eclipse.emf.edit.provider.ViewerNotification;
30
31 /**
32  * This is the item provider adpater for a {@link Olj.EchoType} object.
33  * <!-- begin-user-doc -->
34  * <!-- end-user-doc -->
35  * @generated
36  */

37 public class EchoTypeItemProvider
38     extends ItemProviderAdapter
39     implements
40         IEditingDomainItemProvider,
41         IStructuredItemContentProvider,
42         ITreeItemContentProvider,
43         IItemLabelProvider,
44         IItemPropertySource {
45     /**
46      * This constructs an instance from a factory and a notifier.
47      * <!-- begin-user-doc -->
48      * <!-- end-user-doc -->
49      * @generated
50      */

51     public EchoTypeItemProvider(AdapterFactory adapterFactory) {
52         super(adapterFactory);
53     }
54
55     /**
56      * This returns the property descriptors for the adapted class.
57      * <!-- begin-user-doc -->
58      * <!-- end-user-doc -->
59      * @generated
60      */

61     public List JavaDoc getPropertyDescriptors(Object JavaDoc object) {
62         if (itemPropertyDescriptors == null) {
63             super.getPropertyDescriptors(object);
64
65             addMessagePropertyDescriptor(object);
66         }
67         return itemPropertyDescriptors;
68     }
69
70     /**
71      * This adds a property descriptor for the Message feature.
72      * <!-- begin-user-doc -->
73      * <!-- end-user-doc -->
74      * @generated
75      */

76     protected void addMessagePropertyDescriptor(Object JavaDoc object) {
77         itemPropertyDescriptors.add
78             (new ItemPropertyDescriptor
79                 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
80                  getResourceLocator(),
81                  getString("_UI_EchoType_message_feature"),
82                  getString("_UI_PropertyDescriptor_description", "_UI_EchoType_message_feature", "_UI_EchoType_type"),
83                  OljPackage.eINSTANCE.getEchoType_Message(),
84                  true,
85                  ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
86     }
87
88     /**
89      * This returns EchoType.gif.
90      * <!-- begin-user-doc -->
91      * <!-- end-user-doc -->
92      * @generated
93      */

94     public Object JavaDoc getImage(Object JavaDoc object) {
95         return getResourceLocator().getImage("full/obj16/EchoType");
96     }
97
98     /**
99      * This returns the label text for the adapted class.
100      * <!-- begin-user-doc -->
101      * <!-- end-user-doc -->
102      * @generated
103      */

104     public String JavaDoc getText(Object JavaDoc object) {
105         String JavaDoc label = ((EchoType)object).getMessage();
106         return label == null || label.length() == 0 ?
107             getString("_UI_EchoType_type") :
108             getString("_UI_EchoType_type") + " " + label;
109     }
110
111     /**
112      * This handles model notifications by calling {@link #updateChildren} to update any cached
113      * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
114      * <!-- begin-user-doc -->
115      * <!-- end-user-doc -->
116      * @generated
117      */

118     public void notifyChanged(Notification notification) {
119         updateChildren(notification);
120
121         switch (notification.getFeatureID(EchoType.class)) {
122             case OljPackage.ECHO_TYPE__MESSAGE:
123                 fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
124                 return;
125         }
126         super.notifyChanged(notification);
127     }
128
129     /**
130      * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
131      * describing all of the children that can be created under this object.
132      * <!-- begin-user-doc -->
133      * <!-- end-user-doc -->
134      * @generated
135      */

136     protected void collectNewChildDescriptors(Collection JavaDoc newChildDescriptors, Object JavaDoc object) {
137         super.collectNewChildDescriptors(newChildDescriptors, object);
138     }
139
140     /**
141      * Return the resource locator for this item provider's resources.
142      * <!-- begin-user-doc -->
143      * <!-- end-user-doc -->
144      * @generated
145      */

146     public ResourceLocator getResourceLocator() {
147         return OljEditPlugin.INSTANCE;
148     }
149
150 }
151
Popular Tags