001: /**
002: * <copyright>
003: * </copyright>
004: *
005: * $Id: EditManagerItemProvider.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.EditManager;
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: import org.geotools.feature.Feature;
026:
027: /**
028: * This is the item provider adapter for a {@link net.refractions.udig.project.internal.EditManager}
029: * object. <!-- begin-user-doc --> <!-- end-user-doc -->
030: *
031: * @generated
032: */
033: public class EditManagerItemProvider 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 EditManagerItemProvider(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: addEditFeaturePropertyDescriptor(object);
065: addEditLayerInternalPropertyDescriptor(object);
066: addTransactionTypePropertyDescriptor(object);
067: addEditLayerLockedPropertyDescriptor(object);
068: }
069: return itemPropertyDescriptors;
070: }
071:
072: /**
073: * This adds a property descriptor for the Edit Feature feature. <!-- begin-user-doc --> <!--
074: * end-user-doc -->
075: *
076: * @generated
077: */
078: protected void addEditFeaturePropertyDescriptor(Object object) {
079: itemPropertyDescriptors
080: .add(createItemPropertyDescriptor(
081: ((ComposeableAdapterFactory) adapterFactory)
082: .getRootAdapterFactory(),
083: getResourceLocator(),
084: getString("_UI_EditManager_editFeature_feature"), //$NON-NLS-1$
085: getString(
086: "_UI_PropertyDescriptor_description", "_UI_EditManager_editFeature_feature", "_UI_EditManager_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
087: ProjectPackage.eINSTANCE
088: .getEditManager_EditFeature(), false,
089: ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
090: null, null));
091: }
092:
093: /**
094: * This adds a property descriptor for the Edit Layer Internal feature. <!-- begin-user-doc -->
095: * <!-- end-user-doc -->
096: *
097: * @generated
098: */
099: protected void addEditLayerInternalPropertyDescriptor(Object object) {
100: itemPropertyDescriptors
101: .add(createItemPropertyDescriptor(
102: ((ComposeableAdapterFactory) adapterFactory)
103: .getRootAdapterFactory(),
104: getResourceLocator(),
105: getString("_UI_EditManager_editLayerInternal_feature"), //$NON-NLS-1$
106: getString(
107: "_UI_PropertyDescriptor_description", "_UI_EditManager_editLayerInternal_feature", "_UI_EditManager_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
108: ProjectPackage.eINSTANCE
109: .getEditManager_EditLayerInternal(),
110: false, null, null, null));
111: }
112:
113: /**
114: * This adds a property descriptor for the Transaction Type feature. <!-- begin-user-doc -->
115: * <!-- end-user-doc -->
116: *
117: * @generated
118: */
119: protected void addTransactionTypePropertyDescriptor(Object object) {
120: itemPropertyDescriptors
121: .add(createItemPropertyDescriptor(
122: ((ComposeableAdapterFactory) adapterFactory)
123: .getRootAdapterFactory(),
124: getResourceLocator(),
125: getString("_UI_EditManager_transactionType_feature"), //$NON-NLS-1$
126: getString(
127: "_UI_PropertyDescriptor_description", "_UI_EditManager_transactionType_feature", "_UI_EditManager_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
128: ProjectPackage.eINSTANCE
129: .getEditManager_TransactionType(),
130: true,
131: ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
132: null, null));
133: }
134:
135: /**
136: * This adds a property descriptor for the Edit Layer Locked feature. <!-- begin-user-doc -->
137: * <!-- end-user-doc -->
138: *
139: * @generated
140: */
141: protected void addEditLayerLockedPropertyDescriptor(Object object) {
142: itemPropertyDescriptors
143: .add(createItemPropertyDescriptor(
144: ((ComposeableAdapterFactory) adapterFactory)
145: .getRootAdapterFactory(),
146: getResourceLocator(),
147: getString("_UI_EditManager_editLayerLocked_feature"), //$NON-NLS-1$
148: getString(
149: "_UI_PropertyDescriptor_description", "_UI_EditManager_editLayerLocked_feature", "_UI_EditManager_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
150: ProjectPackage.eINSTANCE
151: .getEditManager_EditLayerLocked(),
152: true,
153: ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
154: null, null));
155: }
156:
157: /**
158: * This returns EditManager.gif. <!-- begin-user-doc --> <!-- end-user-doc -->
159: *
160: * @generated
161: */
162: public Object getImage(Object object) {
163: return getResourceLocator().getImage("full/obj16/EditManager"); //$NON-NLS-1$
164: }
165:
166: /**
167: * This returns the label text for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc
168: * -->
169: *
170: * @generated NOT
171: */
172: public String getText(Object object) {
173: Feature labelValue = ((EditManager) object).getEditFeature();
174: String label = labelValue == null ? null : labelValue
175: .toString();
176: return label == null || label.length() == 0 ? "Edit Manager"
177: : label;
178: }
179:
180: /**
181: * This handles model notifications by calling {@link #updateChildren} to update any cached
182: * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
183: * <!-- begin-user-doc --> <!-- end-user-doc -->
184: *
185: * @generated
186: */
187: public void notifyChanged(Notification notification) {
188: updateChildren(notification);
189:
190: switch (notification.getFeatureID(EditManager.class)) {
191: case ProjectPackage.EDIT_MANAGER__EDIT_FEATURE:
192: case ProjectPackage.EDIT_MANAGER__TRANSACTION_TYPE:
193: case ProjectPackage.EDIT_MANAGER__EDIT_LAYER_LOCKED:
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: }
|