001: /**
002: * <copyright>
003: * </copyright>
004: *
005: * $Id: BlackboardEntryItemProvider.java 24145 2007-02-01 18:03:34Z jeichar $
006: */package net.refractions.udig.project.internal.provider;
007:
008: import java.util.List;
009:
010: import net.refractions.udig.project.internal.BlackboardEntry;
011: import net.refractions.udig.project.internal.ProjectPackage;
012:
013: import org.eclipse.emf.common.notify.AdapterFactory;
014: import org.eclipse.emf.common.notify.Notification;
015: import org.eclipse.emf.common.util.ResourceLocator;
016: import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
017: import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
018: import org.eclipse.emf.edit.provider.IItemLabelProvider;
019: import org.eclipse.emf.edit.provider.IItemPropertySource;
020: import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
021: import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
022: import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
023: import org.eclipse.emf.edit.provider.ItemProviderAdapter;
024: import org.eclipse.emf.edit.provider.ViewerNotification;
025:
026: /**
027: * This is the item provider adapter for a
028: * {@link net.refractions.udig.project.internal.BlackboardEntry} object. <!-- begin-user-doc -->
029: * <!-- end-user-doc -->
030: *
031: * @generated
032: */
033: public class BlackboardEntryItemProvider extends ItemProviderAdapter
034: implements IEditingDomainItemProvider,
035: IStructuredItemContentProvider, ITreeItemContentProvider,
036: IItemLabelProvider, IItemPropertySource {
037: /**
038: * <!-- begin-user-doc --> <!-- end-user-doc -->
039: *
040: * @generated
041: */
042: 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$
043:
044: /**
045: * This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!--
046: * end-user-doc -->
047: *
048: * @generated
049: */
050: public BlackboardEntryItemProvider(AdapterFactory adapterFactory) {
051: super (adapterFactory);
052: }
053:
054: /**
055: * This returns the property descriptors for the adapted class. <!-- begin-user-doc --> <!--
056: * end-user-doc -->
057: *
058: * @generated
059: */
060: public List getPropertyDescriptors(Object object) {
061: if (itemPropertyDescriptors == null) {
062: super .getPropertyDescriptors(object);
063:
064: addKeyPropertyDescriptor(object);
065: addMementoPropertyDescriptor(object);
066: addObjectClassPropertyDescriptor(object);
067: addObjectPropertyDescriptor(object);
068: }
069: return itemPropertyDescriptors;
070: }
071:
072: /**
073: * This adds a property descriptor for the Key feature. <!-- begin-user-doc --> <!--
074: * end-user-doc -->
075: *
076: * @generated
077: */
078: protected void addKeyPropertyDescriptor(Object object) {
079: itemPropertyDescriptors
080: .add(createItemPropertyDescriptor(
081: ((ComposeableAdapterFactory) adapterFactory)
082: .getRootAdapterFactory(),
083: getResourceLocator(),
084: getString("_UI_BlackboardEntry_key_feature"), //$NON-NLS-1$
085: getString(
086: "_UI_PropertyDescriptor_description", "_UI_BlackboardEntry_key_feature", "_UI_BlackboardEntry_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
087: ProjectPackage.eINSTANCE
088: .getBlackboardEntry_Key(), true,
089: ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
090: null, null));
091: }
092:
093: /**
094: * This adds a property descriptor for the Memento feature. <!-- begin-user-doc --> <!--
095: * end-user-doc -->
096: *
097: * @generated
098: */
099: protected void addMementoPropertyDescriptor(Object object) {
100: itemPropertyDescriptors
101: .add(createItemPropertyDescriptor(
102: ((ComposeableAdapterFactory) adapterFactory)
103: .getRootAdapterFactory(),
104: getResourceLocator(),
105: getString("_UI_BlackboardEntry_memento_feature"), //$NON-NLS-1$
106: getString(
107: "_UI_PropertyDescriptor_description", "_UI_BlackboardEntry_memento_feature", "_UI_BlackboardEntry_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
108: ProjectPackage.eINSTANCE
109: .getBlackboardEntry_Memento(), true,
110: ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
111: null, null));
112: }
113:
114: /**
115: * This adds a property descriptor for the Object Class feature. <!-- begin-user-doc --> <!--
116: * end-user-doc -->
117: *
118: * @generated
119: */
120: protected void addObjectClassPropertyDescriptor(Object object) {
121: itemPropertyDescriptors
122: .add(createItemPropertyDescriptor(
123: ((ComposeableAdapterFactory) adapterFactory)
124: .getRootAdapterFactory(),
125: getResourceLocator(),
126: getString("_UI_BlackboardEntry_objectClass_feature"), //$NON-NLS-1$
127: getString(
128: "_UI_PropertyDescriptor_description", "_UI_BlackboardEntry_objectClass_feature", "_UI_BlackboardEntry_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
129: ProjectPackage.eINSTANCE
130: .getBlackboardEntry_ObjectClass(),
131: true,
132: ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
133: null, null));
134: }
135:
136: /**
137: * This adds a property descriptor for the Object feature. <!-- begin-user-doc --> <!--
138: * end-user-doc -->
139: *
140: * @generated
141: */
142: protected void addObjectPropertyDescriptor(Object object) {
143: itemPropertyDescriptors
144: .add(createItemPropertyDescriptor(
145: ((ComposeableAdapterFactory) adapterFactory)
146: .getRootAdapterFactory(),
147: getResourceLocator(),
148: getString("_UI_BlackboardEntry_object_feature"), //$NON-NLS-1$
149: getString(
150: "_UI_PropertyDescriptor_description", "_UI_BlackboardEntry_object_feature", "_UI_BlackboardEntry_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
151: ProjectPackage.eINSTANCE
152: .getBlackboardEntry_Object(), true,
153: ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
154: null, null));
155: }
156:
157: /**
158: * This returns BlackboardEntry.gif. <!-- begin-user-doc --> <!-- end-user-doc -->
159: *
160: * @generated
161: */
162: public Object getImage(Object object) {
163: return getResourceLocator().getImage(
164: "full/obj16/BlackboardEntry"); //$NON-NLS-1$
165: }
166:
167: /**
168: * This returns the label text for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc
169: * -->
170: *
171: * @generated NOT
172: */
173: public String getText(Object object) {
174: String label = ((BlackboardEntry) object).getKey();
175: return label == null || label.length() == 0 ? "Blackboard Entry"
176: : label;
177: }
178:
179: /**
180: * This handles model notifications by calling {@link #updateChildren} to update any cached
181: * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
182: * <!-- begin-user-doc --> <!-- end-user-doc -->
183: *
184: * @generated
185: */
186: public void notifyChanged(Notification notification) {
187: updateChildren(notification);
188:
189: switch (notification.getFeatureID(BlackboardEntry.class)) {
190: case ProjectPackage.BLACKBOARD_ENTRY__KEY:
191: case ProjectPackage.BLACKBOARD_ENTRY__MEMENTO:
192: case ProjectPackage.BLACKBOARD_ENTRY__OBJECT_CLASS:
193: case ProjectPackage.BLACKBOARD_ENTRY__OBJECT:
194: fireNotifyChanged(new ViewerNotification(notification,
195: notification.getNotifier(), false, true));
196: return;
197: }
198: super .notifyChanged(notification);
199: }
200:
201: /**
202: * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!--
203: * end-user-doc -->
204: *
205: * @generated
206: */
207: public ResourceLocator getResourceLocator() {
208: return ProjectEditPlugin.INSTANCE;
209: }
210:
211: }
|