001: /**
002: * <copyright>
003: * </copyright>
004: *
005: * $Id: RendererItemProvider.java 24145 2007-02-01 18:03:34Z jeichar $
006: */package net.refractions.udig.project.internal.render.provider;
007:
008: import java.util.Collection;
009: import java.util.List;
010:
011: import net.refractions.udig.project.internal.provider.ProjectEditPlugin;
012: import net.refractions.udig.project.internal.render.RenderPackage;
013: import net.refractions.udig.project.internal.render.Renderer;
014:
015: import org.eclipse.emf.common.notify.AdapterFactory;
016: import org.eclipse.emf.common.notify.Notification;
017: import org.eclipse.emf.common.util.ResourceLocator;
018: import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
019: import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
020: import org.eclipse.emf.edit.provider.IItemLabelProvider;
021: import org.eclipse.emf.edit.provider.IItemPropertySource;
022: import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
023: import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
024: import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
025: import org.eclipse.emf.edit.provider.ItemProviderAdapter;
026: import org.eclipse.emf.edit.provider.ViewerNotification;
027:
028: /**
029: * This is the item provider adapter for a
030: * {@link net.refractions.udig.project.internal.render.Renderer} object. <!-- begin-user-doc -->
031: * <!-- end-user-doc -->
032: *
033: * @generated
034: */
035: public class RendererItemProvider extends ItemProviderAdapter implements
036: IEditingDomainItemProvider, IStructuredItemContentProvider,
037: ITreeItemContentProvider, IItemLabelProvider,
038: IItemPropertySource {
039: /**
040: * <!-- begin-user-doc --> <!-- end-user-doc -->
041: *
042: * @generated
043: */
044: public static final String copyright = "uDig - User Friendly Desktop Internet GIS client http://udig.refractions.net (C) 2004, Refractions Research Inc. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; version 2.1 of the License. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details."; //$NON-NLS-1$
045:
046: /**
047: * This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!--
048: * end-user-doc -->
049: *
050: * @generated
051: */
052: public RendererItemProvider(AdapterFactory adapterFactory) {
053: super (adapterFactory);
054: }
055:
056: /**
057: * This returns the property descriptors for the adapted class. <!-- begin-user-doc --> <!--
058: * end-user-doc -->
059: *
060: * @generated
061: */
062: public List getPropertyDescriptors(Object object) {
063: if (itemPropertyDescriptors == null) {
064: super .getPropertyDescriptors(object);
065:
066: addStatePropertyDescriptor(object);
067: addNamePropertyDescriptor(object);
068: addContextPropertyDescriptor(object);
069: }
070: return itemPropertyDescriptors;
071: }
072:
073: /**
074: * This adds a property descriptor for the Name feature. <!-- begin-user-doc --> <!--
075: * end-user-doc -->
076: *
077: * @generated
078: */
079: protected void addNamePropertyDescriptor(Object object) {
080: itemPropertyDescriptors
081: .add(createItemPropertyDescriptor(
082: ((ComposeableAdapterFactory) adapterFactory)
083: .getRootAdapterFactory(),
084: getResourceLocator(),
085: getString("_UI_Renderer_name_feature"), //$NON-NLS-1$
086: getString(
087: "_UI_PropertyDescriptor_description", "_UI_Renderer_name_feature", "_UI_Renderer_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
088: RenderPackage.eINSTANCE.getRenderer_Name(),
089: true,
090: ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
091: null, null));
092: }
093:
094: /**
095: * This adds a property descriptor for the State feature. <!-- begin-user-doc --> <!--
096: * end-user-doc -->
097: *
098: * @generated
099: */
100: protected void addStatePropertyDescriptor(Object object) {
101: itemPropertyDescriptors
102: .add(createItemPropertyDescriptor(
103: ((ComposeableAdapterFactory) adapterFactory)
104: .getRootAdapterFactory(),
105: getResourceLocator(),
106: getString("_UI_Renderer_state_feature"), //$NON-NLS-1$
107: getString(
108: "_UI_PropertyDescriptor_description", "_UI_Renderer_state_feature", "_UI_Renderer_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
109: RenderPackage.eINSTANCE.getRenderer_State(),
110: true,
111: ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE,
112: null, null));
113: }
114:
115: /**
116: * This adds a property descriptor for the Context feature. <!-- begin-user-doc --> <!--
117: * end-user-doc -->
118: *
119: * @generated
120: */
121: protected void addContextPropertyDescriptor(Object object) {
122: itemPropertyDescriptors
123: .add(createItemPropertyDescriptor(
124: ((ComposeableAdapterFactory) adapterFactory)
125: .getRootAdapterFactory(),
126: getResourceLocator(),
127: getString("_UI_Renderer_context_feature"), //$NON-NLS-1$
128: getString(
129: "_UI_PropertyDescriptor_description", "_UI_Renderer_context_feature", "_UI_Renderer_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
130: RenderPackage.eINSTANCE.getRenderer_Context(),
131: true, null, null, null));
132: }
133:
134: /**
135: * This returns Renderer.gif. <!-- begin-user-doc --> <!-- end-user-doc -->
136: *
137: * @generated
138: */
139: public Object getImage(Object object) {
140: return getResourceLocator().getImage("full/obj16/Renderer"); //$NON-NLS-1$
141: }
142:
143: /**
144: * This returns the label text for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc
145: * -->
146: *
147: * @generated NOT
148: */
149: public String getText(Object object) {
150: String label = ((Renderer) object).getName();
151: return label == null || label.length() == 0 ? "Renderer"
152: : label;
153: }
154:
155: /**
156: * This handles model notifications by calling {@link #updateChildren} to update any cached
157: * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
158: * <!-- begin-user-doc --> <!-- end-user-doc -->
159: *
160: * @generated
161: */
162: public void notifyChanged(Notification notification) {
163: updateChildren(notification);
164:
165: switch (notification.getFeatureID(Renderer.class)) {
166: case RenderPackage.RENDERER__STATE:
167: case RenderPackage.RENDERER__NAME:
168: fireNotifyChanged(new ViewerNotification(notification,
169: notification.getNotifier(), false, true));
170: return;
171: }
172: super .notifyChanged(notification);
173: }
174:
175: /**
176: * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
177: * describing all of the children that can be created under this object. <!-- begin-user-doc -->
178: * <!-- end-user-doc -->
179: *
180: * @generated
181: */
182: protected void collectNewChildDescriptors(
183: Collection newChildDescriptors, Object object) {
184: super .collectNewChildDescriptors(newChildDescriptors, object);
185: }
186:
187: /**
188: * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!--
189: * end-user-doc -->
190: *
191: * @generated
192: */
193: public ResourceLocator getResourceLocator() {
194: return ProjectEditPlugin.INSTANCE;
195: }
196:
197: }
|