1 17 package org.eclipse.emf.ecore.change.provider; 18 19 20 import java.util.Collection ; 21 import java.util.List ; 22 import java.util.Map ; 23 24 import org.eclipse.emf.common.notify.AdapterFactory; 25 import org.eclipse.emf.common.notify.Notification; 26 import org.eclipse.emf.common.util.ResourceLocator; 27 import org.eclipse.emf.ecore.change.ChangePackage; 28 import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator; 29 import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; 30 import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; 31 import org.eclipse.emf.edit.provider.IItemLabelProvider; 32 import org.eclipse.emf.edit.provider.IItemPropertySource; 33 import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; 34 import org.eclipse.emf.edit.provider.ITreeItemContentProvider; 35 import org.eclipse.emf.edit.provider.ItemProviderAdapter; 36 37 import org.eclipse.emf.edit.provider.ViewerNotification; 38 39 45 public class EObjectToChangesMapEntryItemProvider 46 extends ItemProviderAdapter 47 implements 48 IEditingDomainItemProvider, 49 IStructuredItemContentProvider, 50 ITreeItemContentProvider, 51 IItemLabelProvider, 52 IItemPropertySource 53 { 54 protected AdapterFactoryItemDelegator itemDelegator; 55 56 62 public EObjectToChangesMapEntryItemProvider(AdapterFactory adapterFactory) 63 { 64 super(adapterFactory); 65 itemDelegator = new AdapterFactoryItemDelegator(getRootAdapterFactory()); 66 } 67 68 74 public List getPropertyDescriptors(Object object) 75 { 76 if (itemPropertyDescriptors == null) 77 { 78 super.getPropertyDescriptors(object); 79 80 addKeyPropertyDescriptor(object); 81 } 82 return itemPropertyDescriptors; 83 } 84 85 91 protected void addKeyPropertyDescriptor(Object object) 92 { 93 itemPropertyDescriptors.add 94 (createItemPropertyDescriptor 95 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 96 getResourceLocator(), 97 getString("_UI_EObjectToChangesMapEntry_key_feature"), 98 getString("_UI_PropertyDescriptor_description", "_UI_EObjectToChangesMapEntry_key_feature", "_UI_EObjectToChangesMapEntry_type"), 99 ChangePackage.eINSTANCE.getEObjectToChangesMapEntry_Key(), 100 true, 101 null, 102 null, 103 null)); 104 } 105 106 114 public Collection getChildrenFeatures(Object object) 115 { 116 if (childrenFeatures == null) 117 { 118 super.getChildrenFeatures(object); 119 childrenFeatures.add(ChangePackage.eINSTANCE.getEObjectToChangesMapEntry_Value()); 120 } 121 return childrenFeatures; 122 } 123 124 130 public Object getImage(Object object) 131 { 132 return getResourceLocator().getImage("full/obj16/EObjectToChangesMapEntry"); 133 } 134 135 141 public String getText(Object object) 142 { 143 Map.Entry eObjectToChangesMapEntry = (Map.Entry )object; 144 return itemDelegator.getText(eObjectToChangesMapEntry.getKey()); 145 } 146 147 154 public void notifyChanged(Notification notification) 155 { 156 updateChildren(notification); 157 158 switch (notification.getFeatureID(Map.Entry .class)) 159 { 160 case ChangePackage.EOBJECT_TO_CHANGES_MAP_ENTRY__VALUE: 161 fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); 162 return; 163 } 164 super.notifyChanged(notification); 165 } 166 167 173 public ResourceLocator getResourceLocator() 174 { 175 return ChangeEditPlugin.INSTANCE; 176 } 177 178 } 179 | Popular Tags |