1 7 package Olj.provider; 8 9 10 import Olj.OljPackage; 11 import Olj.VariableType; 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 VariableTypeItemProvider 38 extends ItemProviderAdapter 39 implements 40 IEditingDomainItemProvider, 41 IStructuredItemContentProvider, 42 ITreeItemContentProvider, 43 IItemLabelProvider, 44 IItemPropertySource { 45 51 public VariableTypeItemProvider(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 addOverridePropertyDescriptor(object); 68 addPrefixPropertyDescriptor(object); 69 addReplaceInConstantsPropertyDescriptor(object); 70 addReplaceInDataPropertyDescriptor(object); 71 addReplaceInJDBCPropertyDescriptor(object); 72 addReplaceInSQLPropertyDescriptor(object); 73 addSuffixPropertyDescriptor(object); 74 addValuePropertyDescriptor(object); 75 } 76 return itemPropertyDescriptors; 77 } 78 79 85 protected void addDefaultValuePropertyDescriptor(Object object) { 86 itemPropertyDescriptors.add 87 (new ItemPropertyDescriptor 88 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 89 getResourceLocator(), 90 getString("_UI_VariableType_defaultValue_feature"), 91 getString("_UI_PropertyDescriptor_description", "_UI_VariableType_defaultValue_feature", "_UI_VariableType_type"), 92 OljPackage.eINSTANCE.getVariableType_DefaultValue(), 93 true, 94 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 95 } 96 97 103 protected void addNamePropertyDescriptor(Object object) { 104 itemPropertyDescriptors.add 105 (new ItemPropertyDescriptor 106 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 107 getResourceLocator(), 108 getString("_UI_VariableType_name_feature"), 109 getString("_UI_PropertyDescriptor_description", "_UI_VariableType_name_feature", "_UI_VariableType_type"), 110 OljPackage.eINSTANCE.getVariableType_Name(), 111 true, 112 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 113 } 114 115 121 protected void addOverridePropertyDescriptor(Object object) { 122 itemPropertyDescriptors.add 123 (new ItemPropertyDescriptor 124 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 125 getResourceLocator(), 126 getString("_UI_VariableType_override_feature"), 127 getString("_UI_PropertyDescriptor_description", "_UI_VariableType_override_feature", "_UI_VariableType_type"), 128 OljPackage.eINSTANCE.getVariableType_Override(), 129 true, 130 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 131 } 132 133 139 protected void addPrefixPropertyDescriptor(Object object) { 140 itemPropertyDescriptors.add 141 (new ItemPropertyDescriptor 142 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 143 getResourceLocator(), 144 getString("_UI_VariableType_prefix_feature"), 145 getString("_UI_PropertyDescriptor_description", "_UI_VariableType_prefix_feature", "_UI_VariableType_type"), 146 OljPackage.eINSTANCE.getVariableType_Prefix(), 147 true, 148 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 149 } 150 151 157 protected void addReplaceInConstantsPropertyDescriptor(Object object) { 158 itemPropertyDescriptors.add 159 (new ItemPropertyDescriptor 160 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 161 getResourceLocator(), 162 getString("_UI_VariableType_replaceInConstants_feature"), 163 getString("_UI_PropertyDescriptor_description", "_UI_VariableType_replaceInConstants_feature", "_UI_VariableType_type"), 164 OljPackage.eINSTANCE.getVariableType_ReplaceInConstants(), 165 true, 166 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 167 } 168 169 175 protected void addReplaceInDataPropertyDescriptor(Object object) { 176 itemPropertyDescriptors.add 177 (new ItemPropertyDescriptor 178 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 179 getResourceLocator(), 180 getString("_UI_VariableType_replaceInData_feature"), 181 getString("_UI_PropertyDescriptor_description", "_UI_VariableType_replaceInData_feature", "_UI_VariableType_type"), 182 OljPackage.eINSTANCE.getVariableType_ReplaceInData(), 183 true, 184 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 185 } 186 187 193 protected void addReplaceInJDBCPropertyDescriptor(Object object) { 194 itemPropertyDescriptors.add 195 (new ItemPropertyDescriptor 196 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 197 getResourceLocator(), 198 getString("_UI_VariableType_replaceInJDBC_feature"), 199 getString("_UI_PropertyDescriptor_description", "_UI_VariableType_replaceInJDBC_feature", "_UI_VariableType_type"), 200 OljPackage.eINSTANCE.getVariableType_ReplaceInJDBC(), 201 true, 202 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 203 } 204 205 211 protected void addReplaceInSQLPropertyDescriptor(Object object) { 212 itemPropertyDescriptors.add 213 (new ItemPropertyDescriptor 214 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 215 getResourceLocator(), 216 getString("_UI_VariableType_replaceInSQL_feature"), 217 getString("_UI_PropertyDescriptor_description", "_UI_VariableType_replaceInSQL_feature", "_UI_VariableType_type"), 218 OljPackage.eINSTANCE.getVariableType_ReplaceInSQL(), 219 true, 220 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 221 } 222 223 229 protected void addSuffixPropertyDescriptor(Object object) { 230 itemPropertyDescriptors.add 231 (new ItemPropertyDescriptor 232 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 233 getResourceLocator(), 234 getString("_UI_VariableType_suffix_feature"), 235 getString("_UI_PropertyDescriptor_description", "_UI_VariableType_suffix_feature", "_UI_VariableType_type"), 236 OljPackage.eINSTANCE.getVariableType_Suffix(), 237 true, 238 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 239 } 240 241 247 protected void addValuePropertyDescriptor(Object object) { 248 itemPropertyDescriptors.add 249 (new ItemPropertyDescriptor 250 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 251 getResourceLocator(), 252 getString("_UI_VariableType_value_feature"), 253 getString("_UI_PropertyDescriptor_description", "_UI_VariableType_value_feature", "_UI_VariableType_type"), 254 OljPackage.eINSTANCE.getVariableType_Value(), 255 true, 256 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 257 } 258 259 265 public Object getImage(Object object) { 266 return getResourceLocator().getImage("full/obj16/VariableType"); 267 } 268 269 275 public String getText(Object object) { 276 String label = ((VariableType)object).getName(); 277 return label == null || label.length() == 0 ? 278 getString("_UI_VariableType_type") : 279 getString("_UI_VariableType_type") + " " + label; 280 } 281 282 289 public void notifyChanged(Notification notification) { 290 updateChildren(notification); 291 292 switch (notification.getFeatureID(VariableType.class)) { 293 case OljPackage.VARIABLE_TYPE__DEFAULT_VALUE: 294 case OljPackage.VARIABLE_TYPE__NAME: 295 case OljPackage.VARIABLE_TYPE__OVERRIDE: 296 case OljPackage.VARIABLE_TYPE__PREFIX: 297 case OljPackage.VARIABLE_TYPE__REPLACE_IN_CONSTANTS: 298 case OljPackage.VARIABLE_TYPE__REPLACE_IN_DATA: 299 case OljPackage.VARIABLE_TYPE__REPLACE_IN_JDBC: 300 case OljPackage.VARIABLE_TYPE__REPLACE_IN_SQL: 301 case OljPackage.VARIABLE_TYPE__SUFFIX: 302 case OljPackage.VARIABLE_TYPE__VALUE: 303 fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); 304 return; 305 } 306 super.notifyChanged(notification); 307 } 308 309 316 protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { 317 super.collectNewChildDescriptors(newChildDescriptors, object); 318 } 319 320 326 public ResourceLocator getResourceLocator() { 327 return OljEditPlugin.INSTANCE; 328 } 329 330 } 331 | Popular Tags |