本文整理汇总了Java中org.eclipse.ui.texteditor.MarkerUtilities.setCharEnd方法的典型用法代码示例。如果您正苦于以下问题:Java MarkerUtilities.setCharEnd方法的具体用法?Java MarkerUtilities.setCharEnd怎么用?Java MarkerUtilities.setCharEnd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.ui.texteditor.MarkerUtilities
的用法示例。
在下文中一共展示了MarkerUtilities.setCharEnd方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createMarker
import org.eclipse.ui.texteditor.MarkerUtilities; //导入方法依赖的package包/类
private void createMarker(IResource resource, String message, int lineNumber, String markerType, int severity,
int charStart, int charEnd) throws CoreException {
if (lineNumber <= 0)
lineNumber = 1;
IMarker marker = findMarker(resource, message, lineNumber, markerType);
if (marker == null) {
HashMap<String, Object> map = new HashMap<>();
map.put(IMarker.SEVERITY, new Integer(severity));
map.put(IMarker.LOCATION, resource.getFullPath().toOSString());
map.put(IMarker.MESSAGE, message);
MarkerUtilities.setLineNumber(map, lineNumber);
MarkerUtilities.setMessage(map, message);
if (charStart != -1) {
MarkerUtilities.setCharStart(map, charStart);
MarkerUtilities.setCharEnd(map, charEnd);
}
internalCreateMarker(resource, map, markerType);
}
}
示例2: createSyntacticMarkerIfApplicable
import org.eclipse.ui.texteditor.MarkerUtilities; //导入方法依赖的package包/类
private Map<String, Object> createSyntacticMarkerIfApplicable(final ParseException parseException) {
Location loc = parseException.getLoc();
if (Locations.isReal(loc)) {
try {
UserError userError = parseException.getUserError();
Map<String, Object> config = new HashMap<>();
// There is the option to set the line number as well. However, that config is ignored if
// we set the CharStart and CharEnd. So, we only set the latter.
MarkerUtilities.setCharStart(config, getStartOffset(loc));
MarkerUtilities.setCharEnd(config, getEndOffset(loc));
MarkerUtilities.setMessage(config,
printerUtil.getFactory().userErrorPrinter().print(userError, printContext));
// Not sure why there aren't any utilities methods for these fields in MarkerUtilities
// So set them directly instead.
config.put(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
config.put(IMarker.LOCATION, fFile.getFullPath().toString());
return config;
} catch (BadLocationException ble) {
logger.warn("Error calculating offset to document using parser position", ble);
return null;
}
} else {
return null;
}
}