Search in sources :

Example 1 with LineCookie

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);
    }
}
Also used : Line(org.openide.text.Line) LineCookie(org.openide.cookies.LineCookie) DataObject(org.openide.loaders.DataObject) DataObjectNotFoundException(org.openide.loaders.DataObjectNotFoundException)

Aggregations

LineCookie (org.openide.cookies.LineCookie)1 DataObject (org.openide.loaders.DataObject)1 DataObjectNotFoundException (org.openide.loaders.DataObjectNotFoundException)1 Line (org.openide.text.Line)1