• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Severity类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.netbeans.modules.csl.api.Severity的典型用法代码示例。如果您正苦于以下问题:Java Severity类的具体用法?Java Severity怎么用?Java Severity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Severity类属于org.netbeans.modules.csl.api包,在下文中一共展示了Severity类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: DefaultError

import org.netbeans.modules.csl.api.Severity; //导入依赖的package包/类
/** Creates a new instance of DefaultError */
public DefaultError(
        @NullAllowed String key,
        @NonNull String displayName, 
        @NullAllowed String description,
        @NonNull FileObject file, 
        @NonNull int start, 
        @NonNull int end,
        boolean lineError,
        @NonNull Severity severity) {
    this.key = key;
    this.displayName = displayName;
    this.description = description;
    this.file = file;
    this.start = start;
    this.end = end;
    this.lineError = lineError;
    this.severity = severity;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:DefaultError.java


示例2: forProblemType

import org.netbeans.modules.csl.api.Severity; //导入依赖的package包/类
private static Severity forProblemType(int problemtype) {
    switch (problemtype) {
        case ProblemDescription.INFORMATION:
            return Severity.INFO;
        case ProblemDescription.WARNING:
            return Severity.WARNING;
        case ProblemDescription.ERROR:
            return Severity.ERROR;
        case ProblemDescription.FATAL:
            return Severity.FATAL;
        case ProblemDescription.INTERNAL_ERROR:
            return Severity.INFO;
        default:
            throw new IllegalArgumentException("Invalid ProblemDescription type: " + problemtype); //NOI18N
    }

}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:HtmlParserResult.java


示例3: createDefaultError

import org.netbeans.modules.csl.api.Severity; //导入依赖的package包/类
public static Error createDefaultError(@NullAllowed String key,
        @NonNull String displayName,
        @NullAllowed String description,
        @NonNull FileObject file,
        @NonNull int start,
        @NonNull int end,
        boolean lineError,
        @NonNull Severity severity) {
    return new DefaultError(key, displayName, description, file, start, end, lineError, severity);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:DefaultError.java


示例4: hasErrors

import org.netbeans.modules.csl.api.Severity; //导入依赖的package包/类
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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:GsfFoldManager.java


示例5: getKind

import org.netbeans.modules.csl.api.Severity; //导入依赖的package包/类
@Override
public ErrorKind getKind(SimpleError error) {
    if (error.getSeverity() == Severity.WARNING) {
        return ErrorKind.WARNING;
    } else if (error.isBadging()) {
            return ErrorKind.ERROR;
        } else {
            return ErrorKind.ERROR_NO_BADGE;
        }
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:TLIndexerFactory.java


示例6: SimpleError

import org.netbeans.modules.csl.api.Severity; //导入依赖的package包/类
public SimpleError(String displayName, String description, int startPosition, Severity severity, boolean isBadging) {
    this.displayName = displayName;
    this.description = description;
    this.startPosition = startPosition;
    this.severity = severity;
    this.isBadging = isBadging;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:TLIndexerFactory.java


示例7: resultForTooLargeFile

import org.netbeans.modules.csl.api.Severity; //导入依赖的package包/类
private YamlParserResult resultForTooLargeFile(Snapshot snapshot) {
    YamlParserResult result = new YamlParserResult(Collections.<Node>emptyList(), this, snapshot, false, null, null);
    // FIXME this can violate contract of DefaultError (null fo)
    DefaultError error = new DefaultError(null, NbBundle.getMessage(YamlParser.class, "TooLarge"), null,
            snapshot.getSource().getFileObject(), 0, 0, Severity.WARNING);
    result.addError(error);
    return result;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:YamlParser.java


示例8: getCslSeverityForCss3ProblemType

import org.netbeans.modules.csl.api.Severity; //导入依赖的package包/类
private static Severity getCslSeverityForCss3ProblemType(ProblemDescription.Type problemType) {
    switch (problemType) {
        case ERROR:
            return Severity.ERROR;
        case FATAL:
            return Severity.FATAL;
        case INFO:
            return Severity.INFO;
        case WARNING:
            return Severity.WARNING;
    }

    return Severity.ERROR;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:DefaultErrorsProvider.java


示例9: getCssRule

import org.netbeans.modules.csl.api.Severity; //导入依赖的package包/类
private static CssRule getCssRule(Severity s) {
    switch (s) {
        case WARNING:
            return WARNING_RULE;
        case ERROR:
            return ERROR_RULE;
        default:
            throw new AssertionError("Unexpected severity level"); //NOI18N
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:CssHintsProvider.java


示例10: makeError

import org.netbeans.modules.csl.api.Severity; //导入依赖的package包/类
private static FilterableError makeError(int astFrom, int astTo, Snapshot snapshot, String key, String displayName, String description, boolean lineError, Severity severity) {
    assert astFrom <= astTo;

    return CssErrorFactory.createError(key,
            displayName,
            description,
            snapshot.getSource().getFileObject(),
            astFrom,
            astTo,
            lineError,
            severity);

}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:CssAnalyser.java


示例11: HtmlRuleContext

import org.netbeans.modules.csl.api.Severity; //导入依赖的package包/类
public HtmlRuleContext(HtmlParserResult parserResult, SyntaxAnalyzerResult syntaxAnalyzerResult, List<HintFix> defaultFixes) {
    this.parserResult = parserResult;
    this.syntaxAnalyzerResult = syntaxAnalyzerResult;
    this.defaultFixes = defaultFixes;
    this.leftDiagnostics = new ArrayList<>(parserResult.getDiagnostics(EnumSet.allOf(Severity.class)));
    this.lines = new Lines(parserResult.getSnapshot().getText());
    this.linesWithHints = new HashSet<>();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:HtmlRuleContext.java


示例12: getDiagnostics

import org.netbeans.modules.csl.api.Severity; //导入依赖的package包/类
@Override
public List<? extends Error> getDiagnostics() {
    //provide the validator errors to the parser results' diagnostic only 
    //if they really are severe and *real* errors, e.g. only fatal errors and
    //not in embedded html
    return getSnapshot().getMimePath().size() == 1 
            ? getDiagnostics(EnumSet.of(Severity.FATAL))
            : Collections.<Error>emptyList();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:HtmlParserResult.java


示例13: testPatterns

import org.netbeans.modules.csl.api.Severity; //导入依赖的package包/类
public void testPatterns() {
        String str = "Error: Quirky doctype. Expected \"<!DOCTYPE html>\".\n"
                + "From line 4, column 4; to line 5, column 16\n\n";
//        for(int i = 0; i < str.length(); i++) {
//            System.out.println(str.charAt(i) + " -> " + Integer.toHexString(str.charAt(i)));
//        }
        Error e = new DefaultError(null, null, str, null, -1, -1, Severity.WARNING);
        PatternRule rule = new Doctype();
        
        assertTrue(rule.appliesTo(null, e));
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:DoctypeTest.java


示例14: testPatterns

import org.netbeans.modules.csl.api.Severity; //导入依赖的package包/类
public void testPatterns() {
        String str = "Warning: Using \"windows-1252\" instead of the declared encoding \"iso-8859-1\".\n\n";
//        for(int i = 0; i < str.length(); i++) {
//            System.out.println(str.charAt(i) + " -> " + Integer.toHexString(str.charAt(i)));
//        }
        Error e = new DefaultError(null, null, str, null, -1, -1, Severity.WARNING);
        Encoding rule = new Encoding();
        
        assertTrue(rule.appliesTo(null, e));
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:EncodingTest.java


示例15: RoutesParsingError

import org.netbeans.modules.csl.api.Severity; //导入依赖的package包/类
private RoutesParsingError(RoutesErrorEnum errorEnum, Severity severity,
        int startPostion, int endPosition) {
    this.errorEnum = errorEnum;
    this.severity = severity;
    this.startPosition = startPostion;
    this.endPosition = endPosition;
}
 
开发者ID:pedrohidalgo,项目名称:pleasure,代码行数:8,代码来源:RoutesParsingError.java


示例16: getNewError

import org.netbeans.modules.csl.api.Severity; //导入依赖的package包/类
public static RoutesParsingError getNewError(RoutesErrorEnum errorEnum,
        int startPosition, int endPosition, Severity severity) {
    RoutesParsingError error = new RoutesParsingError(
            errorEnum, severity, startPosition, endPosition);

    return error;
}
 
开发者ID:pedrohidalgo,项目名称:pleasure,代码行数:8,代码来源:RoutesParsingError.java


示例17: validateFile

import org.netbeans.modules.csl.api.Severity; //导入依赖的package包/类
public static List<RoutesParsingError> validateFile(Document document) {
        List<RoutesParsingError> listErrors = new ArrayList<>();
        try {
            String fileContent = document.getText(0, document.getLength());

            List<String> lines = MiscUtil.getLinesFromFileContent(fileContent);

            lines.stream()
                    .map(line -> line.trim())
                    .filter(line -> !line.isEmpty()
                            && !line.startsWith(RoutesLanguageHelper.COMMENT_SYMBOL))
                    .forEach(line -> {
                        RoutesLineParsedDTO lineParsedDTO = RoutesLanguageHelper.divideLineInColumns(line);

                        if (lineParsedDTO.isCorrect()) {

                            listErrors.addAll(validateHttpMethod(fileContent, line, lineParsedDTO.httpMethod));

                            listErrors.addAll(validateURL(fileContent, line, lineParsedDTO.url));
//
                            listErrors.addAll(validateMethod(document, line, lineParsedDTO.method));

                        } else {
                            int startPosition = fileContent.indexOf(line);
                            int endPosition = startPosition + line.length();
                            RoutesParsingError error = RoutesParsingError.getNewError(
                                    RoutesErrorEnum.BAD_LINE,
                                    startPosition, endPosition, Severity.ERROR);

                            listErrors.add(error);
                        }

                    });

        } catch (BadLocationException ex) {
            ExceptionManager.logException(ex);
        }
        return listErrors;
    }
 
开发者ID:pedrohidalgo,项目名称:pleasure,代码行数:40,代码来源:RoutesValidator.java


示例18: validateHttpMethod

import org.netbeans.modules.csl.api.Severity; //导入依赖的package包/类
public static List<RoutesParsingError> validateHttpMethod(String fileContent, String line, String httpMethod) {
    List<RoutesParsingError> listErrors = new ArrayList<>();
    boolean isHttpMethodValid = RoutesLanguageHelper.getHttpMethods().stream()
            .anyMatch(w3cHttpMethod -> w3cHttpMethod.equals(httpMethod));

    if (!isHttpMethodValid) {
        int startPosition = MiscUtil.getStartPosition(fileContent, line, httpMethod);
        listErrors.add(RoutesParsingError.getNewError(
                RoutesErrorEnum.HTTP_METHOD_ERROR, startPosition, startPosition + httpMethod.length(), Severity.ERROR));
    }

    return listErrors;
}
 
开发者ID:pedrohidalgo,项目名称:pleasure,代码行数:14,代码来源:RoutesValidator.java


示例19: validateURL

import org.netbeans.modules.csl.api.Severity; //导入依赖的package包/类
public static List<RoutesParsingError> validateURL(String fileContent, String line, String url) {
    List<RoutesParsingError> listErrors = new ArrayList<>();
    boolean urlStartCorrect = url.startsWith(RoutesLanguageHelper.URL_START_SYMBOL);

    if (!urlStartCorrect) {
        int startPosition = MiscUtil.getStartPosition(fileContent, line, url);
        listErrors.add(RoutesParsingError.getNewError(
                RoutesErrorEnum.URL_START_INCORRECT_ERROR, startPosition, startPosition + url.length(), Severity.ERROR));
    }

    return listErrors;
}
 
开发者ID:pedrohidalgo,项目名称:pleasure,代码行数:13,代码来源:RoutesValidator.java


示例20: validateMethodStartWithInvalidCharacter

import org.netbeans.modules.csl.api.Severity; //导入依赖的package包/类
public static Optional<RoutesParsingError> validateMethodStartWithInvalidCharacter(
        String fileContent, String line, String method) {
    boolean methodStartWithInvalidChar = INVALID_CHARS_FOR_METHOD.chars().anyMatch(ch
            -> method.startsWith(Character.toString((char) ch)));

    if (methodStartWithInvalidChar) {
        int startPosition = MiscUtil.getStartPosition(fileContent, line, method);
        return Optional.of(RoutesParsingError.getNewError(
                RoutesErrorEnum.METHOD_START_WITH_INVALID_CHAR, startPosition, startPosition + method.length(), Severity.ERROR));
    } else {
        return Optional.empty();
    }

}
 
开发者ID:pedrohidalgo,项目名称:pleasure,代码行数:15,代码来源:RoutesValidator.java



注:本文中的org.netbeans.modules.csl.api.Severity类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java OSMXBean类代码示例发布时间:2022-05-23
下一篇:
Java KillApplicationResponseProtoOrBuilder类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap