KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > Olj > provider > IncludeTypeItemProvider


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

7 package Olj.provider;
8
9
10 import Olj.IncludeType;
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.IncludeType} object.
33  * <!-- begin-user-doc -->
34  * <!-- end-user-doc -->
35  * @generated
36  */

37 public class IncludeTypeItemProvider
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 IncludeTypeItemProvider(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             addHrefPropertyDescriptor(object);
66             addParsePropertyDescriptor(object);
67         }
68         return itemPropertyDescriptors;
69     }
70
71     /**
72      * This adds a property descriptor for the Href feature.
73      * <!-- begin-user-doc -->
74      * <!-- end-user-doc -->
75      * @generated
76      */

77     protected void addHrefPropertyDescriptor(Object JavaDoc object) {
78         itemPropertyDescriptors.add
79             (new ItemPropertyDescriptor
80                 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
81                  getResourceLocator(),
82                  getString("_UI_IncludeType_href_feature"),
83                  getString("_UI_PropertyDescriptor_description", "_UI_IncludeType_href_feature", "_UI_IncludeType_type"),
84                  OljPackage.eINSTANCE.getIncludeType_Href(),
85                  true,
86                  ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
87     }
88
89     /**
90      * This adds a property descriptor for the Parse feature.
91      * <!-- begin-user-doc -->
92      * <!-- end-user-doc -->
93      * @generated
94      */

95     protected void addParsePropertyDescriptor(Object JavaDoc object) {
96         itemPropertyDescriptors.add
97             (new ItemPropertyDescriptor
98                 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
99                  getResourceLocator(),
100                  getString("_UI_IncludeType_parse_feature"),
101                  getString("_UI_PropertyDescriptor_description", "_UI_IncludeType_parse_feature", "_UI_IncludeType_type"),
102                  OljPackage.eINSTANCE.getIncludeType_Parse(),
103                  true,
104                  ItemPropertyDescriptor.GENERIC_VALUE_IMAGE));
105     }
106
107     /**
108      * This returns IncludeType.gif.
109      * <!-- begin-user-doc -->
110      * <!-- end-user-doc -->
111      * @generated
112      */

113     public Object JavaDoc getImage(Object JavaDoc object) {
114         return getResourceLocator().getImage("full/obj16/IncludeType");
115     }
116
117     /**
118      * This returns the label text for the adapted class.
119      * <!-- begin-user-doc -->
120      * <!-- end-user-doc -->
121      * @generated
122      */

123     public String JavaDoc getText(Object JavaDoc object) {
124         String JavaDoc label = ((IncludeType)object).getHref();
125         return label == null || label.length() == 0 ?
126             getString("_UI_IncludeType_type") :
127             getString("_UI_IncludeType_type") + " " + label;
128     }
129
130     /**
131      * This handles model notifications by calling {@link #updateChildren} to update any cached
132      * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
133      * <!-- begin-user-doc -->
134      * <!-- end-user-doc -->
135      * @generated
136      */

137     public void notifyChanged(Notification notification) {
138         updateChildren(notification);
139
140         switch (notification.getFeatureID(IncludeType.class)) {
141             case OljPackage.INCLUDE_TYPE__HREF:
142             case OljPackage.INCLUDE_TYPE__PARSE:
143                 fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
144                 return;
145         }
146         super.notifyChanged(notification);
147     }
148
149     /**
150      * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
151      * describing all of the children that can be created under this object.
152      * <!-- begin-user-doc -->
153      * <!-- end-user-doc -->
154      * @generated
155      */

156     protected void collectNewChildDescriptors(Collection JavaDoc newChildDescriptors, Object JavaDoc object) {
157         super.collectNewChildDescriptors(newChildDescriptors, object);
158     }
159
160     /**
161      * Return the resource locator for this item provider's resources.
162      * <!-- begin-user-doc -->
163      * <!-- end-user-doc -->
164      * @generated
165      */

166     public ResourceLocator getResourceLocator() {
167         return OljEditPlugin.INSTANCE;
168     }
169
170 }
171
Popular Tags