Java Code Examples for org.netbeans.modules.csl.spi.ParserResult#getDiagnostics()

The following examples show how to use org.netbeans.modules.csl.spi.ParserResult#getDiagnostics() . 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: CSSUpdaterTask.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private boolean hasFatalErrors(ParserResult result) {
    for (org.netbeans.modules.csl.api.Error err : result.getDiagnostics()) {
        if (err.getSeverity() == Severity.FATAL) {
            return true;
        }
    }
    return false;
}
 
Example 2
Source File: GsfHintsProvider.java    From netbeans with Apache License 2.0 5 votes vote down vote up
void processErrors(final Snapshot snapshot, final ParserResult result,
        Document doc,
        final List<ErrorDescription> descriptions, 
        Snapshot topLevelSnapshot) throws ParseException {

    if (doc == null) {
        doc = getDocument();
    }
    
    Language language = LanguageRegistry.getInstance().getLanguageByMimeType(snapshot.getMimeType());
    if (language == null) {
        return;
    }
    if(!(result instanceof ParserResult)) {
        return ;
    }

    ParserResult r = (ParserResult)result;
    List<? extends Error> errors = r.getDiagnostics();
    List<ErrorDescription> desc = new ArrayList<ErrorDescription>();
    List<Error> unhandled = processProviderErrors(descriptions, topLevelSnapshot, r, language);
    if (unhandled != null) {
        errors = unhandled;
    }
    // Process errors without codes
    desc = computeErrors(doc, r, errors, desc);
    if (desc == null) {
        //meaning: cancelled
        return;
    }

    descriptions.addAll(desc);
}
 
Example 3
Source File: GsfFoldManager.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static boolean hasErrors(ParserResult r) {
    for(org.netbeans.modules.csl.api.Error e : r.getDiagnostics()) {
        if (e.getSeverity() == Severity.FATAL) {
            return true;
        }
    }
    return false;
}
 
Example 4
Source File: CssErrorFilterFactory.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public List<? extends Error> filter(ParserResult parserResult) {
    if(parserResult instanceof CssParserResult) {
        List<? extends FilterableError> extendedDiagnostics = ((CssParserResult)parserResult).getDiagnostics();
        List<Error> kept = new ArrayList<>();
        for(FilterableError fe : extendedDiagnostics) {
            if(!fe.isFiltered()) {
                kept.add(fe);
            }
        }
        return kept;
    }
    return parserResult.getDiagnostics();
}