mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
following IDEA-CR-7943
This commit is contained in:
+1
-1
@@ -58,7 +58,7 @@ public class StaticImportConstantFix extends StaticImportMemberFix<PsiField> {
|
||||
final PsiJavaCodeReferenceElement element = myRef.getElement();
|
||||
String name = element != null ? element.getReferenceName() : null;
|
||||
if (name == null) return Collections.emptyList();
|
||||
final MyStaticMembersProcessor<PsiField> processor = new MyStaticMembersProcessor<PsiField>(element) {
|
||||
final StaticMembersProcessor<PsiField> processor = new StaticMembersProcessor<PsiField>(element) {
|
||||
@Override
|
||||
protected boolean isApplicable(PsiField field, PsiElement place) {
|
||||
final PsiType expectedType = getExpectedType();
|
||||
|
||||
+2
-1
@@ -23,6 +23,7 @@ import com.intellij.codeInsight.hint.HintManager;
|
||||
import com.intellij.codeInsight.hint.QuestionAction;
|
||||
import com.intellij.codeInsight.intention.IntentionAction;
|
||||
import com.intellij.codeInspection.HintAction;
|
||||
import com.intellij.lang.java.JavaLanguage;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.impl.LaterInvocator;
|
||||
import com.intellij.openapi.command.CommandProcessor;
|
||||
@@ -67,7 +68,7 @@ public abstract class StaticImportMemberFix<T extends PsiMember> implements Inte
|
||||
@Override
|
||||
public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
|
||||
return PsiUtil.isLanguageLevel5OrHigher(file)
|
||||
&& file instanceof PsiJavaFile
|
||||
&& file.getLanguage().isKindOf(JavaLanguage.INSTANCE)
|
||||
&& getElement() != null
|
||||
&& getElement().isValid()
|
||||
&& getQualifierExpression() == null
|
||||
|
||||
+2
-2
@@ -62,7 +62,7 @@ public class StaticImportMethodFix extends StaticImportMemberFix<PsiMethod> {
|
||||
PsiReferenceExpression reference = element == null ? null : element.getMethodExpression();
|
||||
String name = reference == null ? null : reference.getReferenceName();
|
||||
if (name == null) return Collections.emptyList();
|
||||
final MyStaticMembersProcessor<PsiMethod> processor = new MyStaticMethodProcessor(project, element);
|
||||
final StaticMembersProcessor<PsiMethod> processor = new MyStaticMethodProcessor(project, element);
|
||||
cache.processMethodsWithName(name, element.getResolveScope(), processor);
|
||||
return processor.getMembersToImport(applicableOnly);
|
||||
}
|
||||
@@ -97,7 +97,7 @@ public class StaticImportMethodFix extends StaticImportMemberFix<PsiMethod> {
|
||||
return methodCallExpression != null ? methodCallExpression.resolveMethod() : null;
|
||||
}
|
||||
|
||||
private static class MyStaticMethodProcessor extends MyStaticMembersProcessor<PsiMethod> {
|
||||
private static class MyStaticMethodProcessor extends StaticMembersProcessor<PsiMethod> {
|
||||
|
||||
private MyStaticMethodProcessor(Project project, PsiMethodCallExpression place) {
|
||||
super(place);
|
||||
|
||||
+2
-2
@@ -29,7 +29,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
abstract class MyStaticMembersProcessor<T extends PsiMember> implements Processor<T> {
|
||||
abstract class StaticMembersProcessor<T extends PsiMember> implements Processor<T> {
|
||||
private final MultiMap<PsiClass, T> myDeprecated = new LinkedMultiMap<PsiClass, T>();
|
||||
private final MultiMap<PsiClass, T> mySuggestions = new LinkedMultiMap<PsiClass, T>();
|
||||
|
||||
@@ -38,7 +38,7 @@ abstract class MyStaticMembersProcessor<T extends PsiMember> implements Processo
|
||||
private final PsiElement myPlace;
|
||||
private PsiType myExpectedType;
|
||||
|
||||
protected MyStaticMembersProcessor(PsiElement place) {
|
||||
protected StaticMembersProcessor(PsiElement place) {
|
||||
myPlace = place;
|
||||
myExpectedType = PsiType.NULL;
|
||||
}
|
||||
Reference in New Issue
Block a user