KickJava   Java API By Example, From Geeks To Geeks.

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


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: EModelElementItemProvider.java,v 1.5 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.EModelElement;
27 import org.eclipse.emf.ecore.EcoreFactory;
28 import org.eclipse.emf.ecore.EcorePackage;
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
35 import org.eclipse.emf.edit.provider.ViewerNotification;
36
37 /**
38  * This is the item provider adapter for a {@link org.eclipse.emf.ecore.EModelElement} object.
39  * <!-- begin-user-doc -->
40  * <!-- end-user-doc -->
41  * @generated
42  */

43 public class EModelElementItemProvider
44   extends EObjectItemProvider
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 EModelElementItemProvider(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     }
72     return itemPropertyDescriptors;
73   }
74
75   /**
76    * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
77    * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
78    * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
79    * <!-- begin-user-doc -->
80    * <!-- end-user-doc -->
81    * @generated
82    */

83   public Collection JavaDoc getChildrenFeatures(Object JavaDoc object)
84   {
85     if (childrenFeatures == null)
86     {
87       super.getChildrenFeatures(object);
88       childrenFeatures.add(EcorePackage.eINSTANCE.getEModelElement_EAnnotations());
89     }
90     return childrenFeatures;
91   }
92
93   /**
94    * This returns the label text for the adapted class.
95    * <!-- begin-user-doc -->
96    * <!-- end-user-doc -->
97    * @generated
98    */

99   public String JavaDoc getText(Object JavaDoc object)
100   {
101     return getString("_UI_EModelElement_type");
102   }
103
104   /**
105    * This handles model notifications by calling {@link #updateChildren} to update any cached
106    * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
107    * <!-- begin-user-doc -->
108    * <!-- end-user-doc -->
109    * @generated
110    */

111   public void notifyChanged(Notification notification)
112   {
113     updateChildren(notification);
114
115     switch (notification.getFeatureID(EModelElement.class))
116     {
117       case EcorePackage.EMODEL_ELEMENT__EANNOTATIONS:
118         fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
119         return;
120     }
121     super.notifyChanged(notification);
122   }
123
124   /**
125    * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
126    * describing all of the children that can be created under this object.
127    * <!-- begin-user-doc -->
128    * <!-- end-user-doc -->
129    * @generated
130    */

131   protected void collectNewChildDescriptors(Collection JavaDoc newChildDescriptors, Object JavaDoc object)
132   {
133     super.collectNewChildDescriptors(newChildDescriptors, object);
134
135     newChildDescriptors.add
136       (createChildParameter
137         (EcorePackage.eINSTANCE.getEModelElement_EAnnotations(),
138          EcoreFactory.eINSTANCE.createEAnnotation()));
139   }
140
141   /**
142    * Return the resource locator for this item provider's resources.
143    * <!-- begin-user-doc -->
144    * <!-- end-user-doc -->
145    * @generated
146    */

147   public ResourceLocator getResourceLocator()
148   {
149     return EcoreEditPlugin.INSTANCE;
150   }
151
152 }
153
Popular Tags