1 17 package org.eclipse.emf.codegen.ecore.genmodel.provider; 18 19 20 import java.util.List ; 21 22 import org.eclipse.emf.codegen.ecore.genmodel.GenEnumLiteral; 23 import org.eclipse.emf.codegen.ecore.genmodel.GenModelPackage; 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.edit.provider.ComposeableAdapterFactory; 28 import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; 29 import org.eclipse.emf.edit.provider.IItemLabelProvider; 30 import org.eclipse.emf.edit.provider.IItemPropertySource; 31 import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; 32 import org.eclipse.emf.edit.provider.ITreeItemContentProvider; 33 34 import org.eclipse.emf.edit.provider.ViewerNotification; 35 36 38 39 45 public class GenEnumLiteralItemProvider 46 extends GenBaseItemProvider 47 implements 48 IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource 49 { 50 56 public GenEnumLiteralItemProvider(AdapterFactory adapterFactory) 57 { 58 super(adapterFactory); 59 } 60 61 67 public List getPropertyDescriptors(Object object) 68 { 69 if (itemPropertyDescriptors == null) 70 { 71 super.getPropertyDescriptors(object); 72 73 addEcoreEnumLiteralPropertyDescriptor(object); 74 } 75 return itemPropertyDescriptors; 76 } 77 78 84 protected void addEcoreEnumLiteralPropertyDescriptor(Object object) 85 { 86 itemPropertyDescriptors.add 87 (createItemPropertyDescriptor 88 (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), 89 getResourceLocator(), 90 getString("_UI_GenEnumLiteral_ecoreEnumLiteral_feature"), 91 getString("_UI_GenEnumLiteral_ecoreEnumLiteral_description"), 92 GenModelPackage.eINSTANCE.getGenEnumLiteral_EcoreEnumLiteral(), 93 false, 94 null, 95 getString("_UI_EcorePropertyCategory"), 96 null)); 97 } 98 99 101 public Object getImage(Object object) 102 { 103 return new UnderlayedImage(getResourceLocator().getImage("full/obj16/EEnumLiteral")); 104 } 105 106 109 public String getText(Object object) 110 { 111 GenEnumLiteral genEnumLiteral = (GenEnumLiteral)object; 112 return genEnumLiteral.getEcoreEnumLiteral().getName() + " = " + genEnumLiteral.getEcoreEnumLiteral().getValue(); 113 } 114 115 122 public void notifyChanged(Notification notification) 123 { 124 updateChildren(notification); 125 126 switch (notification.getFeatureID(GenEnumLiteral.class)) 127 { 128 case GenModelPackage.GEN_ENUM_LITERAL__ECORE_ENUM_LITERAL: 129 fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); 130 return; 131 } 132 super.notifyChanged(notification); 133 } 134 135 141 public ResourceLocator getResourceLocator() 142 { 143 return GenModelEditPlugin.INSTANCE; 144 } 145 146 } 147 | Popular Tags |