下面列出了怎么用org.eclipse.jface.text.source.ImageUtilities的API类实例代码及写法,或者点击链接到github查看源代码。
@Override
public boolean paint(SourceCodeTextEditor editor, MarkerAnnotation annotation,
GC gc, Canvas canvas, Rectangle bounds) {
IMarker marker = annotation.getMarker();
try {
if (marker.exists() && XdsMarkerConstants.PARSER_PROBLEM.equals(marker.getType())) {
boolean isInCompilationSet = CompilationSetManager.getInstance().isInCompilationSet((IFile)marker.getResource());
if (!isInCompilationSet) {
int actualSeverity = marker.getAttribute(XdsMarkerConstants.PARSER_PROBLEM_SEVERITY_ATTRIBUTE, -1);
if (actualSeverity > -1) {
Image image = null;
switch (actualSeverity) {
case IMarker.SEVERITY_ERROR:
image = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
break;
case IMarker.SEVERITY_WARNING:
image = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_WARN_TSK);
break;
default:
break;
}
if (image != null) {
ImageUtilities.drawImage(image, gc, canvas, bounds, SWT.CENTER, SWT.TOP);
return true;
}
return false;
}
}
}
} catch (CoreException e) {
LogHelper.logError(e);
}
return false;
}
public void paint(GC gc, Canvas canvas, Rectangle r)
{
initializeImage();
if (fImage != null)
{
ImageUtilities.drawImage(fImage, gc, canvas, r, SWT.CENTER, SWT.TOP);
}
}
@Override
public void paint(GC gc, Canvas canvas, Rectangle bounds) {
Image image = getImages().get(getType());
if(image != null)
ImageUtilities.drawImage(image, gc, canvas, bounds, SWT.CENTER, SWT.TOP);
}
public void paint(GC gc, Canvas canvas, Rectangle r) {
initializeImage();
if (fImage != null)
ImageUtilities.drawImage(fImage, gc, canvas, r, SWT.CENTER, SWT.TOP);
}
public void paint(GC gc, Canvas canvas, Rectangle bounds) {
// draw affordance so the user know she can click here to get a breakpoint
Image fImage= JavaPluginImages.get(JavaPluginImages.IMG_FIELD_PUBLIC);
ImageUtilities.drawImage(fImage, gc, canvas, bounds, SWT.CENTER);
}
public void paint(GC gc, Canvas canvas, Rectangle r) {
ImageUtilities.drawImage(getImage(), gc, canvas, r, SWT.CENTER, SWT.TOP);
}