1 7 package Olj.provider; 8 9 10 import Olj.OljPackage; 11 import Olj.ValueColumnType; 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 ValueColumnTypeItemProvider 38 extends ItemProviderAdapter 39 implements 40 IEditingDomainItemProvider, 41 IStructuredItemContentProvider, 42 ITreeItemContentProvider, 43 IItemLabelProvider, 44 IItemPropertySource { 45 51 public ValueColumnTypeItemProvider(AdapterFactory adapterFactory) { 52 super(adapterFactory); 53 } 54 55 61 public List getPropertyDescriptors(Object object) { 62 if (itemPropertyDescriptors == null) { 63 super.getPropertyDescriptors(object); 64 65 addDefaultValuePropertyDescriptor(object); 66 addFromHexPropertyDescriptor(object); 67 addSourceColumnNamePropertyDescriptor(object); 68 addTargetColumnNamePropertyDescriptor(object); 69 addTargetTableIDPropertyDescriptor(object); 70 addTargetTableNamePropertyDescriptor(object); 71 addToHexPropertyDescriptor(object); 72 addValueModePropertyDescriptor(object); 73 } 74 return itemPropertyDescriptors; 75 } 76 77 83 protected void addDefaultValuePropertyDescriptor(Object object) { 84 itemPropertyDescriptors.add 85 (new ItemPropertyDescriptor 86 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 87 getResourceLocator(), 88 getString("_UI_ValueColumnType_defaultValue_feature"), 89 getString("_UI_PropertyDescriptor_description", "_UI_ValueColumnType_defaultValue_feature", "_UI_ValueColumnType_type"), 90 OljPackage.eINSTANCE.getValueColumnType_DefaultValue(), 91 true, 92 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 93 } 94 95 101 protected void addFromHexPropertyDescriptor(Object object) { 102 itemPropertyDescriptors.add 103 (new ItemPropertyDescriptor 104 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 105 getResourceLocator(), 106 getString("_UI_ValueColumnType_fromHex_feature"), 107 getString("_UI_PropertyDescriptor_description", "_UI_ValueColumnType_fromHex_feature", "_UI_ValueColumnType_type"), 108 OljPackage.eINSTANCE.getValueColumnType_FromHex(), 109 true, 110 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 111 } 112 113 119 protected void addSourceColumnNamePropertyDescriptor(Object object) { 120 itemPropertyDescriptors.add 121 (new ItemPropertyDescriptor 122 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 123 getResourceLocator(), 124 getString("_UI_ValueColumnType_sourceColumnName_feature"), 125 getString("_UI_PropertyDescriptor_description", "_UI_ValueColumnType_sourceColumnName_feature", "_UI_ValueColumnType_type"), 126 OljPackage.eINSTANCE.getValueColumnType_SourceColumnName(), 127 true, 128 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 129 } 130 131 137 protected void addTargetColumnNamePropertyDescriptor(Object object) { 138 itemPropertyDescriptors.add 139 (new ItemPropertyDescriptor 140 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 141 getResourceLocator(), 142 getString("_UI_ValueColumnType_targetColumnName_feature"), 143 getString("_UI_PropertyDescriptor_description", "_UI_ValueColumnType_targetColumnName_feature", "_UI_ValueColumnType_type"), 144 OljPackage.eINSTANCE.getValueColumnType_TargetColumnName(), 145 true, 146 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 147 } 148 149 155 protected void addTargetTableIDPropertyDescriptor(Object object) { 156 itemPropertyDescriptors.add 157 (new ItemPropertyDescriptor 158 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 159 getResourceLocator(), 160 getString("_UI_ValueColumnType_targetTableID_feature"), 161 getString("_UI_PropertyDescriptor_description", "_UI_ValueColumnType_targetTableID_feature", "_UI_ValueColumnType_type"), 162 OljPackage.eINSTANCE.getValueColumnType_TargetTableID(), 163 true, 164 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 165 } 166 167 173 protected void addTargetTableNamePropertyDescriptor(Object object) { 174 itemPropertyDescriptors.add 175 (new ItemPropertyDescriptor 176 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 177 getResourceLocator(), 178 getString("_UI_ValueColumnType_targetTableName_feature"), 179 getString("_UI_PropertyDescriptor_description", "_UI_ValueColumnType_targetTableName_feature", "_UI_ValueColumnType_type"), 180 OljPackage.eINSTANCE.getValueColumnType_TargetTableName(), 181 true, 182 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 183 } 184 185 191 protected void addToHexPropertyDescriptor(Object object) { 192 itemPropertyDescriptors.add 193 (new ItemPropertyDescriptor 194 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 195 getResourceLocator(), 196 getString("_UI_ValueColumnType_toHex_feature"), 197 getString("_UI_PropertyDescriptor_description", "_UI_ValueColumnType_toHex_feature", "_UI_ValueColumnType_type"), 198 OljPackage.eINSTANCE.getValueColumnType_ToHex(), 199 true, 200 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 201 } 202 203 209 protected void addValueModePropertyDescriptor(Object object) { 210 itemPropertyDescriptors.add 211 (new ItemPropertyDescriptor 212 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 213 getResourceLocator(), 214 getString("_UI_ValueColumnType_valueMode_feature"), 215 getString("_UI_PropertyDescriptor_description", "_UI_ValueColumnType_valueMode_feature", "_UI_ValueColumnType_type"), 216 OljPackage.eINSTANCE.getValueColumnType_ValueMode(), 217 true, 218 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 219 } 220 221 227 public Object getImage(Object object) { 228 return getResourceLocator().getImage("full/obj16/ValueColumnType"); 229 } 230 231 237 public String getText(Object object) { 238 String label = ((ValueColumnType)object).getSourceColumnName(); 239 return label == null || label.length() == 0 ? 240 getString("_UI_ValueColumnType_type") : 241 getString("_UI_ValueColumnType_type") + " " + label; 242 } 243 244 251 public void notifyChanged(Notification notification) { 252 updateChildren(notification); 253 254 switch (notification.getFeatureID(ValueColumnType.class)) { 255 case OljPackage.VALUE_COLUMN_TYPE__DEFAULT_VALUE: 256 case OljPackage.VALUE_COLUMN_TYPE__FROM_HEX: 257 case OljPackage.VALUE_COLUMN_TYPE__SOURCE_COLUMN_NAME: 258 case OljPackage.VALUE_COLUMN_TYPE__TARGET_COLUMN_NAME: 259 case OljPackage.VALUE_COLUMN_TYPE__TARGET_TABLE_ID: 260 case OljPackage.VALUE_COLUMN_TYPE__TARGET_TABLE_NAME: 261 case OljPackage.VALUE_COLUMN_TYPE__TO_HEX: 262 case OljPackage.VALUE_COLUMN_TYPE__VALUE_MODE: 263 fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); 264 return; 265 } 266 super.notifyChanged(notification); 267 } 268 269 276 protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { 277 super.collectNewChildDescriptors(newChildDescriptors, object); 278 } 279 280 286 public ResourceLocator getResourceLocator() { 287 return OljEditPlugin.INSTANCE; 288 } 289 290 } 291 | Popular Tags |