1 11 package org.eclipse.ui.internal.ide; 12 13 import org.eclipse.core.resources.IMarker; 14 import org.eclipse.core.runtime.CoreException; 15 16 20 public class ProblemImageProvider implements IMarkerImageProvider { 21 24 public ProblemImageProvider() { 25 super(); 26 } 27 28 38 public String getImagePath(IMarker marker) { 39 String iconPath = "/icons/full/"; if (isMarkerType(marker, IMarker.PROBLEM)) { 41 switch (marker.getAttribute(IMarker.SEVERITY, 42 IMarker.SEVERITY_WARNING)) { 43 case IMarker.SEVERITY_ERROR: 44 return iconPath + "obj16/error_tsk.gif"; case IMarker.SEVERITY_WARNING: 46 return iconPath + "obj16/warn_tsk.gif"; case IMarker.SEVERITY_INFO: 48 return iconPath + "obj16/info_tsk.gif"; } 50 } 51 return null; 52 } 53 54 57 private boolean isMarkerType(IMarker marker, String type) { 58 try { 59 return marker.isSubtypeOf(type); 60 } catch (CoreException e) { 61 return false; 62 } 63 } 64 } 65 | Popular Tags |