Create new severity for inspection
Hello,
I'm trying to create a new severity for my inspection.
Here is the code:
It creates a new severity, I can see it under Errors tab in Settings. I can even modify colors and all that. But if I open a file, I get this stack trace:
What am I doing wrong? What is the correct way to register a new severity?
Thanks.
-Sergiy
Please sign in to leave a comment.
Creating a new severity programmatically is impossible currently:
http://www.jetbrains.net/jira/browse/IDEA-14589
Bas
Have you tried to set order of severities?
This version seems to work:
severites = new ArrayList(); for(int i = 0; i < severityRegistrar.getSeveritiesCount(); i++){ severites.add(severityRegistrar.getSeverityByIndex(i).myName); } TextAttributes warningTextAttr = CodeInsightColors.WARNINGS_ATTRIBUTES.getDefaultAttributes(); HighlightInfoType.HighlightInfoTypeImpl hiti = new HighlightInfoType.HighlightInfoTypeImpl(SPELLING, CodeInsightColors.WARNINGS_ATTRIBUTES); if (warningTextAttr != null) { SeverityRegistrar.SeverityBasedTextAttributes attributes = new SeverityRegistrar.SeverityBasedTextAttributes(warningTextAttr, hiti); severityRegistrar.registerSeverity(attributes, Color.YELLOW); severites.add(SPELLING.myName); severityRegistrar.setOrder(severites); } } } ]]>Cool, thanks.
Bas