1 7 package Olj.provider; 8 9 10 import Olj.OljFactory; 11 import Olj.OljPackage; 12 import Olj.SubCounterColumnType; 13 14 import java.util.Collection ; 15 import java.util.List ; 16 17 import org.eclipse.emf.common.notify.AdapterFactory; 18 import org.eclipse.emf.common.notify.Notification; 19 20 import org.eclipse.emf.common.util.ResourceLocator; 21 22 import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; 23 import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; 24 import org.eclipse.emf.edit.provider.IItemLabelProvider; 25 import org.eclipse.emf.edit.provider.IItemPropertySource; 26 import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; 27 import org.eclipse.emf.edit.provider.ITreeItemContentProvider; 28 import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; 29 import org.eclipse.emf.edit.provider.ItemProviderAdapter; 30 import org.eclipse.emf.edit.provider.ViewerNotification; 31 32 38 public class SubCounterColumnTypeItemProvider 39 extends ItemProviderAdapter 40 implements 41 IEditingDomainItemProvider, 42 IStructuredItemContentProvider, 43 ITreeItemContentProvider, 44 IItemLabelProvider, 45 IItemPropertySource { 46 52 public SubCounterColumnTypeItemProvider(AdapterFactory adapterFactory) { 53 super(adapterFactory); 54 } 55 56 62 public List getPropertyDescriptors(Object object) { 63 if (itemPropertyDescriptors == null) { 64 super.getPropertyDescriptors(object); 65 66 addCounterIncrementPropertyDescriptor(object); 67 addCounterNamePropertyDescriptor(object); 68 addCounterStartValuePropertyDescriptor(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_SubCounterColumnType_counterIncrement_feature"), 89 getString("_UI_PropertyDescriptor_description", "_UI_SubCounterColumnType_counterIncrement_feature", "_UI_SubCounterColumnType_type"), 90 OljPackage.eINSTANCE.getSubCounterColumnType_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_SubCounterColumnType_counterName_feature"), 107 getString("_UI_PropertyDescriptor_description", "_UI_SubCounterColumnType_counterName_feature", "_UI_SubCounterColumnType_type"), 108 OljPackage.eINSTANCE.getSubCounterColumnType_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_SubCounterColumnType_counterStartValue_feature"), 125 getString("_UI_PropertyDescriptor_description", "_UI_SubCounterColumnType_counterStartValue_feature", "_UI_SubCounterColumnType_type"), 126 OljPackage.eINSTANCE.getSubCounterColumnType_CounterStartValue(), 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_SubCounterColumnType_targetColumnName_feature"), 143 getString("_UI_PropertyDescriptor_description", "_UI_SubCounterColumnType_targetColumnName_feature", "_UI_SubCounterColumnType_type"), 144 OljPackage.eINSTANCE.getSubCounterColumnType_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_SubCounterColumnType_targetTableID_feature"), 161 getString("_UI_PropertyDescriptor_description", "_UI_SubCounterColumnType_targetTableID_feature", "_UI_SubCounterColumnType_type"), 162 OljPackage.eINSTANCE.getSubCounterColumnType_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_SubCounterColumnType_targetTableName_feature"), 179 getString("_UI_PropertyDescriptor_description", "_UI_SubCounterColumnType_targetTableName_feature", "_UI_SubCounterColumnType_type"), 180 OljPackage.eINSTANCE.getSubCounterColumnType_TargetTableName(), 181 true, 182 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 183 } 184 185 191 protected void addValueModePropertyDescriptor(Object object) { 192 itemPropertyDescriptors.add 193 (new ItemPropertyDescriptor 194 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 195 getResourceLocator(), 196 getString("_UI_SubCounterColumnType_valueMode_feature"), 197 getString("_UI_PropertyDescriptor_description", "_UI_SubCounterColumnType_valueMode_feature", "_UI_SubCounterColumnType_type"), 198 OljPackage.eINSTANCE.getSubCounterColumnType_ValueMode(), 199 true, 200 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 201 } 202 203 211 public Collection getChildrenFeatures(Object object) { 212 if (childrenFeatures == null) { 213 super.getChildrenFeatures(object); 214 childrenFeatures.add(OljPackage.eINSTANCE.getSubCounterColumnType_SubCounterKeyColumn()); 215 } 216 return childrenFeatures; 217 } 218 219 225 public Object getImage(Object object) { 226 return getResourceLocator().getImage("full/obj16/SubCounterColumnType"); 227 } 228 229 235 public String getText(Object object) { 236 String label = ((SubCounterColumnType)object).getCounterName(); 237 return label == null || label.length() == 0 ? 238 getString("_UI_SubCounterColumnType_type") : 239 getString("_UI_SubCounterColumnType_type") + " " + label; 240 } 241 242 249 public void notifyChanged(Notification notification) { 250 updateChildren(notification); 251 252 switch (notification.getFeatureID(SubCounterColumnType.class)) { 253 case OljPackage.SUB_COUNTER_COLUMN_TYPE__COUNTER_INCREMENT: 254 case OljPackage.SUB_COUNTER_COLUMN_TYPE__COUNTER_NAME: 255 case OljPackage.SUB_COUNTER_COLUMN_TYPE__COUNTER_START_VALUE: 256 case OljPackage.SUB_COUNTER_COLUMN_TYPE__TARGET_COLUMN_NAME: 257 case OljPackage.SUB_COUNTER_COLUMN_TYPE__TARGET_TABLE_ID: 258 case OljPackage.SUB_COUNTER_COLUMN_TYPE__TARGET_TABLE_NAME: 259 case OljPackage.SUB_COUNTER_COLUMN_TYPE__VALUE_MODE: 260 fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); 261 return; 262 case OljPackage.SUB_COUNTER_COLUMN_TYPE__SUB_COUNTER_KEY_COLUMN: 263 fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); 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 newChildDescriptors.add 280 (createChildParameter 281 (OljPackage.eINSTANCE.getSubCounterColumnType_SubCounterKeyColumn(), 282 OljFactory.eINSTANCE.createSubCounterKeyColumnType())); 283 } 284 285 291 public ResourceLocator getResourceLocator() { 292 return OljEditPlugin.INSTANCE; 293 } 294 295 } 296 | Popular Tags |