KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > emf > mapping > provider > FunctionPairItemProvider


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: FunctionPairItemProvider.java,v 1.4 2005/06/08 06:21:43 nickb Exp $
16  */

17 package org.eclipse.emf.mapping.provider;
18
19
20 import java.util.List JavaDoc;
21
22 import org.eclipse.emf.common.notify.AdapterFactory;
23 import org.eclipse.emf.common.notify.Notification;
24 import org.eclipse.emf.common.util.ResourceLocator;
25 import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
26 import org.eclipse.emf.edit.provider.IItemLabelProvider;
27 import org.eclipse.emf.edit.provider.IItemPropertySource;
28 import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
29 import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
30 //import org.eclipse.emf.edit.provider.ViewerNotification;
31

32 import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
33 import org.eclipse.emf.mapping.MappingPackage;
34 import org.eclipse.emf.mapping.MappingPlugin;
35
36 // import org.eclipse.emf.mapping.FunctionPair;
37

38
39 /**
40  * This is the item provider adpater for a {@link org.eclipse.emf.mapping.FunctionPair} object.
41  */

42 public class FunctionPairItemProvider
43   extends TypeConverterItemProvider
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    */

54   public FunctionPairItemProvider(AdapterFactory adapterFactory)
55   {
56     super(adapterFactory);
57   }
58
59   /**
60    * This returns the property descriptors for the adapted class.
61    */

62   public List JavaDoc getPropertyDescriptors(Object JavaDoc object)
63   {
64     if (itemPropertyDescriptors == null)
65     {
66       super.getPropertyDescriptors(object);
67
68       //MappingPackage ePackage = ((FunctionPair)object).ePackageMapping();
69
MappingPackage ePackage = MappingPackage.eINSTANCE;
70
71       // This is for the in2out feature.
72
//
73
itemPropertyDescriptors.add
74         (new ItemPropertyDescriptor
75           (adapterFactory,
76            MappingPlugin.getPlugin().getString("_UI_In2out_property_label"),
77            MappingPlugin.getPlugin().getString("_UI_In2out_property_description"),
78            ePackage.getFunctionPair_In2out()));
79
80       // This is for the out2in feature.
81
//
82
itemPropertyDescriptors.add
83         (new ItemPropertyDescriptor
84           (adapterFactory,
85            MappingPlugin.getPlugin().getString("_UI_Out2in_property_label"),
86            MappingPlugin.getPlugin().getString("_UI_Out2in_property_description"),
87            ePackage.getFunctionPair_Out2in()));
88
89     }
90     return itemPropertyDescriptors;
91   }
92
93   /**
94    * This returns FunctionPair.gif.
95    */

96   public Object JavaDoc getImage(Object JavaDoc object)
97   {
98     return MappingPlugin.getPlugin().getImage("full/obj16/FunctionPair");
99   }
100
101   public String JavaDoc getText(Object JavaDoc object)
102   {
103     return "FunctionPair";
104   }
105
106   /**
107    * This handles notification by delegating to {@link #fireNotifyChanged fireNotifyChanged}.
108    */

109   public void notifyChanged(Notification msg)
110   {
111     //MappingPackage ePackage = ((FunctionPair)msg.getNotifier()).ePackageMapping();
112
MappingPackage ePackage = MappingPackage.eINSTANCE;
113     if (msg.getFeature() == ePackage.getFunctionPair_In2out() || msg.getFeature() == ePackage.getFunctionPair_Out2in())
114     {
115       fireNotifyChanged(msg);
116       //HGD::fireNotifyChanged(msg.getNotifier(), msg.getEventType(), msg.getStructuralFeature(), msg.getOldValue(), msg.getNewValue(), msg.getPosition());
117
return;
118     }
119     super.notifyChanged(msg);
120   }
121   
122   /**
123    * Return the resource locator for this item provider's resources.
124    * <!-- begin-user-doc -->
125    * <!-- end-user-doc -->
126    * @generated
127    */

128   public ResourceLocator getResourceLocator()
129   {
130     return MappingPlugin.INSTANCE;
131   }
132
133 }
134
Popular Tags