use of org.eclipse.jdt.ls.core.internal.corrections.ProblemLocation in project eclipse.jdt.ls by eclipse.
the class CodeActionHandler method getProblemLocations.
private IProblemLocation[] getProblemLocations(ICompilationUnit unit, List<Diagnostic> diagnostics) {
IProblemLocation[] locations = new IProblemLocation[diagnostics.size()];
for (int i = 0; i < diagnostics.size(); i++) {
Diagnostic diagnostic = diagnostics.get(i);
int problemId = getProblemId(diagnostic);
int start = DiagnosticsHelper.getStartOffset(unit, diagnostic.getRange());
int end = DiagnosticsHelper.getEndOffset(unit, diagnostic.getRange());
boolean isError = diagnostic.getSeverity() == DiagnosticSeverity.Error;
locations[i] = new ProblemLocation(start, end - start, problemId, isError);
}
return locations;
}
use of org.eclipse.jdt.ls.core.internal.corrections.ProblemLocation in project eclipse.jdt.ls by eclipse.
the class PotentialProgrammingProblemsFix method createCleanUp.
public static ICleanUpFix createCleanUp(CompilationUnit compilationUnit, boolean addSerialVersionIds) {
IProblem[] problems = compilationUnit.getProblems();
IProblemLocation[] locations = new IProblemLocation[problems.length];
for (int i = 0; i < problems.length; i++) {
// locations[i]= new ProblemLocation(problems[i]);
boolean isError = problems[i].isError();
int problemId = problems[i].getID();
int length = problems[i].getSourceEnd() - problems[i].getSourceStart();
int offset = problems[i].getSourceStart();
locations[i] = new ProblemLocation(offset, length, problemId, isError);
}
return createCleanUp(compilationUnit, locations, addSerialVersionIds);
}
Aggregations