public int getLineNumber() { if (!diagnostic.getData().isEmpty()) { if (diagnostic.getData().get(0) instanceof SAXParseException) { return ((SAXParseException) diagnostic.getData().get(0)).getLineNumber(); } if (diagnostic.getData().get(0) instanceof Resource.Diagnostic) { return ((Resource.Diagnostic) diagnostic.getData().get(0)).getLine(); } } return -1; } }
/** * Returns a string representation of the given diagnostic object. * * @param diagnostic * The diagnostic * @return a string representation of the given diagnostic object. */ private static String diagnosticString(Diagnostic diagnostic) { StringBuffer buffer = new StringBuffer(); buffer.append(AcceleoCommonMessages .getString("ModelUtils.DiagnosticMessage", diagnostic.getMessage())); //$NON-NLS-1$ buffer.append('\n'); buffer.append(AcceleoCommonMessages.getString("ModelUtils.DiagnosticLocation", diagnostic //$NON-NLS-1$ .getLocation(), Integer.valueOf(diagnostic.getLine()), Integer .valueOf(diagnostic.getColumn()))); return buffer.toString(); }
.append(MessageFormat.format("[{0},{1}]: {2}\n", Integer.toString(diagnostic.getLine()), Integer.toString(diagnostic.getColumn()), diagnostic.getMessage()));
.append(MessageFormat.format("[{0},{1}]: {2}\n", Integer.toString(diagnostic.getLine()), Integer.toString(diagnostic.getColumn()), diagnostic.getMessage()));
public void convertResourceDiagnostic(Diagnostic diagnostic, Severity severity, IAcceptor<Issue> acceptor) { IssueImpl issue = new Issue.IssueImpl(); issue.setSyntaxError(diagnostic instanceof XtextSyntaxDiagnostic); issue.setSeverity(severity); issue.setLineNumber(diagnostic.getLine()); issue.setMessage(diagnostic.getMessage()); // issue.setmarker.put(IMarker.PRIORITY, Integer.valueOf(IMarker.PRIORITY_LOW)); if (diagnostic instanceof org.eclipse.xtext.diagnostics.Diagnostic) { org.eclipse.xtext.diagnostics.Diagnostic xtextDiagnostic = (org.eclipse.xtext.diagnostics.Diagnostic) diagnostic; issue.setOffset(xtextDiagnostic.getOffset()); issue.setLength(xtextDiagnostic.getLength()); } if (diagnostic instanceof AbstractDiagnostic) { AbstractDiagnostic castedDiagnostic = (AbstractDiagnostic)diagnostic; issue.setUriToProblem(castedDiagnostic.getUriToProblem()); issue.setCode(castedDiagnostic.getCode()); issue.setData(castedDiagnostic.getData()); } issue.setType(CheckType.FAST); acceptor.accept(issue); }