1 17 package org.eclipse.emf.mapping.provider; 18 19 20 import java.util.List ; 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 32 import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; 33 import org.eclipse.emf.mapping.FunctionNamePair; 34 import org.eclipse.emf.mapping.MappingPackage; 35 import org.eclipse.emf.mapping.MappingPlugin; 36 37 38 41 public class FunctionNamePairItemProvider 42 extends TypeConverterItemProvider 43 implements 44 IEditingDomainItemProvider, 45 IStructuredItemContentProvider, 46 ITreeItemContentProvider, 47 IItemLabelProvider, 48 IItemPropertySource 49 { 50 53 public FunctionNamePairItemProvider(AdapterFactory adapterFactory) 54 { 55 super(adapterFactory); 56 } 57 58 61 public List getPropertyDescriptors(Object object) 62 { 63 if (itemPropertyDescriptors == null) 64 { 65 super.getPropertyDescriptors(object); 66 67 MappingPackage ePackage = MappingPackage.eINSTANCE; 69 70 itemPropertyDescriptors.add 73 (new ItemPropertyDescriptor 74 (adapterFactory, 75 MappingPlugin.getPlugin().getString("_UI_In2out_property_label"), 76 MappingPlugin.getPlugin().getString("_UI_In2out_property_description"), 77 ePackage.getFunctionNamePair_In2out())); 78 79 itemPropertyDescriptors.add 82 (new ItemPropertyDescriptor 83 (adapterFactory, 84 MappingPlugin.getPlugin().getString("_UI_Out2in_property_label"), 85 MappingPlugin.getPlugin().getString("_UI_Out2in_property_description"), 86 ePackage.getFunctionNamePair_Out2in())); 87 88 } 89 return itemPropertyDescriptors; 90 } 91 92 protected static final String DIVIDER = " " + MappingPlugin.getPlugin().getString("_UI_Mapping_label_divider") + " "; 93 94 public String getText(Object object) 95 { 96 String out2in = ((FunctionNamePair)object).getOut2in(); 97 String in2out = ((FunctionNamePair)object).getIn2out(); 98 return (out2in == null ? "" : out2in) + DIVIDER + in2out; 99 } 100 101 104 public void notifyChanged(Notification msg) 105 { 106 MappingPackage ePackage = MappingPackage.eINSTANCE; 108 if (msg.getFeature() == ePackage.getFunctionNamePair_In2out() || msg.getFeature() == ePackage.getFunctionNamePair_Out2in()) 109 { 110 fireNotifyChanged(msg); 111 return; 113 } 114 super.notifyChanged(msg); 115 } 116 117 123 public ResourceLocator getResourceLocator() 124 { 125 return MappingPlugin.INSTANCE; 126 } 127 128 } 129 | Popular Tags |