1 11 package org.eclipse.pde.internal.runtime.registry; 12 13 import org.eclipse.core.runtime.*; 14 import org.eclipse.ui.views.properties.IPropertySource; 15 16 public class RegistryPropertySourceFactory implements IAdapterFactory { 17 18 public Object getAdapter(Object adaptableObject, Class adapterType) { 19 if (adapterType.equals(IPropertySource.class)) return getPropertySource(adaptableObject); 20 return null; 21 } 22 public java.lang.Class [] getAdapterList() { 23 return new Class [] { IPropertySource.class }; 24 } 25 protected IPropertySource getPropertySource(Object sourceObject) { 26 if (sourceObject instanceof PluginObjectAdapter) 27 sourceObject = ((PluginObjectAdapter) sourceObject).getObject(); 28 if (sourceObject instanceof IPluginDescriptor) { 29 return new PluginPropertySource((IPluginDescriptor) sourceObject); 30 } 31 if (sourceObject instanceof IExtension) { 32 return new ExtensionPropertySource((IExtension) sourceObject); 33 } 34 if (sourceObject instanceof IExtensionPoint) { 35 return new ExtensionPointPropertySource((IExtensionPoint) sourceObject); 36 } 37 if (sourceObject instanceof ILibrary) { 38 return new LibraryPropertySource((ILibrary) sourceObject); 39 } 40 if (sourceObject instanceof IConfigurationElement) { 41 return new ConfigurationElementPropertySource((IConfigurationElement) sourceObject); 42 } 43 if (sourceObject instanceof IPluginPrerequisite) { 44 return new PrerequisitePropertySource((IPluginPrerequisite) sourceObject); 45 } 46 return null; 47 } 48 } 49 | Popular Tags |