1 11 12 package org.eclipse.jdt.internal.ui.search; 13 14 import org.eclipse.core.resources.IMarker; 15 import org.eclipse.core.runtime.CoreException; 16 import org.eclipse.jdt.internal.ui.JavaPluginImages; 17 import org.eclipse.swt.graphics.Image; 18 19 23 class ExceptionOccurrencesLabelProvider extends JavaSearchResultLabelProvider { 24 25 public String getText(Object o) { 26 IMarker marker= getMarker(o); 27 try { 28 String text= (String )marker.getAttribute(IMarker.MESSAGE); 29 if (text != null) 30 return text.replace('\t', ' '); 31 } catch (CoreException ex) { 32 return ""; } 34 return super.getText(o); 35 } 36 37 public Image getImage(Object element) { 38 IMarker marker= getMarker(element); 39 if (isException(marker)) { 40 return JavaPluginImages.get(JavaPluginImages.IMG_OBJS_EXCEPTION); 41 } 42 return JavaPluginImages.get(JavaPluginImages.IMG_OBJS_SEARCH_OCCURRENCE); 43 } 44 45 private boolean isException(IMarker marker) { 46 Boolean variable= null; 47 boolean variableValue= false; 48 try { 49 variable= (Boolean )marker.getAttribute(ExceptionOccurrencesFinder.IS_EXCEPTION); 50 variableValue= variable != null && variable.booleanValue(); 51 } catch (CoreException e) { 52 } 53 return variableValue; 54 } 55 } 56 | Popular Tags |