CR-IA-226 ImportFilter: make targetFile parameter not null

This commit is contained in:
Eugene Kudelevsky
2014-02-05 18:03:42 +04:00
parent 06fb88cf8d
commit bd2fcae8c9
2 changed files with 3 additions and 4 deletions
@@ -121,7 +121,7 @@ public abstract class ImportClassFixBase<T extends PsiElement, R extends PsiRefe
String qName = aClass.getQualifiedName();
if (qName != null) { //filter local classes
if (qName.indexOf('.') == -1) continue; //do not show classes from default package)
if (qName.endsWith(name) && ImportFilter.shouldImport(file, qName)) {
if (qName.endsWith(name) && (file == null || ImportFilter.shouldImport(file, qName))) {
if (isAccessible(aClass, myElement)) {
classList.add(aClass);
}
@@ -3,7 +3,6 @@ package com.intellij.codeInsight;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.psi.PsiFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* @author Eugene.Kudelevsky
@@ -11,9 +10,9 @@ import org.jetbrains.annotations.Nullable;
public abstract class ImportFilter {
public static final ExtensionPointName<ImportFilter> EP_NAME = new ExtensionPointName<ImportFilter>("com.intellij.importFilter");
public abstract boolean shouldUseFullyQualifiedName(@Nullable PsiFile targetFile, @NotNull String classQualifiedName);
public abstract boolean shouldUseFullyQualifiedName(@NotNull PsiFile targetFile, @NotNull String classQualifiedName);
public static boolean shouldImport(@Nullable PsiFile targetFile, @NotNull String classQualifiedName) {
public static boolean shouldImport(@NotNull PsiFile targetFile, @NotNull String classQualifiedName) {
for (ImportFilter filter : EP_NAME.getExtensions()) {
if (filter.shouldUseFullyQualifiedName(targetFile, classQualifiedName)) {
return false;