001: /**
002: * <copyright>
003: * </copyright>
004: *
005: * $Id: PicoBlackboardItemProvider.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.PicoBlackboard;
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.picocontainer.MutablePicoContainer;
026:
027: /**
028: * This is the item provider adapter for a
029: * {@link net.refractions.udig.project.internal.PicoBlackboard} object. <!-- begin-user-doc --> <!--
030: * end-user-doc -->
031: *
032: * @generated
033: */
034: public class PicoBlackboardItemProvider extends ItemProviderAdapter
035: implements IEditingDomainItemProvider,
036: IStructuredItemContentProvider, ITreeItemContentProvider,
037: IItemLabelProvider, IItemPropertySource {
038: /**
039: * <!-- begin-user-doc --> <!-- end-user-doc -->
040: *
041: * @generated
042: */
043: 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$
044:
045: /**
046: * This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!--
047: * end-user-doc -->
048: *
049: * @generated
050: */
051: public PicoBlackboardItemProvider(AdapterFactory adapterFactory) {
052: super (adapterFactory);
053: }
054:
055: /**
056: * This returns the property descriptors for the adapted class. <!-- begin-user-doc --> <!--
057: * end-user-doc -->
058: *
059: * @generated
060: */
061: public List getPropertyDescriptors(Object object) {
062: if (itemPropertyDescriptors == null) {
063: super .getPropertyDescriptors(object);
064:
065: addPicoContainerPropertyDescriptor(object);
066: }
067: return itemPropertyDescriptors;
068: }
069:
070: /**
071: * This adds a property descriptor for the Pico Container feature. <!-- begin-user-doc --> <!--
072: * end-user-doc -->
073: *
074: * @generated
075: */
076: protected void addPicoContainerPropertyDescriptor(Object object) {
077: itemPropertyDescriptors
078: .add(createItemPropertyDescriptor(
079: ((ComposeableAdapterFactory) adapterFactory)
080: .getRootAdapterFactory(),
081: getResourceLocator(),
082: getString("_UI_PicoBlackboard_picoContainer_feature"), //$NON-NLS-1$
083: getString(
084: "_UI_PropertyDescriptor_description", "_UI_PicoBlackboard_picoContainer_feature", "_UI_PicoBlackboard_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
085: ProjectPackage.eINSTANCE
086: .getPicoBlackboard_PicoContainer(),
087: false,
088: ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
089: null, null));
090: }
091:
092: /**
093: * This returns PicoBlackboard.gif. <!-- begin-user-doc --> <!-- end-user-doc -->
094: *
095: * @generated
096: */
097: public Object getImage(Object object) {
098: return getResourceLocator().getImage(
099: "full/obj16/PicoBlackboard"); //$NON-NLS-1$
100: }
101:
102: /**
103: * This returns the label text for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc
104: * -->
105: *
106: * @generated NOT
107: */
108: public String getText(Object object) {
109: MutablePicoContainer labelValue = ((PicoBlackboard) object)
110: .getPicoContainer();
111: String label = labelValue == null ? null : labelValue
112: .toString();
113: return label == null || label.length() == 0 ? "PicoBlackboard"
114: : label;
115: }
116:
117: /**
118: * This handles model notifications by calling {@link #updateChildren} to update any cached
119: * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
120: * <!-- begin-user-doc --> <!-- end-user-doc -->
121: *
122: * @generated
123: */
124: public void notifyChanged(Notification notification) {
125: updateChildren(notification);
126:
127: switch (notification.getFeatureID(PicoBlackboard.class)) {
128: case ProjectPackage.PICO_BLACKBOARD__PICO_CONTAINER:
129: fireNotifyChanged(new ViewerNotification(notification,
130: notification.getNotifier(), false, true));
131: return;
132: }
133: super .notifyChanged(notification);
134: }
135:
136: /**
137: * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!--
138: * end-user-doc -->
139: *
140: * @generated
141: */
142: public ResourceLocator getResourceLocator() {
143: return ProjectEditPlugin.INSTANCE;
144: }
145:
146: }
|