1 7 package Olj.provider; 8 9 10 import Olj.OljPackage; 11 import Olj.RestartCounterType; 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 RestartCounterTypeItemProvider 38 extends ItemProviderAdapter 39 implements 40 IEditingDomainItemProvider, 41 IStructuredItemContentProvider, 42 ITreeItemContentProvider, 43 IItemLabelProvider, 44 IItemPropertySource { 45 51 public RestartCounterTypeItemProvider(AdapterFactory adapterFactory) { 52 super(adapterFactory); 53 } 54 55 61 public List getPropertyDescriptors(Object object) { 62 if (itemPropertyDescriptors == null) { 63 super.getPropertyDescriptors(object); 64 65 addImportDefinitionColumnNamePropertyDescriptor(object); 66 addRestartAutoCreatePropertyDescriptor(object); 67 addRestartCounterColumnNamePropertyDescriptor(object); 68 addTableNamePropertyDescriptor(object); 69 } 70 return itemPropertyDescriptors; 71 } 72 73 79 protected void addImportDefinitionColumnNamePropertyDescriptor(Object object) { 80 itemPropertyDescriptors.add 81 (new ItemPropertyDescriptor 82 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 83 getResourceLocator(), 84 getString("_UI_RestartCounterType_importDefinitionColumnName_feature"), 85 getString("_UI_PropertyDescriptor_description", "_UI_RestartCounterType_importDefinitionColumnName_feature", "_UI_RestartCounterType_type"), 86 OljPackage.eINSTANCE.getRestartCounterType_ImportDefinitionColumnName(), 87 true, 88 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 89 } 90 91 97 protected void addRestartAutoCreatePropertyDescriptor(Object object) { 98 itemPropertyDescriptors.add 99 (new ItemPropertyDescriptor 100 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 101 getResourceLocator(), 102 getString("_UI_RestartCounterType_restartAutoCreate_feature"), 103 getString("_UI_PropertyDescriptor_description", "_UI_RestartCounterType_restartAutoCreate_feature", "_UI_RestartCounterType_type"), 104 OljPackage.eINSTANCE.getRestartCounterType_RestartAutoCreate(), 105 true, 106 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 107 } 108 109 115 protected void addRestartCounterColumnNamePropertyDescriptor(Object object) { 116 itemPropertyDescriptors.add 117 (new ItemPropertyDescriptor 118 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 119 getResourceLocator(), 120 getString("_UI_RestartCounterType_restartCounterColumnName_feature"), 121 getString("_UI_PropertyDescriptor_description", "_UI_RestartCounterType_restartCounterColumnName_feature", "_UI_RestartCounterType_type"), 122 OljPackage.eINSTANCE.getRestartCounterType_RestartCounterColumnName(), 123 true, 124 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 125 } 126 127 133 protected void addTableNamePropertyDescriptor(Object object) { 134 itemPropertyDescriptors.add 135 (new ItemPropertyDescriptor 136 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 137 getResourceLocator(), 138 getString("_UI_RestartCounterType_tableName_feature"), 139 getString("_UI_PropertyDescriptor_description", "_UI_RestartCounterType_tableName_feature", "_UI_RestartCounterType_type"), 140 OljPackage.eINSTANCE.getRestartCounterType_TableName(), 141 true, 142 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); 143 } 144 145 151 public Object getImage(Object object) { 152 return getResourceLocator().getImage("full/obj16/RestartCounterType"); 153 } 154 155 161 public String getText(Object object) { 162 String label = ((RestartCounterType)object).getImportDefinitionColumnName(); 163 return label == null || label.length() == 0 ? 164 getString("_UI_RestartCounterType_type") : 165 getString("_UI_RestartCounterType_type") + " " + label; 166 } 167 168 175 public void notifyChanged(Notification notification) { 176 updateChildren(notification); 177 178 switch (notification.getFeatureID(RestartCounterType.class)) { 179 case OljPackage.RESTART_COUNTER_TYPE__IMPORT_DEFINITION_COLUMN_NAME: 180 case OljPackage.RESTART_COUNTER_TYPE__RESTART_AUTO_CREATE: 181 case OljPackage.RESTART_COUNTER_TYPE__RESTART_COUNTER_COLUMN_NAME: 182 case OljPackage.RESTART_COUNTER_TYPE__TABLE_NAME: 183 fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); 184 return; 185 } 186 super.notifyChanged(notification); 187 } 188 189 196 protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { 197 super.collectNewChildDescriptors(newChildDescriptors, object); 198 } 199 200 206 public ResourceLocator getResourceLocator() { 207 return OljEditPlugin.INSTANCE; 208 } 209 210 } 211 | Popular Tags |