use of org.eclipse.jdt.internal.ui.text.correction.ProblemLocationCore in project eclipse.jdt.ls by eclipse.
the class CodeActionHandler method getProblemLocationCores.
public static IProblemLocationCore[] getProblemLocationCores(ICompilationUnit unit, List<Diagnostic> diagnostics) {
IProblemLocationCore[] locations = new IProblemLocationCore[diagnostics.size()];
for (int i = 0; i < diagnostics.size(); i++) {
Diagnostic diagnostic = diagnostics.get(i);
int start = DiagnosticsHelper.getStartOffset(unit, diagnostic.getRange());
int end = DiagnosticsHelper.getEndOffset(unit, diagnostic.getRange());
boolean isError = diagnostic.getSeverity() == DiagnosticSeverity.Error;
int problemId = getProblemId(diagnostic);
List<String> arguments = new ArrayList<>();
if (diagnostic.getData() instanceof JsonArray) {
final JsonArray data = (JsonArray) diagnostic.getData();
for (JsonElement e : data) {
arguments.add(e.getAsString());
}
}
locations[i] = new ProblemLocationCore(start, end - start, problemId, arguments.toArray(new String[0]), isError, IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER);
}
return locations;
}
Aggregations