KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > emf > ecore > change > provider > EObjectToChangesMapEntryItemProvider


1 /**
2  * <copyright>
3  *
4  * Copyright (c) 2003-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: EObjectToChangesMapEntryItemProvider.java,v 1.7 2005/06/08 06:17:29 nickb Exp $
16  */

17 package org.eclipse.emf.ecore.change.provider;
18
19
20 import java.util.Collection JavaDoc;
21 import java.util.List JavaDoc;
22 import java.util.Map 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.change.ChangePackage;
28 import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator;
29 import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
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 import org.eclipse.emf.edit.provider.ViewerNotification;
38
39 /**
40  * This is the item provider adapter for a {@link java.util.Map.Entry} object.
41  * <!-- begin-user-doc -->
42  * <!-- end-user-doc -->
43  * @generated
44  */

45 public class EObjectToChangesMapEntryItemProvider
46   extends ItemProviderAdapter
47   implements
48     IEditingDomainItemProvider,
49     IStructuredItemContentProvider,
50     ITreeItemContentProvider,
51     IItemLabelProvider,
52     IItemPropertySource
53 {
54   protected AdapterFactoryItemDelegator itemDelegator;
55
56   /**
57    * This constructs an instance from a factory and a notifier.
58    * <!-- begin-user-doc -->
59    * <!-- end-user-doc -->
60    * @generated NOT
61    */

62   public EObjectToChangesMapEntryItemProvider(AdapterFactory adapterFactory)
63   {
64     super(adapterFactory);
65     itemDelegator = new AdapterFactoryItemDelegator(getRootAdapterFactory());
66   }
67
68   /**
69    * This returns the property descriptors for the adapted class.
70    * <!-- begin-user-doc -->
71    * <!-- end-user-doc -->
72    * @generated
73    */

74   public List JavaDoc getPropertyDescriptors(Object JavaDoc object)
75   {
76     if (itemPropertyDescriptors == null)
77     {
78       super.getPropertyDescriptors(object);
79
80       addKeyPropertyDescriptor(object);
81     }
82     return itemPropertyDescriptors;
83   }
84
85   /**
86    * This adds a property descriptor for the Key feature.
87    * <!-- begin-user-doc -->
88    * <!-- end-user-doc -->
89    * @generated
90    */

91   protected void addKeyPropertyDescriptor(Object JavaDoc object)
92   {
93     itemPropertyDescriptors.add
94       (createItemPropertyDescriptor
95         (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
96          getResourceLocator(),
97          getString("_UI_EObjectToChangesMapEntry_key_feature"),
98          getString("_UI_PropertyDescriptor_description", "_UI_EObjectToChangesMapEntry_key_feature", "_UI_EObjectToChangesMapEntry_type"),
99          ChangePackage.eINSTANCE.getEObjectToChangesMapEntry_Key(),
100          true,
101          null,
102          null,
103          null));
104   }
105
106   /**
107    * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
108    * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
109    * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
110    * <!-- begin-user-doc -->
111    * <!-- end-user-doc -->
112    * @generated
113    */

114   public Collection JavaDoc getChildrenFeatures(Object JavaDoc object)
115   {
116     if (childrenFeatures == null)
117     {
118       super.getChildrenFeatures(object);
119       childrenFeatures.add(ChangePackage.eINSTANCE.getEObjectToChangesMapEntry_Value());
120     }
121     return childrenFeatures;
122   }
123
124   /**
125    * This returns EObjectToChangesMapEntry.gif.
126    * <!-- begin-user-doc -->
127    * <!-- end-user-doc -->
128    * @generated
129    */

130   public Object JavaDoc getImage(Object JavaDoc object)
131   {
132     return getResourceLocator().getImage("full/obj16/EObjectToChangesMapEntry");
133   }
134
135   /**
136    * This returns the label text for the adapted class.
137    * <!-- begin-user-doc -->
138    * <!-- end-user-doc -->
139    * @generated NOT
140    */

141   public String JavaDoc getText(Object JavaDoc object)
142   {
143     Map.Entry JavaDoc eObjectToChangesMapEntry = (Map.Entry JavaDoc)object;
144     return itemDelegator.getText(eObjectToChangesMapEntry.getKey());
145   }
146
147   /**
148    * This handles model notifications by calling {@link #updateChildren} to update any cached
149    * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
150    * <!-- begin-user-doc -->
151    * <!-- end-user-doc -->
152    * @generated
153    */

154   public void notifyChanged(Notification notification)
155   {
156     updateChildren(notification);
157
158     switch (notification.getFeatureID(Map.Entry JavaDoc.class))
159     {
160       case ChangePackage.EOBJECT_TO_CHANGES_MAP_ENTRY__VALUE:
161         fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
162         return;
163     }
164     super.notifyChanged(notification);
165   }
166
167   /**
168    * Return the resource locator for this item provider's resources.
169    * <!-- begin-user-doc -->
170    * <!-- end-user-doc -->
171    * @generated
172    */

173   public ResourceLocator getResourceLocator()
174   {
175     return ChangeEditPlugin.INSTANCE;
176   }
177
178 }
179
Popular Tags