Java Code Examples for org.eclipse.wst.validation.internal.operations.LocalizedMessage#setLength()
The following examples show how to use
org.eclipse.wst.validation.internal.operations.LocalizedMessage#setLength() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TypeScriptReporterCollector.java From typescript.java with MIT License | 6 votes |
@Override public void addError(String file, Location startLoc, Location endLoc, Severity severity, String code, String failure) { IResource resource = tsFile.getResource(); int start = startLoc.getPosition(); int end = endLoc.getPosition(); if (start == end) { if (start == 0) { end = 1; } else { start = start - 1; } } // TODO: severity // String severity = null; LocalizedMessage message = new LocalizedMessage(getSeverity(severity), failure, resource); message.setOffset(start); message.setLength(end - start); message.setAttribute(CHAR_START, start); message.setAttribute(CHAR_END, end); message.setLineNo(startLoc.getLine()); reporter.addMessage(validator, message); }
Example 2
Source File: TypeScriptReporterCollector.java From typescript.java with MIT License | 5 votes |
public void addDiagnostic(String event, String file, String text, int startLine, int startOffset, int endLine, int endOffset, DiagnosticCategory category, Integer code) { try { IIDETypeScriptFile tsFile = file != null ? (IIDETypeScriptFile) this.tsFile.getProject().getOpenedFile(file) : this.tsFile; IResource resource = tsFile.getResource(); int start = tsFile.getPosition(startLine, startOffset); int end = tsFile.getPosition(endLine, endOffset); if (start == end) { if (start == 0) { end = 1; } else { start = start - 1; } } LocalizedMessage message = new LocalizedMessage(getSeverity(category), text, resource); message.setOffset(start); message.setLength(end - start); message.setAttribute(CHAR_START, start); message.setAttribute(CHAR_END, end); message.setLineNo(startLine - 1); if (code != null) { message.setAttribute("tsCode", code); } reporter.addMessage(validator, message); } catch (TypeScriptException e) { Trace.trace(Trace.SEVERE, "Error while reporting error", e); } }