001: /**
002: * <copyright>
003: * </copyright>
004: *
005: * $Id: ProjectRegistryItemProvider.java 24145 2007-02-01 18:03:34Z jeichar $
006: */package net.refractions.udig.project.internal.provider;
007:
008: import java.util.Collection;
009: import java.util.List;
010:
011: import net.refractions.udig.project.internal.ProjectPackage;
012: import net.refractions.udig.project.internal.ProjectRegistry;
013:
014: import org.eclipse.emf.common.notify.AdapterFactory;
015: import org.eclipse.emf.common.notify.Notification;
016: import org.eclipse.emf.common.util.ResourceLocator;
017: import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
018: import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
019: import org.eclipse.emf.edit.provider.IItemLabelProvider;
020: import org.eclipse.emf.edit.provider.IItemPropertySource;
021: import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
022: import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
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.ProjectRegistry} object. <!-- begin-user-doc -->
029: * <!-- end-user-doc -->
030: *
031: * @generated
032: */
033: public class ProjectRegistryItemProvider 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 ProjectRegistryItemProvider(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 NOT
059: */
060: public List getPropertyDescriptors(Object object) {
061: if (itemPropertyDescriptors == null) {
062: super .getPropertyDescriptors(object);
063:
064: // addProjectsPropertyDescriptor(object);
065: addCurrentProjectPropertyDescriptor(object);
066: }
067: return itemPropertyDescriptors;
068: }
069:
070: public Collection getChildrenFeatures(Object object) {
071: if (childrenFeatures == null) {
072: super .getChildrenFeatures(object);
073: childrenFeatures.add(ProjectPackage.eINSTANCE
074: .getProjectRegistry_Projects());
075: }
076: return childrenFeatures;
077: }
078:
079: /**
080: * @see org.eclipse.emf.edit.provider.ITreeItemContentProvider#hasChildren(java.lang.Object)
081: */
082: public boolean hasChildren(Object object) {
083: return true;
084: }
085:
086: /**
087: * This adds a property descriptor for the Projects feature. <!-- begin-user-doc --> <!--
088: * end-user-doc -->
089: *
090: * @generated
091: */
092: protected void addProjectsPropertyDescriptor(Object object) {
093: itemPropertyDescriptors
094: .add(createItemPropertyDescriptor(
095: ((ComposeableAdapterFactory) adapterFactory)
096: .getRootAdapterFactory(),
097: getResourceLocator(),
098: getString("_UI_ProjectRegistry_projects_feature"), //$NON-NLS-1$
099: getString(
100: "_UI_PropertyDescriptor_description", "_UI_ProjectRegistry_projects_feature", "_UI_ProjectRegistry_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
101: ProjectPackage.eINSTANCE
102: .getProjectRegistry_Projects(), true,
103: null, null, null));
104: }
105:
106: /**
107: * This adds a property descriptor for the Current Project feature. <!-- begin-user-doc --> <!--
108: * end-user-doc -->
109: *
110: * @generated
111: */
112: protected void addCurrentProjectPropertyDescriptor(Object object) {
113: itemPropertyDescriptors
114: .add(createItemPropertyDescriptor(
115: ((ComposeableAdapterFactory) adapterFactory)
116: .getRootAdapterFactory(),
117: getResourceLocator(),
118: getString("_UI_ProjectRegistry_currentProject_feature"), //$NON-NLS-1$
119: getString(
120: "_UI_PropertyDescriptor_description", "_UI_ProjectRegistry_currentProject_feature", "_UI_ProjectRegistry_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
121: ProjectPackage.eINSTANCE
122: .getProjectRegistry_CurrentProject(),
123: true, null, null, null));
124: }
125:
126: /**
127: * This returns ProjectRegistry.gif. <!-- begin-user-doc --> <!-- end-user-doc -->
128: *
129: * @generated
130: */
131: public Object getImage(Object object) {
132: return getResourceLocator().getImage(
133: "full/obj16/ProjectRegistry"); //$NON-NLS-1$
134: }
135:
136: /**
137: * This returns the label text for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc
138: * -->
139: *
140: * @generated NOT
141: */
142: public String getText(Object object) {
143: return "ProjectRegistry";
144: }
145:
146: /**
147: * This handles model notifications by calling {@link #updateChildren} to update any cached
148: * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
149: * <!-- begin-user-doc --> <!-- end-user-doc -->
150: *
151: * @generated NOT
152: */
153: public void notifyChanged(Notification notification) {
154: updateChildren(notification);
155:
156: switch (notification.getFeatureID(ProjectRegistry.class)) {
157: case ProjectPackage.PROJECT_REGISTRY__PROJECTS:
158: fireNotifyChanged(new ViewerNotification(notification,
159: notification.getNotifier(), true, true));
160: return;
161: }
162: super .notifyChanged(notification);
163: }
164:
165: /**
166: * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!--
167: * end-user-doc -->
168: *
169: * @generated
170: */
171: public ResourceLocator getResourceLocator() {
172: return ProjectEditPlugin.INSTANCE;
173: }
174:
175: }
|