1 7 package Olj.provider; 8 9 10 import Olj.CounterColumnType; 11 import Olj.OljPackage; 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 CounterColumnTypeItemProvider 38 extends ItemProviderAdapter 39 implements 40 IEditingDomainItemProvider, 41 IStructuredItemContentProvider, 42 ITreeItemContentProvider, 43 IItemLabelProvider, 44 IItemPropertySource { 45 51 public CounterColumnTypeItemProvider(AdapterFactory adapterFactory) { 52 super(adapterFactory); 53 } 54 55 61 public List getPropertyDescriptors(Object object) { 62 if (itemPropertyDescriptors == null) { 63 super.getPropertyDescriptors(object); 64 65 addCounterIncrementPropertyDescriptor(object); 66 addCounterNamePropertyDescriptor(object); 67 addCounterStartValuePropertyDescriptor(object); 68 addCounterStartValueResetPropertyDescriptor(object); 69 addTargetColumnNamePropertyDescriptor(object); 70 addTargetTableIDPropertyDescriptor(object); 71 addTargetTableNamePropertyDescriptor(object); 72 addValueModePropertyDescriptor(object); 73 } 74 return itemPropertyDescriptors; 75 } 76 77 83 protected void addCounterIncrementPropertyDescriptor(Object object) { 84 itemPropertyDescriptors.add 85 (new ItemPropertyDescriptor 86 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 87 getResourceLocator(), 88 getString("_UI_CounterColumnType_counterIncrement_feature"), 89 getString("_UI_PropertyDescriptor_description", "_UI_CounterColumnType_counterIncrement_feature", "_UI_CounterColumnType_type"), 90 OljPackage.eINSTANCE.getCounterColumnType_CounterIncrement(), 91 true, 92 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 93 } 94 95 101 protected void addCounterNamePropertyDescriptor(Object object) { 102 itemPropertyDescriptors.add 103 (new ItemPropertyDescriptor 104 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 105 getResourceLocator(), 106 getString("_UI_CounterColumnType_counterName_feature"), 107 getString("_UI_PropertyDescriptor_description", "_UI_CounterColumnType_counterName_feature", "_UI_CounterColumnType_type"), 108 OljPackage.eINSTANCE.getCounterColumnType_CounterName(), 109 true, 110 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 111 } 112 113 119 protected void addCounterStartValuePropertyDescriptor(Object object) { 120 itemPropertyDescriptors.add 121 (new ItemPropertyDescriptor 122 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 123 getResourceLocator(), 124 getString("_UI_CounterColumnType_counterStartValue_feature"), 125 getString("_UI_PropertyDescriptor_description", "_UI_CounterColumnType_counterStartValue_feature", "_UI_CounterColumnType_type"), 126 OljPackage.eINSTANCE.getCounterColumnType_CounterStartValue(), 127 true, 128 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 129 } 130 131 137 protected void addCounterStartValueResetPropertyDescriptor(Object object) { 138 itemPropertyDescriptors.add 139 (new ItemPropertyDescriptor 140 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 141 getResourceLocator(), 142 getString("_UI_CounterColumnType_counterStartValueReset_feature"), 143 getString("_UI_PropertyDescriptor_description", "_UI_CounterColumnType_counterStartValueReset_feature", "_UI_CounterColumnType_type"), 144 OljPackage.eINSTANCE.getCounterColumnType_CounterStartValueReset(), 145 true, 146 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 147 } 148 149 155 protected void addTargetColumnNamePropertyDescriptor(Object object) { 156 itemPropertyDescriptors.add 157 (new ItemPropertyDescriptor 158 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 159 getResourceLocator(), 160 getString("_UI_CounterColumnType_targetColumnName_feature"), 161 getString("_UI_PropertyDescriptor_description", "_UI_CounterColumnType_targetColumnName_feature", "_UI_CounterColumnType_type"), 162 OljPackage.eINSTANCE.getCounterColumnType_TargetColumnName(), 163 true, 164 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 165 } 166 167 173 protected void addTargetTableIDPropertyDescriptor(Object object) { 174 itemPropertyDescriptors.add 175 (new ItemPropertyDescriptor 176 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 177 getResourceLocator(), 178 getString("_UI_CounterColumnType_targetTableID_feature"), 179 getString("_UI_PropertyDescriptor_description", "_UI_CounterColumnType_targetTableID_feature", "_UI_CounterColumnType_type"), 180 OljPackage.eINSTANCE.getCounterColumnType_TargetTableID(), 181 true, 182 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 183 } 184 185 191 protected void addTargetTableNamePropertyDescriptor(Object object) { 192 itemPropertyDescriptors.add 193 (new ItemPropertyDescriptor 194 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 195 getResourceLocator(), 196 getString("_UI_CounterColumnType_targetTableName_feature"), 197 getString("_UI_PropertyDescriptor_description", "_UI_CounterColumnType_targetTableName_feature", "_UI_CounterColumnType_type"), 198 OljPackage.eINSTANCE.getCounterColumnType_TargetTableName(), 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_CounterColumnType_valueMode_feature"), 215 getString("_UI_PropertyDescriptor_description", "_UI_CounterColumnType_valueMode_feature", "_UI_CounterColumnType_type"), 216 OljPackage.eINSTANCE.getCounterColumnType_ValueMode(), 217 true, 218 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 219 } 220 221 227 public Object getImage(Object object) { 228 return getResourceLocator().getImage("full/obj16/CounterColumnType"); 229 } 230 231 237 public String getText(Object object) { 238 String label = ((CounterColumnType)object).getCounterName(); 239 return label == null || label.length() == 0 ? 240 getString("_UI_CounterColumnType_type") : 241 getString("_UI_CounterColumnType_type") + " " + label; 242 } 243 244 251 public void notifyChanged(Notification notification) { 252 updateChildren(notification); 253 254 switch (notification.getFeatureID(CounterColumnType.class)) { 255 case OljPackage.COUNTER_COLUMN_TYPE__COUNTER_INCREMENT: 256 case OljPackage.COUNTER_COLUMN_TYPE__COUNTER_NAME: 257 case OljPackage.COUNTER_COLUMN_TYPE__COUNTER_START_VALUE: 258 case OljPackage.COUNTER_COLUMN_TYPE__COUNTER_START_VALUE_RESET: 259 case OljPackage.COUNTER_COLUMN_TYPE__TARGET_COLUMN_NAME: 260 case OljPackage.COUNTER_COLUMN_TYPE__TARGET_TABLE_ID: 261 case OljPackage.COUNTER_COLUMN_TYPE__TARGET_TABLE_NAME: 262 case OljPackage.COUNTER_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 |