当前位置: 首页>>代码示例>>Java>>正文


Java MarkerUtilities.setCharEnd方法代码示例

本文整理汇总了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);
	}
}
 
开发者ID:de-jcup,项目名称:eclipse-batch-editor,代码行数:20,代码来源:AbstractMarkerHelper.java

示例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;
    }
}
 
开发者ID:forcedotcom,项目名称:idecore,代码行数:29,代码来源:ApexErrorMarkerHandler.java


注:本文中的org.eclipse.ui.texteditor.MarkerUtilities.setCharEnd方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。