1 7 package Olj.provider; 8 9 10 import Olj.OljPackage; 11 import Olj.RelationColumnType; 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 RelationColumnTypeItemProvider 38 extends ItemProviderAdapter 39 implements 40 IEditingDomainItemProvider, 41 IStructuredItemContentProvider, 42 ITreeItemContentProvider, 43 IItemLabelProvider, 44 IItemPropertySource { 45 51 public RelationColumnTypeItemProvider(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 addRelationModePropertyDescriptor(object); 67 addRelationSourceColumnNamePropertyDescriptor(object); 68 addRelationSourceTableIDPropertyDescriptor(object); 69 addRelationSourceTableNamePropertyDescriptor(object); 70 addRelationTargetColumnNamePropertyDescriptor(object); 71 addRelationTargetTableIDPropertyDescriptor(object); 72 addRelationTargetTableNamePropertyDescriptor(object); 73 } 74 return itemPropertyDescriptors; 75 } 76 77 83 protected void addDefaultValuePropertyDescriptor(Object object) { 84 itemPropertyDescriptors.add 85 (new ItemPropertyDescriptor 86 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 87 getResourceLocator(), 88 getString("_UI_RelationColumnType_defaultValue_feature"), 89 getString("_UI_PropertyDescriptor_description", "_UI_RelationColumnType_defaultValue_feature", "_UI_RelationColumnType_type"), 90 OljPackage.eINSTANCE.getRelationColumnType_DefaultValue(), 91 true, 92 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 93 } 94 95 101 protected void addRelationModePropertyDescriptor(Object object) { 102 itemPropertyDescriptors.add 103 (new ItemPropertyDescriptor 104 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 105 getResourceLocator(), 106 getString("_UI_RelationColumnType_relationMode_feature"), 107 getString("_UI_PropertyDescriptor_description", "_UI_RelationColumnType_relationMode_feature", "_UI_RelationColumnType_type"), 108 OljPackage.eINSTANCE.getRelationColumnType_RelationMode(), 109 true, 110 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 111 } 112 113 119 protected void addRelationSourceColumnNamePropertyDescriptor(Object object) { 120 itemPropertyDescriptors.add 121 (new ItemPropertyDescriptor 122 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 123 getResourceLocator(), 124 getString("_UI_RelationColumnType_relationSourceColumnName_feature"), 125 getString("_UI_PropertyDescriptor_description", "_UI_RelationColumnType_relationSourceColumnName_feature", "_UI_RelationColumnType_type"), 126 OljPackage.eINSTANCE.getRelationColumnType_RelationSourceColumnName(), 127 true, 128 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 129 } 130 131 137 protected void addRelationSourceTableIDPropertyDescriptor(Object object) { 138 itemPropertyDescriptors.add 139 (new ItemPropertyDescriptor 140 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 141 getResourceLocator(), 142 getString("_UI_RelationColumnType_relationSourceTableID_feature"), 143 getString("_UI_PropertyDescriptor_description", "_UI_RelationColumnType_relationSourceTableID_feature", "_UI_RelationColumnType_type"), 144 OljPackage.eINSTANCE.getRelationColumnType_RelationSourceTableID(), 145 true, 146 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 147 } 148 149 155 protected void addRelationSourceTableNamePropertyDescriptor(Object object) { 156 itemPropertyDescriptors.add 157 (new ItemPropertyDescriptor 158 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 159 getResourceLocator(), 160 getString("_UI_RelationColumnType_relationSourceTableName_feature"), 161 getString("_UI_PropertyDescriptor_description", "_UI_RelationColumnType_relationSourceTableName_feature", "_UI_RelationColumnType_type"), 162 OljPackage.eINSTANCE.getRelationColumnType_RelationSourceTableName(), 163 true, 164 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 165 } 166 167 173 protected void addRelationTargetColumnNamePropertyDescriptor(Object object) { 174 itemPropertyDescriptors.add 175 (new ItemPropertyDescriptor 176 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 177 getResourceLocator(), 178 getString("_UI_RelationColumnType_relationTargetColumnName_feature"), 179 getString("_UI_PropertyDescriptor_description", "_UI_RelationColumnType_relationTargetColumnName_feature", "_UI_RelationColumnType_type"), 180 OljPackage.eINSTANCE.getRelationColumnType_RelationTargetColumnName(), 181 true, 182 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 183 } 184 185 191 protected void addRelationTargetTableIDPropertyDescriptor(Object object) { 192 itemPropertyDescriptors.add 193 (new ItemPropertyDescriptor 194 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 195 getResourceLocator(), 196 getString("_UI_RelationColumnType_relationTargetTableID_feature"), 197 getString("_UI_PropertyDescriptor_description", "_UI_RelationColumnType_relationTargetTableID_feature", "_UI_RelationColumnType_type"), 198 OljPackage.eINSTANCE.getRelationColumnType_RelationTargetTableID(), 199 true, 200 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 201 } 202 203 209 protected void addRelationTargetTableNamePropertyDescriptor(Object object) { 210 itemPropertyDescriptors.add 211 (new ItemPropertyDescriptor 212 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 213 getResourceLocator(), 214 getString("_UI_RelationColumnType_relationTargetTableName_feature"), 215 getString("_UI_PropertyDescriptor_description", "_UI_RelationColumnType_relationTargetTableName_feature", "_UI_RelationColumnType_type"), 216 OljPackage.eINSTANCE.getRelationColumnType_RelationTargetTableName(), 217 true, 218 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 219 } 220 221 227 public Object getImage(Object object) { 228 return getResourceLocator().getImage("full/obj16/RelationColumnType"); 229 } 230 231 237 public String getText(Object object) { 238 String label = ((RelationColumnType)object).getRelationSourceColumnName(); 239 return label == null || label.length() == 0 ? 240 getString("_UI_RelationColumnType_type") : 241 getString("_UI_RelationColumnType_type") + " " + label; 242 } 243 244 251 public void notifyChanged(Notification notification) { 252 updateChildren(notification); 253 254 switch (notification.getFeatureID(RelationColumnType.class)) { 255 case OljPackage.RELATION_COLUMN_TYPE__DEFAULT_VALUE: 256 case OljPackage.RELATION_COLUMN_TYPE__RELATION_MODE: 257 case OljPackage.RELATION_COLUMN_TYPE__RELATION_SOURCE_COLUMN_NAME: 258 case OljPackage.RELATION_COLUMN_TYPE__RELATION_SOURCE_TABLE_ID: 259 case OljPackage.RELATION_COLUMN_TYPE__RELATION_SOURCE_TABLE_NAME: 260 case OljPackage.RELATION_COLUMN_TYPE__RELATION_TARGET_COLUMN_NAME: 261 case OljPackage.RELATION_COLUMN_TYPE__RELATION_TARGET_TABLE_ID: 262 case OljPackage.RELATION_COLUMN_TYPE__RELATION_TARGET_TABLE_NAME: 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 |