1 11 package org.eclipse.jdt.internal.ui; 12 13 import org.eclipse.core.runtime.IAdapterFactory; 14 15 import org.eclipse.search.ui.ISearchPageScoreComputer; 16 17 import org.eclipse.jdt.internal.ui.search.JavaSearchPageScoreComputer; 18 import org.eclipse.jdt.internal.ui.search.SearchUtil; 19 20 21 24 public class MarkerAdapterFactory implements IAdapterFactory { 25 26 private static Class [] PROPERTIES= new Class [0]; 27 28 29 private Object fSearchPageScoreComputer; 30 31 public Class [] getAdapterList() { 32 updateLazyLoadedAdapters(); 33 return PROPERTIES; 34 } 35 36 public Object getAdapter(Object element, Class key) { 37 updateLazyLoadedAdapters(); 38 if (fSearchPageScoreComputer != null && ISearchPageScoreComputer.class.equals(key)) 39 return fSearchPageScoreComputer; 40 return null; 41 } 42 43 private void updateLazyLoadedAdapters() { 44 if (fSearchPageScoreComputer == null && SearchUtil.isSearchPlugInActivated()) 45 createSearchPageScoreComputer(); 46 } 47 48 private void createSearchPageScoreComputer() { 49 fSearchPageScoreComputer= new JavaSearchPageScoreComputer(); 50 PROPERTIES= new Class [] {ISearchPageScoreComputer.class}; 51 } 52 } 53 | Popular Tags |