1 7 package Olj.provider; 8 9 10 import Olj.OljPackage; 11 import Olj.TargetColumnType; 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 TargetColumnTypeItemProvider 38 extends ItemProviderAdapter 39 implements 40 IEditingDomainItemProvider, 41 IStructuredItemContentProvider, 42 ITreeItemContentProvider, 43 IItemLabelProvider, 44 IItemPropertySource { 45 51 public TargetColumnTypeItemProvider(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 addTableIDPropertyDescriptor(object); 67 addTableNamePropertyDescriptor(object); 68 addValueModePropertyDescriptor(object); 69 } 70 return itemPropertyDescriptors; 71 } 72 73 79 protected void addNamePropertyDescriptor(Object object) { 80 itemPropertyDescriptors.add 81 (new ItemPropertyDescriptor 82 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 83 getResourceLocator(), 84 getString("_UI_TargetColumnType_name_feature"), 85 getString("_UI_PropertyDescriptor_description", "_UI_TargetColumnType_name_feature", "_UI_TargetColumnType_type"), 86 OljPackage.eINSTANCE.getTargetColumnType_Name(), 87 true, 88 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 89 } 90 91 97 protected void addTableIDPropertyDescriptor(Object object) { 98 itemPropertyDescriptors.add 99 (new ItemPropertyDescriptor 100 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 101 getResourceLocator(), 102 getString("_UI_TargetColumnType_tableID_feature"), 103 getString("_UI_PropertyDescriptor_description", "_UI_TargetColumnType_tableID_feature", "_UI_TargetColumnType_type"), 104 OljPackage.eINSTANCE.getTargetColumnType_TableID(), 105 true, 106 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 107 } 108 109 115 protected void addTableNamePropertyDescriptor(Object object) { 116 itemPropertyDescriptors.add 117 (new ItemPropertyDescriptor 118 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 119 getResourceLocator(), 120 getString("_UI_TargetColumnType_tableName_feature"), 121 getString("_UI_PropertyDescriptor_description", "_UI_TargetColumnType_tableName_feature", "_UI_TargetColumnType_type"), 122 OljPackage.eINSTANCE.getTargetColumnType_TableName(), 123 true, 124 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 125 } 126 127 133 protected void addValueModePropertyDescriptor(Object object) { 134 itemPropertyDescriptors.add 135 (new ItemPropertyDescriptor 136 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 137 getResourceLocator(), 138 getString("_UI_TargetColumnType_valueMode_feature"), 139 getString("_UI_PropertyDescriptor_description", "_UI_TargetColumnType_valueMode_feature", "_UI_TargetColumnType_type"), 140 OljPackage.eINSTANCE.getTargetColumnType_ValueMode(), 141 true, 142 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 143 } 144 145 151 public Object getImage(Object object) { 152 return getResourceLocator().getImage("full/obj16/TargetColumnType"); 153 } 154 155 161 public String getText(Object object) { 162 String label = ((TargetColumnType)object).getName(); 163 return label == null || label.length() == 0 ? 164 getString("_UI_TargetColumnType_type") : 165 getString("_UI_TargetColumnType_type") + " " + label; 166 } 167 168 175 public void notifyChanged(Notification notification) { 176 updateChildren(notification); 177 178 switch (notification.getFeatureID(TargetColumnType.class)) { 179 case OljPackage.TARGET_COLUMN_TYPE__NAME: 180 case OljPackage.TARGET_COLUMN_TYPE__TABLE_ID: 181 case OljPackage.TARGET_COLUMN_TYPE__TABLE_NAME: 182 case OljPackage.TARGET_COLUMN_TYPE__VALUE_MODE: 183 fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); 184 return; 185 } 186 super.notifyChanged(notification); 187 } 188 189 196 protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { 197 super.collectNewChildDescriptors(newChildDescriptors, object); 198 } 199 200 206 public ResourceLocator getResourceLocator() { 207 return OljEditPlugin.INSTANCE; 208 } 209 210 } 211 | Popular Tags |