1 11 package org.eclipse.pde.internal.ui.view; 12 13 import org.eclipse.core.runtime.IAdapterFactory; 14 import org.eclipse.pde.internal.core.FileAdapter; 15 import org.eclipse.pde.internal.core.ModelEntry; 16 import org.eclipse.ui.views.properties.IPropertySource; 17 18 public class PluginsViewAdapterFactory implements IAdapterFactory { 19 private FileAdapterPropertySource adapterPropertySource; 20 private ModelEntryPropertySource entryPropertySource; 21 22 public Object getAdapter(Object adaptableObject, Class adapterType) { 23 if (adapterType.equals(IPropertySource.class)) return getProperties(adaptableObject); 24 return null; 25 } 26 27 public java.lang.Class [] getAdapterList() { 28 return new Class [] { IPropertySource.class }; 29 } 30 31 private IPropertySource getProperties(Object object) { 32 if (object instanceof FileAdapter) { 33 if (adapterPropertySource==null) 34 adapterPropertySource = new FileAdapterPropertySource(); 35 adapterPropertySource.setAdapter((FileAdapter)object); 36 return adapterPropertySource; 37 } 38 if (object instanceof ModelEntry) { 39 if (entryPropertySource==null) 40 entryPropertySource = new ModelEntryPropertySource(); 41 entryPropertySource.setEntry((ModelEntry)object); 42 return entryPropertySource; 43 } 44 return null; 45 } 46 } 47 | Popular Tags |