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


Java CompilationResult.getLineSeparatorPositions方法代码示例

本文整理汇总了Java中org.eclipse.jdt.internal.compiler.CompilationResult.getLineSeparatorPositions方法的典型用法代码示例。如果您正苦于以下问题:Java CompilationResult.getLineSeparatorPositions方法的具体用法?Java CompilationResult.getLineSeparatorPositions怎么用?Java CompilationResult.getLineSeparatorPositions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jdt.internal.compiler.CompilationResult的用法示例。


在下文中一共展示了CompilationResult.getLineSeparatorPositions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: nameForReporting

import org.eclipse.jdt.internal.compiler.CompilationResult; //导入方法依赖的package包/类
public String nameForReporting(ASTNode location, ReferenceContext referenceContext) {
	if (this.name == UNASSIGNED_CLOSEABLE_NAME) {
		if (location != null && referenceContext != null) {
			CompilationResult compResult = referenceContext.compilationResult();
			if (compResult != null) {
				int[] lineEnds = compResult.getLineSeparatorPositions();
				int resourceLine = Util.getLineNumber(this.sourceStart, lineEnds , 0, lineEnds.length-1);
				int reportLine = Util.getLineNumber(location.sourceStart, lineEnds , 0, lineEnds.length-1);
				if (resourceLine != reportLine) {
					char[] replacement = Integer.toString(resourceLine).toCharArray();
					return String.valueOf(CharOperation.replace(UNASSIGNED_CLOSEABLE_NAME_TEMPLATE, TEMPLATE_ARGUMENT, replacement));
				}
			}
		}
	}
	return String.valueOf(this.name);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:18,代码来源:FakedTrackingVariable.java

示例2: getRecordedParsingInformation

import org.eclipse.jdt.internal.compiler.CompilationResult; //导入方法依赖的package包/类
private RecordedParsingInformation getRecordedParsingInformation(CompilationResult compilationResult, int[][] commentPositions) {
	int problemsCount = compilationResult.problemCount;
	CategorizedProblem[] problems = null;
	if (problemsCount != 0) {
		final CategorizedProblem[] compilationResultProblems = compilationResult.problems;
		if (compilationResultProblems.length == problemsCount) {
			problems = compilationResultProblems;
		} else {
			System.arraycopy(compilationResultProblems, 0, (problems = new CategorizedProblem[problemsCount]), 0, problemsCount);
		}
	}
	return new RecordedParsingInformation(problems, compilationResult.getLineSeparatorPositions(), commentPositions);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:14,代码来源:CodeSnippetParsingUtil.java

示例3: updateContext

import org.eclipse.jdt.internal.compiler.CompilationResult; //导入方法依赖的package包/类
public void updateContext(InvocationSite invocationSite, CompilationResult unitResult) {
	if (this.problem == null) return;
	if (this.problem.getSourceStart() != 0 || this.problem.getSourceEnd() != 0) return;
	this.problem.setSourceStart(invocationSite.sourceStart());
	this.problem.setSourceEnd(invocationSite.sourceEnd());
	int[] lineEnds = unitResult.getLineSeparatorPositions();
	this.problem.setSourceLineNumber(Util.getLineNumber(invocationSite.sourceStart(), lineEnds, 0, lineEnds.length-1));
	this.compilationResult = unitResult;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:10,代码来源:AbortCompilation.java


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