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.EFactory; 27 import org.eclipse.emf.ecore.EcorePackage; 28 import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; 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 import org.eclipse.emf.edit.provider.ViewerNotification; 35 36 37 43 public class EFactoryItemProvider 44 extends EModelElementItemProvider 45 implements 46 IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource 47 { 48 54 public EFactoryItemProvider(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 addEPackagePropertyDescriptor(object); 72 } 73 return itemPropertyDescriptors; 74 } 75 76 82 protected void addEPackagePropertyDescriptor(Object object) 83 { 84 itemPropertyDescriptors.add 85 (createItemPropertyDescriptor 86 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 87 getResourceLocator(), 88 getString("_UI_EFactory_ePackage_feature"), 89 getString("_UI_PropertyDescriptor_description", "_UI_EFactory_ePackage_feature", "_UI_EFactory_type"), 90 EcorePackage.eINSTANCE.getEFactory_EPackage(), 91 true, 92 null, 93 null, 94 null)); 95 } 96 97 103 public Object getImage(Object object) 104 { 105 return getResourceLocator().getImage("full/obj16/EFactory"); 106 } 107 108 114 public String getText(Object object) 115 { 116 EFactory eFactory = (EFactory)object; 117 StringBuffer result = new StringBuffer (); 118 if (eFactory.getEPackage() != null) 119 { 120 result.append(eFactory.getEPackage().getName()); 121 } 122 return result.toString(); 123 } 124 125 132 public void notifyChanged(Notification notification) 133 { 134 updateChildren(notification); 135 136 switch (notification.getFeatureID(EFactory.class)) 137 { 138 case EcorePackage.EFACTORY__EPACKAGE: 139 fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); 140 return; 141 } 142 super.notifyChanged(notification); 143 } 144 145 152 protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) 153 { 154 super.collectNewChildDescriptors(newChildDescriptors, object); 155 } 156 157 163 public ResourceLocator getResourceLocator() 164 { 165 return EcoreEditPlugin.INSTANCE; 166 } 167 168 } 169 | Popular Tags |