Example usage for org.eclipse.jdt.internal.compiler.problem DefaultProblem getSourceColumnNumber

List of usage examples for org.eclipse.jdt.internal.compiler.problem DefaultProblem getSourceColumnNumber

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.problem DefaultProblem getSourceColumnNumber.

Prototype

public int getSourceColumnNumber() 

Source Link

Document

Answer the line number in source where the problem begins.

Usage

From source file:org.jboss.tools.vscode.java.internal.handlers.DiagnosticsHandler.java

License:Open Source License

private Range convertRange(IProblem problem) {
    Range range = new Range();
    Position start = new Position();
    Position end = new Position();

    start.setLine(Double.valueOf(problem.getSourceLineNumber() - 1));// VSCode is 0-based
    end.setLine(Double.valueOf(problem.getSourceLineNumber() - 1));
    if (problem instanceof DefaultProblem) {
        DefaultProblem dProblem = (DefaultProblem) problem;
        start.setCharacter(Double.valueOf(dProblem.getSourceColumnNumber() - 1));
        int offset = 0;
        if (dProblem.getSourceStart() != -1 && dProblem.getSourceEnd() != -1) {
            offset = dProblem.getSourceEnd() - dProblem.getSourceStart() + 1;
        }//from www  . ja va 2 s  .co  m
        end.setCharacter(Double.valueOf(dProblem.getSourceColumnNumber() - 1 + offset));
    }
    return range.withEnd(end).withStart(start);
}