1 7 package Olj.provider; 8 9 10 import Olj.OljPackage; 11 import Olj.TableType; 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 TableTypeItemProvider 38 extends ItemProviderAdapter 39 implements 40 IEditingDomainItemProvider, 41 IStructuredItemContentProvider, 42 ITreeItemContentProvider, 43 IItemLabelProvider, 44 IItemPropertySource { 45 51 public TableTypeItemProvider(AdapterFactory adapterFactory) { 52 super(adapterFactory); 53 } 54 55 61 public List getPropertyDescriptors(Object object) { 62 if (itemPropertyDescriptors == null) { 63 super.getPropertyDescriptors(object); 64 65 addAutoMapColumnsPropertyDescriptor(object); 66 addDefaultModePropertyDescriptor(object); 67 addInsertPropertyDescriptor(object); 68 addOidLogicPropertyDescriptor(object); 69 addTableIDPropertyDescriptor(object); 70 addTableModePropertyDescriptor(object); 71 addTableNamePropertyDescriptor(object); 72 } 73 return itemPropertyDescriptors; 74 } 75 76 82 protected void addAutoMapColumnsPropertyDescriptor(Object object) { 83 itemPropertyDescriptors.add 84 (new ItemPropertyDescriptor 85 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 86 getResourceLocator(), 87 getString("_UI_TableType_autoMapColumns_feature"), 88 getString("_UI_PropertyDescriptor_description", "_UI_TableType_autoMapColumns_feature", "_UI_TableType_type"), 89 OljPackage.eINSTANCE.getTableType_AutoMapColumns(), 90 true, 91 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 92 } 93 94 100 protected void addDefaultModePropertyDescriptor(Object object) { 101 itemPropertyDescriptors.add 102 (new ItemPropertyDescriptor 103 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 104 getResourceLocator(), 105 getString("_UI_TableType_defaultMode_feature"), 106 getString("_UI_PropertyDescriptor_description", "_UI_TableType_defaultMode_feature", "_UI_TableType_type"), 107 OljPackage.eINSTANCE.getTableType_DefaultMode(), 108 true, 109 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 110 } 111 112 118 protected void addInsertPropertyDescriptor(Object object) { 119 itemPropertyDescriptors.add 120 (new ItemPropertyDescriptor 121 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 122 getResourceLocator(), 123 getString("_UI_TableType_insert_feature"), 124 getString("_UI_PropertyDescriptor_description", "_UI_TableType_insert_feature", "_UI_TableType_type"), 125 OljPackage.eINSTANCE.getTableType_Insert(), 126 true, 127 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 128 } 129 130 136 protected void addOidLogicPropertyDescriptor(Object object) { 137 itemPropertyDescriptors.add 138 (new ItemPropertyDescriptor 139 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 140 getResourceLocator(), 141 getString("_UI_TableType_oidLogic_feature"), 142 getString("_UI_PropertyDescriptor_description", "_UI_TableType_oidLogic_feature", "_UI_TableType_type"), 143 OljPackage.eINSTANCE.getTableType_OidLogic(), 144 true, 145 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 146 } 147 148 154 protected void addTableIDPropertyDescriptor(Object object) { 155 itemPropertyDescriptors.add 156 (new ItemPropertyDescriptor 157 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 158 getResourceLocator(), 159 getString("_UI_TableType_tableID_feature"), 160 getString("_UI_PropertyDescriptor_description", "_UI_TableType_tableID_feature", "_UI_TableType_type"), 161 OljPackage.eINSTANCE.getTableType_TableID(), 162 true, 163 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 164 } 165 166 172 protected void addTableModePropertyDescriptor(Object object) { 173 itemPropertyDescriptors.add 174 (new ItemPropertyDescriptor 175 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 176 getResourceLocator(), 177 getString("_UI_TableType_tableMode_feature"), 178 getString("_UI_PropertyDescriptor_description", "_UI_TableType_tableMode_feature", "_UI_TableType_type"), 179 OljPackage.eINSTANCE.getTableType_TableMode(), 180 true, 181 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 182 } 183 184 190 protected void addTableNamePropertyDescriptor(Object object) { 191 itemPropertyDescriptors.add 192 (new ItemPropertyDescriptor 193 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 194 getResourceLocator(), 195 getString("_UI_TableType_tableName_feature"), 196 getString("_UI_PropertyDescriptor_description", "_UI_TableType_tableName_feature", "_UI_TableType_type"), 197 OljPackage.eINSTANCE.getTableType_TableName(), 198 true, 199 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 200 } 201 202 208 public Object getImage(Object object) { 209 return getResourceLocator().getImage("full/obj16/TableType"); 210 } 211 212 218 public String getText(Object object) { 219 String label = ((TableType)object).getTableName(); 220 return label == null || label.length() == 0 ? 221 getString("_UI_TableType_type") : 222 getString("_UI_TableType_type") + " " + label; 223 } 224 225 232 public void notifyChanged(Notification notification) { 233 updateChildren(notification); 234 235 switch (notification.getFeatureID(TableType.class)) { 236 case OljPackage.TABLE_TYPE__AUTO_MAP_COLUMNS: 237 case OljPackage.TABLE_TYPE__DEFAULT_MODE: 238 case OljPackage.TABLE_TYPE__INSERT: 239 case OljPackage.TABLE_TYPE__OID_LOGIC: 240 case OljPackage.TABLE_TYPE__TABLE_ID: 241 case OljPackage.TABLE_TYPE__TABLE_MODE: 242 case OljPackage.TABLE_TYPE__TABLE_NAME: 243 fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); 244 return; 245 } 246 super.notifyChanged(notification); 247 } 248 249 256 protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { 257 super.collectNewChildDescriptors(newChildDescriptors, object); 258 } 259 260 266 public ResourceLocator getResourceLocator() { 267 return OljEditPlugin.INSTANCE; 268 } 269 270 } 271 | Popular Tags |