1 7 package Olj.provider; 8 9 10 import Olj.OljPackage; 11 import Olj.VariableColumnType; 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 VariableColumnTypeItemProvider 38 extends ItemProviderAdapter 39 implements 40 IEditingDomainItemProvider, 41 IStructuredItemContentProvider, 42 ITreeItemContentProvider, 43 IItemLabelProvider, 44 IItemPropertySource { 45 51 public VariableColumnTypeItemProvider(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 addNamePropertyDescriptor(object); 67 addTargetColumnNamePropertyDescriptor(object); 68 addTargetTableIDPropertyDescriptor(object); 69 addTargetTableNamePropertyDescriptor(object); 70 addValueModePropertyDescriptor(object); 71 } 72 return itemPropertyDescriptors; 73 } 74 75 81 protected void addDefaultValuePropertyDescriptor(Object object) { 82 itemPropertyDescriptors.add 83 (new ItemPropertyDescriptor 84 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 85 getResourceLocator(), 86 getString("_UI_VariableColumnType_defaultValue_feature"), 87 getString("_UI_PropertyDescriptor_description", "_UI_VariableColumnType_defaultValue_feature", "_UI_VariableColumnType_type"), 88 OljPackage.eINSTANCE.getVariableColumnType_DefaultValue(), 89 true, 90 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 91 } 92 93 99 protected void addNamePropertyDescriptor(Object object) { 100 itemPropertyDescriptors.add 101 (new ItemPropertyDescriptor 102 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 103 getResourceLocator(), 104 getString("_UI_VariableColumnType_name_feature"), 105 getString("_UI_PropertyDescriptor_description", "_UI_VariableColumnType_name_feature", "_UI_VariableColumnType_type"), 106 OljPackage.eINSTANCE.getVariableColumnType_Name(), 107 true, 108 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 109 } 110 111 117 protected void addTargetColumnNamePropertyDescriptor(Object object) { 118 itemPropertyDescriptors.add 119 (new ItemPropertyDescriptor 120 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 121 getResourceLocator(), 122 getString("_UI_VariableColumnType_targetColumnName_feature"), 123 getString("_UI_PropertyDescriptor_description", "_UI_VariableColumnType_targetColumnName_feature", "_UI_VariableColumnType_type"), 124 OljPackage.eINSTANCE.getVariableColumnType_TargetColumnName(), 125 true, 126 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 127 } 128 129 135 protected void addTargetTableIDPropertyDescriptor(Object object) { 136 itemPropertyDescriptors.add 137 (new ItemPropertyDescriptor 138 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 139 getResourceLocator(), 140 getString("_UI_VariableColumnType_targetTableID_feature"), 141 getString("_UI_PropertyDescriptor_description", "_UI_VariableColumnType_targetTableID_feature", "_UI_VariableColumnType_type"), 142 OljPackage.eINSTANCE.getVariableColumnType_TargetTableID(), 143 true, 144 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 145 } 146 147 153 protected void addTargetTableNamePropertyDescriptor(Object object) { 154 itemPropertyDescriptors.add 155 (new ItemPropertyDescriptor 156 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 157 getResourceLocator(), 158 getString("_UI_VariableColumnType_targetTableName_feature"), 159 getString("_UI_PropertyDescriptor_description", "_UI_VariableColumnType_targetTableName_feature", "_UI_VariableColumnType_type"), 160 OljPackage.eINSTANCE.getVariableColumnType_TargetTableName(), 161 true, 162 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 163 } 164 165 171 protected void addValueModePropertyDescriptor(Object object) { 172 itemPropertyDescriptors.add 173 (new ItemPropertyDescriptor 174 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 175 getResourceLocator(), 176 getString("_UI_VariableColumnType_valueMode_feature"), 177 getString("_UI_PropertyDescriptor_description", "_UI_VariableColumnType_valueMode_feature", "_UI_VariableColumnType_type"), 178 OljPackage.eINSTANCE.getVariableColumnType_ValueMode(), 179 true, 180 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 181 } 182 183 189 public Object getImage(Object object) { 190 return getResourceLocator().getImage("full/obj16/VariableColumnType"); 191 } 192 193 199 public String getText(Object object) { 200 String label = ((VariableColumnType)object).getName(); 201 return label == null || label.length() == 0 ? 202 getString("_UI_VariableColumnType_type") : 203 getString("_UI_VariableColumnType_type") + " " + label; 204 } 205 206 213 public void notifyChanged(Notification notification) { 214 updateChildren(notification); 215 216 switch (notification.getFeatureID(VariableColumnType.class)) { 217 case OljPackage.VARIABLE_COLUMN_TYPE__DEFAULT_VALUE: 218 case OljPackage.VARIABLE_COLUMN_TYPE__NAME: 219 case OljPackage.VARIABLE_COLUMN_TYPE__TARGET_COLUMN_NAME: 220 case OljPackage.VARIABLE_COLUMN_TYPE__TARGET_TABLE_ID: 221 case OljPackage.VARIABLE_COLUMN_TYPE__TARGET_TABLE_NAME: 222 case OljPackage.VARIABLE_COLUMN_TYPE__VALUE_MODE: 223 fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); 224 return; 225 } 226 super.notifyChanged(notification); 227 } 228 229 236 protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { 237 super.collectNewChildDescriptors(newChildDescriptors, object); 238 } 239 240 246 public ResourceLocator getResourceLocator() { 247 return OljEditPlugin.INSTANCE; 248 } 249 250 } 251 | Popular Tags |