1 7 package Olj.provider; 8 9 10 import Olj.JdbcSourceParameterType; 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 JdbcSourceParameterTypeItemProvider 38 extends ItemProviderAdapter 39 implements 40 IEditingDomainItemProvider, 41 IStructuredItemContentProvider, 42 ITreeItemContentProvider, 43 IItemLabelProvider, 44 IItemPropertySource { 45 51 public JdbcSourceParameterTypeItemProvider(AdapterFactory adapterFactory) { 52 super(adapterFactory); 53 } 54 55 61 public List getPropertyDescriptors(Object object) { 62 if (itemPropertyDescriptors == null) { 63 super.getPropertyDescriptors(object); 64 65 addNamePropertyDescriptor(object); 66 addValuePropertyDescriptor(object); 67 } 68 return itemPropertyDescriptors; 69 } 70 71 77 protected void addNamePropertyDescriptor(Object object) { 78 itemPropertyDescriptors.add 79 (new ItemPropertyDescriptor 80 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 81 getResourceLocator(), 82 getString("_UI_JdbcSourceParameterType_name_feature"), 83 getString("_UI_PropertyDescriptor_description", "_UI_JdbcSourceParameterType_name_feature", "_UI_JdbcSourceParameterType_type"), 84 OljPackage.eINSTANCE.getJdbcSourceParameterType_Name(), 85 true, 86 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 87 } 88 89 95 protected void addValuePropertyDescriptor(Object object) { 96 itemPropertyDescriptors.add 97 (new ItemPropertyDescriptor 98 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 99 getResourceLocator(), 100 getString("_UI_JdbcSourceParameterType_value_feature"), 101 getString("_UI_PropertyDescriptor_description", "_UI_JdbcSourceParameterType_value_feature", "_UI_JdbcSourceParameterType_type"), 102 OljPackage.eINSTANCE.getJdbcSourceParameterType_Value(), 103 true, 104 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 105 } 106 107 113 public Object getImage(Object object) { 114 return getResourceLocator().getImage("full/obj16/JdbcSourceParameterType"); 115 } 116 117 123 public String getText(Object object) { 124 String label = ((JdbcSourceParameterType)object).getName(); 125 return label == null || label.length() == 0 ? 126 getString("_UI_JdbcSourceParameterType_type") : 127 getString("_UI_JdbcSourceParameterType_type") + " " + label; 128 } 129 130 137 public void notifyChanged(Notification notification) { 138 updateChildren(notification); 139 140 switch (notification.getFeatureID(JdbcSourceParameterType.class)) { 141 case OljPackage.JDBC_SOURCE_PARAMETER_TYPE__NAME: 142 case OljPackage.JDBC_SOURCE_PARAMETER_TYPE__VALUE: 143 fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); 144 return; 145 } 146 super.notifyChanged(notification); 147 } 148 149 156 protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { 157 super.collectNewChildDescriptors(newChildDescriptors, object); 158 } 159 160 166 public ResourceLocator getResourceLocator() { 167 return OljEditPlugin.INSTANCE; 168 } 169 170 } 171 | Popular Tags |