1 7 package org.enhydra.dods.editor.Doml.provider; 8 9 10 import java.util.Collection ; 11 import java.util.List ; 12 13 import org.eclipse.emf.common.notify.AdapterFactory; 14 import org.eclipse.emf.common.notify.Notification; 15 16 import org.eclipse.emf.common.util.ResourceLocator; 17 18 import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; 19 import org.eclipse.emf.edit.provider.IItemLabelProvider; 20 import org.eclipse.emf.edit.provider.IItemPropertySource; 21 import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; 22 import org.eclipse.emf.edit.provider.ITreeItemContentProvider; 23 import org.eclipse.emf.edit.provider.ItemProviderAdapter; 24 import org.eclipse.emf.edit.provider.ViewerNotification; 25 26 import org.enhydra.dods.editor.Doml.DocumentRoot; 27 import org.enhydra.dods.editor.Doml.DomlFactory; 28 import org.enhydra.dods.editor.Doml.DomlPackage; 29 30 36 public class DocumentRootItemProvider 37 extends ItemProviderAdapter 38 implements 39 IEditingDomainItemProvider, 40 IStructuredItemContentProvider, 41 ITreeItemContentProvider, 42 IItemLabelProvider, 43 IItemPropertySource { 44 50 public DocumentRootItemProvider(AdapterFactory adapterFactory) { 51 super(adapterFactory); 52 } 53 54 60 public List getPropertyDescriptors(Object object) { 61 if (itemPropertyDescriptors == null) { 62 super.getPropertyDescriptors(object); 63 64 } 65 return itemPropertyDescriptors; 66 } 67 68 76 public Collection getChildrenFeatures(Object object) { 77 if (childrenFeatures == null) { 78 super.getChildrenFeatures(object); 79 childrenFeatures.add(DomlPackage.eINSTANCE.getDocumentRoot_Mixed()); 80 } 81 return childrenFeatures; 82 } 83 84 90 public Object getImage(Object object) { 91 return getResourceLocator().getImage("full/obj16/DocumentRoot"); 92 } 93 94 100 public String getText(Object object) { 101 return getString("_UI_DocumentRoot_type"); 102 } 103 104 111 public void notifyChanged(Notification notification) { 112 updateChildren(notification); 113 114 switch (notification.getFeatureID(DocumentRoot.class)) { 115 case DomlPackage.DOCUMENT_ROOT__MIXED: 116 fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); 117 return; 118 } 119 super.notifyChanged(notification); 120 } 121 122 129 protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { 130 super.collectNewChildDescriptors(newChildDescriptors, object); 131 132 newChildDescriptors.add 133 (createChildParameter 134 (DomlPackage.eINSTANCE.getDocumentRoot_Column(), 135 DomlFactory.eINSTANCE.createColumnType())); 136 137 newChildDescriptors.add 138 (createChildParameter 139 (DomlPackage.eINSTANCE.getDocumentRoot_Database(), 140 DomlFactory.eINSTANCE.createDatabaseType())); 141 142 newChildDescriptors.add 143 (createChildParameter 144 (DomlPackage.eINSTANCE.getDocumentRoot_Doml(), 145 DomlFactory.eINSTANCE.createDomlType())); 146 147 newChildDescriptors.add 148 (createChildParameter 149 (DomlPackage.eINSTANCE.getDocumentRoot_Index(), 150 DomlFactory.eINSTANCE.createIndexType())); 151 152 newChildDescriptors.add 153 (createChildParameter 154 (DomlPackage.eINSTANCE.getDocumentRoot_IndexColumn(), 155 DomlFactory.eINSTANCE.createIndexColumnType())); 156 157 newChildDescriptors.add 158 (createChildParameter 159 (DomlPackage.eINSTANCE.getDocumentRoot_Package(), 160 DomlFactory.eINSTANCE.createPackageType())); 161 162 newChildDescriptors.add 163 (createChildParameter 164 (DomlPackage.eINSTANCE.getDocumentRoot_ReferenceObject(), 165 DomlFactory.eINSTANCE.createReferenceObjectType())); 166 167 newChildDescriptors.add 168 (createChildParameter 169 (DomlPackage.eINSTANCE.getDocumentRoot_Table(), 170 DomlFactory.eINSTANCE.createTableType())); 171 172 newChildDescriptors.add 173 (createChildParameter 174 (DomlPackage.eINSTANCE.getDocumentRoot_Type(), 175 DomlFactory.eINSTANCE.createTypeType())); 176 } 177 178 184 public ResourceLocator getResourceLocator() { 185 return DomlEditPlugin.INSTANCE; 186 } 187 188 } 189 | Popular Tags |