1 17 package org.eclipse.emf.edit.provider.resource; 18 19 20 import java.util.Collection ; 21 import java.util.Collections ; 22 import java.util.List ; 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.resource.ResourceSet; 28 import org.eclipse.emf.edit.EMFEditPlugin; 29 import org.eclipse.emf.edit.domain.EditingDomain; 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 38 42 public class ResourceSetItemProvider 43 extends ItemProviderAdapter 44 implements 45 IEditingDomainItemProvider, 46 IStructuredItemContentProvider, 47 ITreeItemContentProvider, 48 IItemLabelProvider, 49 IItemPropertySource 50 { 51 55 public ResourceSetItemProvider(AdapterFactory adapterFactory) 56 { 57 super(adapterFactory); 58 } 59 60 64 public List getPropertyDescriptors(Object object) 65 { 66 if (itemPropertyDescriptors == null) 67 { 68 super.getPropertyDescriptors(object); 69 } 70 return itemPropertyDescriptors; 71 } 72 73 public Collection getChildren(Object object) 74 { 75 ResourceSet resourceSet = (ResourceSet)object; 76 return resourceSet.getResources(); 77 } 78 79 87 public Collection getChildrenFeatures(Object object) 88 { 89 if (childrenFeatures == null) 90 { 91 super.getChildrenFeatures(object); 92 96 } 97 return childrenFeatures; 98 } 99 100 104 public Object getParent(Object object) 105 { 106 return null; 107 } 108 109 113 public Object getImage(Object object) 114 { 115 return getResourceLocator().getImage("full/obj16/ResourceSet"); 116 } 117 118 122 public String getText(Object object) 123 { 124 return EMFEditPlugin.INSTANCE.getString("_UI_ResourceSet_label"); 125 } 126 127 131 public void notifyChanged(Notification notification) 132 { 133 switch (notification.getFeatureID(ResourceSet.class)) 134 { 135 case ResourceSet.RESOURCE_SET__RESOURCES: 136 { 137 fireNotifyChanged(notification); 138 return; 139 } 140 } 141 super.notifyChanged(notification); 142 } 143 144 public Collection getNewChildDescriptors(Object object, EditingDomain editingDomain, Object sibling) 145 { 146 return Collections.EMPTY_LIST; 147 } 148 149 154 protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) 155 { 156 super.collectNewChildDescriptors(newChildDescriptors, object); 157 165 } 166 167 171 public ResourceLocator getResourceLocator() 172 { 173 return EMFEditPlugin.INSTANCE; 174 } 175 } 176 | Popular Tags |