mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
[groovy] fix INRE by doing nothing in dumb mode (IDEA-152776)
This commit is contained in:
+6
-10
@@ -20,6 +20,7 @@ import com.intellij.debugger.engine.evaluation.TextWithImports;
|
||||
import com.intellij.debugger.engine.evaluation.expression.EvaluatorBuilder;
|
||||
import com.intellij.debugger.engine.evaluation.expression.EvaluatorBuilderImpl;
|
||||
import com.intellij.openapi.fileTypes.LanguageFileType;
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
@@ -334,16 +335,11 @@ public class GroovyCodeFragmentFactory extends CodeFragmentFactory {
|
||||
|
||||
@Override
|
||||
public boolean isContextAccepted(PsiElement context) {
|
||||
if (context != null) {
|
||||
if (context.getLanguage().equals(GroovyLanguage.INSTANCE)) {
|
||||
return true;
|
||||
}
|
||||
if (JavaPsiFacade.getInstance(context.getProject())
|
||||
.findClass("org.codehaus.groovy.control.CompilationUnit", context.getResolveScope()) != null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
if (context == null) return false;
|
||||
if (context.getLanguage().equals(GroovyLanguage.INSTANCE)) return true;
|
||||
Project project = context.getProject();
|
||||
if (DumbService.isDumb(project)) return false;
|
||||
return JavaPsiFacade.getInstance(project).findClass("org.codehaus.groovy.control.CompilationUnit", context.getResolveScope()) != null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
Reference in New Issue
Block a user