1 11 12 package org.eclipse.search.internal.ui; 13 14 15 import org.eclipse.core.resources.IMarker; 16 import org.eclipse.core.resources.IResource; 17 import org.eclipse.core.runtime.IAdapterFactory; 18 19 import org.eclipse.search.ui.ISearchResultViewEntry; 20 21 26 public class SearchResultViewEntryAdapterFactory implements IAdapterFactory { 27 28 private static Class [] PROPERTIES= new Class [] { 29 IResource.class, IMarker.class, 30 }; 31 32 33 public Class [] getAdapterList() { 34 return PROPERTIES; 35 } 36 37 public Object getAdapter(Object element, Class key) { 38 39 ISearchResultViewEntry entry= (ISearchResultViewEntry) element; 40 41 if (IMarker.class.equals(key)) { 42 return entry.getSelectedMarker(); 43 } 44 if (IResource.class.equals(key)) { 45 IResource resource= entry.getResource(); 46 51 int type= resource.getType(); 52 if (type != IResource.PROJECT && type != IResource.ROOT) 53 return resource; 54 } 55 return null; 56 } 57 } 58 | Popular Tags |