本文整理汇总了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);
}
示例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);
}
示例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;
}