KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > emf > ecore > provider > EFactoryItemProvider


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: EFactoryItemProvider.java,v 1.7 2005/06/08 06:15:46 nickb Exp $
16  */

17 package org.eclipse.emf.ecore.provider;
18
19
20 import java.util.Collection JavaDoc;
21 import java.util.List JavaDoc;
22
23 import org.eclipse.emf.common.notify.AdapterFactory;
24 import org.eclipse.emf.common.notify.Notification;
25 import org.eclipse.emf.common.util.ResourceLocator;
26 import org.eclipse.emf.ecore.EFactory;
27 import org.eclipse.emf.ecore.EcorePackage;
28 import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
29 import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
30 import org.eclipse.emf.edit.provider.IItemLabelProvider;
31 import org.eclipse.emf.edit.provider.IItemPropertySource;
32 import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
33 import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
34 import org.eclipse.emf.edit.provider.ViewerNotification;
35
36
37 /**
38  * This is the item provider adapter for a {@link org.eclipse.emf.ecore.EFactory} object.
39  * <!-- begin-user-doc -->
40  * <!-- end-user-doc -->
41  * @generated
42  */

43 public class EFactoryItemProvider
44   extends EModelElementItemProvider
45   implements
46     IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource
47 {
48   /**
49    * This constructs an instance from a factory and a notifier.
50    * <!-- begin-user-doc -->
51    * <!-- end-user-doc -->
52    * @generated
53    */

54   public EFactoryItemProvider(AdapterFactory adapterFactory)
55   {
56     super(adapterFactory);
57   }
58
59   /**
60    * This returns the property descriptors for the adapted class.
61    * <!-- begin-user-doc -->
62    * <!-- end-user-doc -->
63    * @generated
64    */

65   public List JavaDoc getPropertyDescriptors(Object JavaDoc object)
66   {
67     if (itemPropertyDescriptors == null)
68     {
69       super.getPropertyDescriptors(object);
70
71       addEPackagePropertyDescriptor(object);
72     }
73     return itemPropertyDescriptors;
74   }
75
76   /**
77    * This adds a property descriptor for the EPackage feature.
78    * <!-- begin-user-doc -->
79    * <!-- end-user-doc -->
80    * @generated
81    */

82   protected void addEPackagePropertyDescriptor(Object JavaDoc object)
83   {
84     itemPropertyDescriptors.add
85       (createItemPropertyDescriptor
86         (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
87          getResourceLocator(),
88          getString("_UI_EFactory_ePackage_feature"),
89          getString("_UI_PropertyDescriptor_description", "_UI_EFactory_ePackage_feature", "_UI_EFactory_type"),
90          EcorePackage.eINSTANCE.getEFactory_EPackage(),
91          true,
92          null,
93          null,
94          null));
95   }
96
97   /**
98    * This returns EFactory.gif.
99    * <!-- begin-user-doc -->
100    * <!-- end-user-doc -->
101    * @generated
102    */

103   public Object JavaDoc getImage(Object JavaDoc object)
104   {
105     return getResourceLocator().getImage("full/obj16/EFactory");
106   }
107
108   /**
109    * This returns the label text for the adapted class.
110    * <!-- begin-user-doc -->
111    * <!-- end-user-doc -->
112    * @generated NOT
113    */

114   public String JavaDoc getText(Object JavaDoc object)
115   {
116     EFactory eFactory = (EFactory)object;
117     StringBuffer JavaDoc result = new StringBuffer JavaDoc();
118     if (eFactory.getEPackage() != null)
119     {
120       result.append(eFactory.getEPackage().getName());
121     }
122     return result.toString();
123   }
124
125   /**
126    * This handles model notifications by calling {@link #updateChildren} to update any cached
127    * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
128    * <!-- begin-user-doc -->
129    * <!-- end-user-doc -->
130    * @generated
131    */

132   public void notifyChanged(Notification notification)
133   {
134     updateChildren(notification);
135
136     switch (notification.getFeatureID(EFactory.class))
137     {
138       case EcorePackage.EFACTORY__EPACKAGE:
139         fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
140         return;
141     }
142     super.notifyChanged(notification);
143   }
144
145   /**
146    * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
147    * describing all of the children that can be created under this object.
148    * <!-- begin-user-doc -->
149    * <!-- end-user-doc -->
150    * @generated
151    */

152   protected void collectNewChildDescriptors(Collection JavaDoc newChildDescriptors, Object JavaDoc object)
153   {
154     super.collectNewChildDescriptors(newChildDescriptors, object);
155   }
156
157   /**
158    * Return the resource locator for this item provider's resources.
159    * <!-- begin-user-doc -->
160    * <!-- end-user-doc -->
161    * @generated
162    */

163   public ResourceLocator getResourceLocator()
164   {
165     return EcoreEditPlugin.INSTANCE;
166   }
167
168 }
169
Popular Tags