IDEA-154816 Do not show "Select classes to import" when "Add imports on the fly" is enabled

This commit is contained in:
peter
2016-05-02 08:58:56 +02:00
parent 905527c804
commit e437ec5142
@@ -15,6 +15,8 @@
*/
package com.intellij.codeInsight.editorActions;
import com.intellij.codeInsight.CodeInsightSettings;
import com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFix;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.RangeMarker;
import com.intellij.openapi.util.TextRange;
@@ -100,6 +102,16 @@ public class JavaCopyPasteReferenceProcessor extends CopyPasteReferenceProcessor
}
}
}
if (CodeInsightSettings.getInstance().ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY) {
for (int i = 0; i < refs.length; i++) {
PsiJavaCodeReferenceElement ref = refs[i];
if (ref != null && new ImportClassFix(ref).getClassesToImport().size() <= 1) {
refs[i] = null;
}
}
}
return refs;
}