1 7 package Olj.provider; 8 9 10 import Olj.OljPackage; 11 import Olj.SourceColumnType; 12 13 import java.util.Collection ; 14 import java.util.List ; 15 16 import org.eclipse.emf.common.notify.AdapterFactory; 17 import org.eclipse.emf.common.notify.Notification; 18 19 import org.eclipse.emf.common.util.ResourceLocator; 20 21 import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; 22 import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; 23 import org.eclipse.emf.edit.provider.IItemLabelProvider; 24 import org.eclipse.emf.edit.provider.IItemPropertySource; 25 import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; 26 import org.eclipse.emf.edit.provider.ITreeItemContentProvider; 27 import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; 28 import org.eclipse.emf.edit.provider.ItemProviderAdapter; 29 import org.eclipse.emf.edit.provider.ViewerNotification; 30 31 37 public class SourceColumnTypeItemProvider 38 extends ItemProviderAdapter 39 implements 40 IEditingDomainItemProvider, 41 IStructuredItemContentProvider, 42 ITreeItemContentProvider, 43 IItemLabelProvider, 44 IItemPropertySource { 45 51 public SourceColumnTypeItemProvider(AdapterFactory adapterFactory) { 52 super(adapterFactory); 53 } 54 55 61 public List getPropertyDescriptors(Object object) { 62 if (itemPropertyDescriptors == null) { 63 super.getPropertyDescriptors(object); 64 65 addNamePropertyDescriptor(object); 66 } 67 return itemPropertyDescriptors; 68 } 69 70 76 protected void addNamePropertyDescriptor(Object object) { 77 itemPropertyDescriptors.add 78 (new ItemPropertyDescriptor 79 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 80 getResourceLocator(), 81 getString("_UI_SourceColumnType_name_feature"), 82 getString("_UI_PropertyDescriptor_description", "_UI_SourceColumnType_name_feature", "_UI_SourceColumnType_type"), 83 OljPackage.eINSTANCE.getSourceColumnType_Name(), 84 true, 85 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 86 } 87 88 94 public Object getImage(Object object) { 95 return getResourceLocator().getImage("full/obj16/SourceColumnType"); 96 } 97 98 104 public String getText(Object object) { 105 String label = ((SourceColumnType)object).getName(); 106 return label == null || label.length() == 0 ? 107 getString("_UI_SourceColumnType_type") : 108 getString("_UI_SourceColumnType_type") + " " + label; 109 } 110 111 118 public void notifyChanged(Notification notification) { 119 updateChildren(notification); 120 121 switch (notification.getFeatureID(SourceColumnType.class)) { 122 case OljPackage.SOURCE_COLUMN_TYPE__NAME: 123 fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); 124 return; 125 } 126 super.notifyChanged(notification); 127 } 128 129 136 protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { 137 super.collectNewChildDescriptors(newChildDescriptors, object); 138 } 139 140 146 public ResourceLocator getResourceLocator() { 147 return OljEditPlugin.INSTANCE; 148 } 149 150 } 151 | Popular Tags |