@Override
public Map<String, Object> _case(RealLoc loc) {
try {
Map<String, Object> config = new HashMap<String, Object>();
MarkerUtilities.setMessage(config, PrinterUtil.INSTANCE.getFactory()
.userErrorPrinter().print(apexException.getError(), new PrintContext()));
MarkerUtilities.setCharStart(config,
ParserLocationTranslator.getStartOffset(loc, fDocument));
MarkerUtilities.setCharEnd(config,
ParserLocationTranslator.getEndOffset(loc, fDocument));
config.put(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
config.put(IMarker.LOCATION, fFile.getFullPath().toString());
return config;
} catch (BadLocationException e) {
return _default(error);
}
}
@Override
public Map<String, Object> _case(SyntheticLoc loc) {
return _default(error);
}
});
}
/*
* Everything else, just put on the first line since we don't have any other information
*/
@Override
protected Map<String, Object> _default(SemanticError x) {
Map<String, Object> config = new HashMap<String, Object>();
MarkerUtilities.setLineNumber(config, 1);
// Need to implement the first, currently get a NotImplementedYet exception
MarkerUtilities.setMessage(
config,
PrinterUtil.INSTANCE.getFactory().userErrorPrinter()
.print(apexException.getError(), new PrintContext()));
// Not sure why there aren't any utilities methods for these fields in MarkerUtilities
// Set them directly instead.
config.put(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
config.put(IMarker.LOCATION, fFile.getFullPath().toString());