1 11 package org.eclipse.ui.internal.ide.model; 12 13 import org.eclipse.core.resources.IFile; 14 import org.eclipse.core.resources.IResource; 15 import org.eclipse.core.runtime.IAdapterFactory; 16 import org.eclipse.ui.views.properties.FilePropertySource; 17 import org.eclipse.ui.views.properties.IPropertySource; 18 import org.eclipse.ui.views.properties.ResourcePropertySource; 19 20 23 class StandardPropertiesAdapterFactory implements IAdapterFactory { 24 27 public Object getAdapter(Object o, Class adapterType) { 28 if (adapterType.isInstance(o)) { 29 return o; 30 } 31 if (adapterType == IPropertySource.class) { 32 if (o instanceof IResource) { 33 IResource resource = (IResource) o; 34 if (resource.getType() == IResource.FILE) { 35 return new FilePropertySource((IFile) o); 36 } else { 37 return new ResourcePropertySource((IResource) o); 38 } 39 } 40 } 41 return null; 42 } 43 44 47 public Class [] getAdapterList() { 48 return new Class [] { IPropertySource.class }; 49 } 50 } 51 | Popular Tags |