use of com.intellij.codeInsight.daemon.impl.HighlightInfoType in project intellij-community by JetBrains.
the class HighlightUtil method checkUnhandledCloserExceptions.
@Nullable
static HighlightInfo checkUnhandledCloserExceptions(@NotNull PsiResourceListElement resource) {
List<PsiClassType> unhandled = ExceptionUtil.getUnhandledCloserExceptions(resource, null);
if (unhandled.isEmpty())
return null;
HighlightInfoType highlightType = getUnhandledExceptionHighlightType(resource);
if (highlightType == null)
return null;
String description = getUnhandledExceptionsDescriptor(unhandled, "auto-closeable resource");
HighlightInfo highlight = HighlightInfo.newHighlightInfo(highlightType).range(resource).descriptionAndTooltip(description).create();
registerUnhandledExceptionFixes(resource, highlight, unhandled);
return highlight;
}
use of com.intellij.codeInsight.daemon.impl.HighlightInfoType in project intellij-community by JetBrains.
the class ProblemDescriptorUtil method highlightTypeFromDescriptor.
@NotNull
public static HighlightInfoType highlightTypeFromDescriptor(@NotNull ProblemDescriptor problemDescriptor, @NotNull HighlightSeverity severity, @NotNull SeverityRegistrar severityRegistrar) {
final ProblemHighlightType highlightType = problemDescriptor.getHighlightType();
final HighlightInfoType highlightInfoType = getHighlightInfoType(highlightType, severity, severityRegistrar);
if (highlightInfoType == HighlightSeverity.INFORMATION) {
final TextAttributesKey attributes = ((ProblemDescriptorBase) problemDescriptor).getEnforcedTextAttributes();
if (attributes != null) {
return new HighlightInfoType.HighlightInfoTypeImpl(HighlightSeverity.INFORMATION, attributes);
}
}
return highlightInfoType;
}
use of com.intellij.codeInsight.daemon.impl.HighlightInfoType in project intellij-community by JetBrains.
the class ApplicationInspectionProfileManager method registerProvidedSeverities.
// It should be public to be available from Upsource
public static void registerProvidedSeverities() {
for (SeveritiesProvider provider : Extensions.getExtensions(SeveritiesProvider.EP_NAME)) {
for (HighlightInfoType t : provider.getSeveritiesHighlightInfoTypes()) {
HighlightSeverity highlightSeverity = t.getSeverity(null);
SeverityRegistrar.registerStandard(t, highlightSeverity);
TextAttributesKey attributesKey = t.getAttributesKey();
Icon icon = t instanceof HighlightInfoType.Iconable ? ((HighlightInfoType.Iconable) t).getIcon() : null;
HighlightDisplayLevel.registerSeverity(highlightSeverity, attributesKey, icon);
}
}
}
use of com.intellij.codeInsight.daemon.impl.HighlightInfoType in project intellij-community by JetBrains.
the class LevelChooserAction method createPopupActionGroup.
@NotNull
@Override
public DefaultActionGroup createPopupActionGroup(final JComponent anchor) {
final DefaultActionGroup group = new DefaultActionGroup();
for (final HighlightSeverity severity : getSeverities(mySeverityRegistrar, myIncludeDoNotShow)) {
final HighlightSeverityAction action = new HighlightSeverityAction(severity);
if (myChosen == null) {
setChosen(action.getSeverity());
}
group.add(action);
}
group.addSeparator();
group.add(new DumbAwareAction("Edit severities...") {
@Override
public void actionPerformed(@NotNull final AnActionEvent e) {
final SeverityEditorDialog dlg = new SeverityEditorDialog(anchor, myChosen, mySeverityRegistrar, true);
if (dlg.showAndGet()) {
final HighlightInfoType type = dlg.getSelectedType();
if (type != null) {
final HighlightSeverity severity = type.getSeverity(null);
setChosen(severity);
onChosen(severity);
}
}
}
});
return group;
}
use of com.intellij.codeInsight.daemon.impl.HighlightInfoType in project intellij-community by JetBrains.
the class GeneralColorsPage method getCustomSeveritiesDemoText.
private static String getCustomSeveritiesDemoText() {
final StringBuilder buff = new StringBuilder();
for (SeveritiesProvider provider : Extensions.getExtensions(SeveritiesProvider.EP_NAME)) {
for (HighlightInfoType highlightInfoType : provider.getSeveritiesHighlightInfoTypes()) {
final String tag = getHighlightDescTagName(highlightInfoType);
buff.append(" <").append(tag).append(">");
buff.append(tag.toLowerCase());
buff.append("</").append(tag).append(">").append("\n");
}
}
return buff.toString();
}
Aggregations