KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > emf > edit > provider > resource > ResourceSetItemProvider


1 /**
2  * <copyright>
3  *
4  * Copyright (c) 2002-2004 IBM Corporation and others.
5  * All rights reserved. This program and the accompanying materials
6  * are made available under the terms of the Eclipse Public License v1.0
7  * which accompanies this distribution, and is available at
8  * http://www.eclipse.org/legal/epl-v10.html
9  *
10  * Contributors:
11  * IBM - Initial API and implementation
12  *
13  * </copyright>
14  *
15  * $Id: ResourceSetItemProvider.java,v 1.4 2005/06/12 13:32:37 emerks Exp $
16  */

17 package org.eclipse.emf.edit.provider.resource;
18
19
20 import java.util.Collection JavaDoc;
21 import java.util.Collections JavaDoc;
22 import java.util.List JavaDoc;
23
24 import org.eclipse.emf.common.notify.AdapterFactory;
25 import org.eclipse.emf.common.notify.Notification;
26 import org.eclipse.emf.common.util.ResourceLocator;
27 import org.eclipse.emf.ecore.resource.ResourceSet;
28 import org.eclipse.emf.edit.EMFEditPlugin;
29 import org.eclipse.emf.edit.domain.EditingDomain;
30 import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
31 import org.eclipse.emf.edit.provider.IItemLabelProvider;
32 import org.eclipse.emf.edit.provider.IItemPropertySource;
33 import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
34 import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
35 import org.eclipse.emf.edit.provider.ItemProviderAdapter;
36
37
38 /**
39  * This is the item provider adpater for a {@link org.eclipse.emf.ecore.resource.ResourceSet} object.
40  * @generated
41  */

42 public class ResourceSetItemProvider
43   extends ItemProviderAdapter
44   implements
45     IEditingDomainItemProvider,
46     IStructuredItemContentProvider,
47     ITreeItemContentProvider,
48     IItemLabelProvider,
49     IItemPropertySource
50 {
51   /**
52    * This constructs an instance from a factory and a notifier.
53    * @generated
54    */

55   public ResourceSetItemProvider(AdapterFactory adapterFactory)
56   {
57     super(adapterFactory);
58   }
59
60   /**
61    * This returns the property descriptors for the adapted class.
62    * @generated
63    */

64   public List JavaDoc getPropertyDescriptors(Object JavaDoc object)
65   {
66     if (itemPropertyDescriptors == null)
67     {
68       super.getPropertyDescriptors(object);
69     }
70     return itemPropertyDescriptors;
71   }
72
73   public Collection JavaDoc getChildren(Object JavaDoc object)
74   {
75     ResourceSet resourceSet = (ResourceSet)object;
76     return resourceSet.getResources();
77   }
78
79   /**
80    * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
81    * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
82    * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
83    * <!-- begin-user-doc -->
84    * <!-- end-user-doc -->
85    * @generated
86    */

87   public Collection JavaDoc getChildrenFeatures(Object JavaDoc object)
88   {
89     if (childrenFeatures == null)
90     {
91       super.getChildrenFeatures(object);
92 /*
93       ResourceSet resourceSet = (ResourceSet)object;
94       childrenFeatures.add(ResourcePackage.eINSTANCE.getResourceSet_Resources());
95 */

96     }
97     return childrenFeatures;
98   }
99
100   /**
101    * This returns the parent of the ResourceSet.
102    * @generated
103    */

104   public Object JavaDoc getParent(Object JavaDoc object)
105   {
106     return null;
107   }
108
109   /**
110    * This returns ResourceSet.gif.
111    * @generated
112    */

113   public Object JavaDoc getImage(Object JavaDoc object)
114   {
115     return getResourceLocator().getImage("full/obj16/ResourceSet");
116   }
117
118   /**
119    * This returns the label text for the adapted class.
120    * @generated
121    */

122   public String JavaDoc getText(Object JavaDoc object)
123   {
124     return EMFEditPlugin.INSTANCE.getString("_UI_ResourceSet_label");
125   }
126
127   /**
128    * This handles notification by calling {@link #fireNotifyChanged fireNotifyChanged}.
129    * @generated
130    */

131   public void notifyChanged(Notification notification)
132   {
133     switch (notification.getFeatureID(ResourceSet.class))
134     {
135       case ResourceSet.RESOURCE_SET__RESOURCES:
136       {
137         fireNotifyChanged(notification);
138         return;
139       }
140     }
141     super.notifyChanged(notification);
142   }
143
144   public Collection JavaDoc getNewChildDescriptors(Object JavaDoc object, EditingDomain editingDomain, Object JavaDoc sibling)
145   {
146     return Collections.EMPTY_LIST;
147   }
148
149   /**
150    * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
151    * describing all of the children that can be created under this object.
152    * @generated
153    */

154   protected void collectNewChildDescriptors(Collection JavaDoc newChildDescriptors, Object JavaDoc object)
155   {
156     super.collectNewChildDescriptors(newChildDescriptors, object);
157 /*
158     ResourceSet resourceSet = (ResourceSet)object;
159
160     newChildDescriptors.add
161       (createChildParameter
162         (ResourcePackage.eINSTANCE.getResourceSet_Resources(),
163          ResourcePackage.eINSTANCE.getResourceFactory().createResource()));
164 */

165   }
166
167   /**
168    * Return the resource locator for this item provider's resources.
169    * @generated
170    */

171   public ResourceLocator getResourceLocator()
172   {
173     return EMFEditPlugin.INSTANCE;
174   }
175 }
176
Popular Tags