1 11 12 package org.eclipse.jdt.internal.ui.refactoring.nls.search; 13 14 import org.eclipse.search.ui.text.AbstractTextSearchViewPage; 15 16 import org.eclipse.jdt.internal.corext.util.Messages; 17 18 import org.eclipse.jdt.ui.JavaElementLabels; 19 20 import org.eclipse.swt.graphics.Image; 21 22 import org.eclipse.jdt.internal.ui.search.TextSearchLabelProvider; 23 import org.eclipse.jdt.internal.ui.viewsupport.AppearanceAwareLabelProvider; 24 25 26 class NLSSearchResultLabelProvider2 extends TextSearchLabelProvider { 27 28 private AppearanceAwareLabelProvider fLabelProvider; 29 30 public NLSSearchResultLabelProvider2(AbstractTextSearchViewPage page) { 31 super(page); 32 fLabelProvider= new AppearanceAwareLabelProvider(JavaElementLabels.ALL_POST_QUALIFIED, 0); 33 } 34 35 38 protected String doGetText(Object element) { 39 if (element instanceof FileEntry) { 40 FileEntry fileEntry= (FileEntry) element; 41 return fileEntry.getMessage(); 42 } else if (element instanceof CompilationUnitEntry) { 43 return ((CompilationUnitEntry)element).getMessage(); 44 } else { 45 return Messages.format(NLSSearchMessages.NLSSearchResultLabelProvider2_undefinedKeys, fLabelProvider.getText(element)); 46 } 47 } 48 49 52 public Image getImage(Object element) { 53 if (element instanceof FileEntry) 54 element= ((FileEntry) element).getPropertiesFile(); 55 if (element instanceof CompilationUnitEntry) 56 element= ((CompilationUnitEntry)element).getCompilationUnit(); 57 58 return fLabelProvider.getImage(element); 59 } 60 61 64 public void dispose() { 65 fLabelProvider.dispose(); 66 fLabelProvider= null; 67 super.dispose(); 68 } 69 } 70 | Popular Tags |