KickJava   Java API By Example, From Geeks To Geeks.

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


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: ComplexTypeConverterItemProvider.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
26 import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
27 import org.eclipse.emf.edit.provider.IItemLabelProvider;
28 import org.eclipse.emf.edit.provider.IItemPropertySource;
29 import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
30 import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
31 //import org.eclipse.emf.edit.provider.ViewerNotification;
32

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

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

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

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

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

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

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

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