IDEA-121784 (Add on demand static import intention not available when single-member static import present)

This commit is contained in:
Bas Leijdekkers
2014-03-07 16:54:17 +01:00
parent 8853670af1
commit b52ec5f33f
3 changed files with 20 additions and 0 deletions
@@ -78,6 +78,7 @@ public class AddOnDemandStaticImportAction extends BaseElementAtCaretIntentionAc
PsiImportList importList = ((PsiJavaFile)file).getImportList();
if (importList == null) return null;
for (PsiImportStaticStatement statement : importList.getImportStaticStatements()) {
if (!statement.isOnDemand()) continue;
PsiClass staticResolve = statement.resolveTargetClass();
if (psiClass == staticResolve) return null; //already imported
}
@@ -0,0 +1,10 @@
// "Add on demand static import for 'java.lang.Math'" "true"
package test;
import static java.lang.Math.*;
import static java.lang.Math.abs;
public class C {{
abs(1.0);
max(1, 2);
}}
@@ -0,0 +1,9 @@
// "Add on demand static import for 'java.lang.Math'" "true"
package test;
import static java.lang.Math.abs;
public class C {{
abs(1.0);
<caret>Math.max(1, 2);
}}