Search in sources :

Example 1 with UnusedImportProvider

use of com.intellij.codeInsight.daemon.UnusedImportProvider in project intellij-community by JetBrains.

the class PostHighlightingVisitor method isUnusedImportEnabled.

private boolean isUnusedImportEnabled(HighlightDisplayKey unusedImportKey) {
    InspectionProfile profile = InspectionProjectProfileManager.getInstance(myProject).getCurrentProfile();
    if (profile.isToolEnabled(unusedImportKey, myFile) && myFile instanceof PsiJavaFile && HighlightingLevelManager.getInstance(myProject).shouldInspect(myFile)) {
        return true;
    }
    final ImplicitUsageProvider[] implicitUsageProviders = Extensions.getExtensions(ImplicitUsageProvider.EP_NAME);
    for (ImplicitUsageProvider provider : implicitUsageProviders) {
        if (provider instanceof UnusedImportProvider && ((UnusedImportProvider) provider).isUnusedImportEnabled(myFile))
            return true;
    }
    return false;
}
Also used : UnusedImportProvider(com.intellij.codeInsight.daemon.UnusedImportProvider) InspectionProfile(com.intellij.codeInspection.InspectionProfile) ImplicitUsageProvider(com.intellij.codeInsight.daemon.ImplicitUsageProvider)

Aggregations

ImplicitUsageProvider (com.intellij.codeInsight.daemon.ImplicitUsageProvider)1 UnusedImportProvider (com.intellij.codeInsight.daemon.UnusedImportProvider)1 InspectionProfile (com.intellij.codeInspection.InspectionProfile)1