use of com.intellij.codeInspection.reference.UnusedDeclarationFixProvider in project intellij-community by JetBrains.
the class UnusedSymbolUtil method createUnusedSymbolInfo.
@Nullable
public static HighlightInfo createUnusedSymbolInfo(@NotNull PsiElement element, @NotNull String message, @NotNull final HighlightInfoType highlightInfoType) {
HighlightInfo info = HighlightInfo.newHighlightInfo(highlightInfoType).range(element).descriptionAndTooltip(message).create();
if (info == null) {
//filtered out
return null;
}
UnusedDeclarationFixProvider[] fixProviders = Extensions.getExtensions(UnusedDeclarationFixProvider.EP_NAME);
for (UnusedDeclarationFixProvider provider : fixProviders) {
IntentionAction[] fixes = provider.getQuickFixes(element);
for (IntentionAction fix : fixes) {
QuickFixAction.registerQuickFixAction(info, fix);
}
}
return info;
}
Aggregations