1 17 package org.eclipse.emf.ecore.provider; 18 19 20 import java.util.Collection ; 21 import java.util.List ; 22 23 import org.eclipse.emf.common.notify.AdapterFactory; 24 import org.eclipse.emf.common.notify.Notification; 25 import org.eclipse.emf.common.util.ResourceLocator; 26 import org.eclipse.emf.ecore.EModelElement; 27 import org.eclipse.emf.ecore.EcoreFactory; 28 import org.eclipse.emf.ecore.EcorePackage; 29 import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; 30 import org.eclipse.emf.edit.provider.IItemLabelProvider; 31 import org.eclipse.emf.edit.provider.IItemPropertySource; 32 import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; 33 import org.eclipse.emf.edit.provider.ITreeItemContentProvider; 34 35 import org.eclipse.emf.edit.provider.ViewerNotification; 36 37 43 public class EModelElementItemProvider 44 extends EObjectItemProvider 45 implements 46 IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource 47 { 48 54 public EModelElementItemProvider(AdapterFactory adapterFactory) 55 { 56 super(adapterFactory); 57 } 58 59 65 public List getPropertyDescriptors(Object object) 66 { 67 if (itemPropertyDescriptors == null) 68 { 69 super.getPropertyDescriptors(object); 70 71 } 72 return itemPropertyDescriptors; 73 } 74 75 83 public Collection getChildrenFeatures(Object object) 84 { 85 if (childrenFeatures == null) 86 { 87 super.getChildrenFeatures(object); 88 childrenFeatures.add(EcorePackage.eINSTANCE.getEModelElement_EAnnotations()); 89 } 90 return childrenFeatures; 91 } 92 93 99 public String getText(Object object) 100 { 101 return getString("_UI_EModelElement_type"); 102 } 103 104 111 public void notifyChanged(Notification notification) 112 { 113 updateChildren(notification); 114 115 switch (notification.getFeatureID(EModelElement.class)) 116 { 117 case EcorePackage.EMODEL_ELEMENT__EANNOTATIONS: 118 fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); 119 return; 120 } 121 super.notifyChanged(notification); 122 } 123 124 131 protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) 132 { 133 super.collectNewChildDescriptors(newChildDescriptors, object); 134 135 newChildDescriptors.add 136 (createChildParameter 137 (EcorePackage.eINSTANCE.getEModelElement_EAnnotations(), 138 EcoreFactory.eINSTANCE.createEAnnotation())); 139 } 140 141 147 public ResourceLocator getResourceLocator() 148 { 149 return EcoreEditPlugin.INSTANCE; 150 } 151 152 } 153 | Popular Tags |