1 11 package org.eclipse.jdt.internal.ui.search; 12 13 import org.eclipse.jface.viewers.LabelProvider; 14 15 import org.eclipse.search.ui.text.AbstractTextSearchViewPage; 16 17 import org.eclipse.jdt.internal.corext.util.Messages; 18 19 public abstract class TextSearchLabelProvider extends LabelProvider { 20 21 private AbstractTextSearchViewPage fPage; 22 private String fMatchCountFormat; 23 24 public TextSearchLabelProvider(AbstractTextSearchViewPage page) { 25 fPage= page; 26 fMatchCountFormat= SearchMessages.TextSearchLabelProvider_matchCountFormat; 27 } 28 29 public final String getText(Object element) { 30 int matchCount= fPage.getInput().getMatchCount(element); 31 String text= doGetText(element); 32 if (matchCount < 2) 33 return text; 34 else { 35 return Messages.format(fMatchCountFormat, new Object [] { text, new Integer (matchCount) }); 36 } 37 } 38 39 protected abstract String doGetText(Object element); 40 } 41 | Popular Tags |