use of org.openide.cookies.LineCookie in project netbeans-php-enhancements by beberlei.
the class CodeSniffer method annotateWithCodingStandardHints.
private void annotateWithCodingStandardHints(FileObject fo, CodeSnifferXmlLogResult rs) {
CodeSnifferFileListener l = new CodeSnifferFileListener();
l.setLogResult(rs);
fo.addFileChangeListener(l);
try {
DataObject d = DataObject.find(fo);
LineCookie cookie = d.getCookie(LineCookie.class);
Line.Set lineSet = null;
Line line = null;
for (int i = 0; i < rs.getCsErrors().size(); i++) {
lineSet = cookie.getLineSet();
line = lineSet.getOriginal(rs.getCsErrors().get(i).getLineNum());
rs.getCsErrors().get(i).attach(line);
}
for (int i = 0; i < rs.getCsWarnings().size(); i++) {
lineSet = cookie.getLineSet();
line = lineSet.getOriginal(rs.getCsWarnings().get(i).getLineNum());
rs.getCsWarnings().get(i).attach(line);
}
} catch (DataObjectNotFoundException ex) {
Exceptions.printStackTrace(ex);
}
}
Aggregations