Add read action to definition searcher
This commit is contained in:
+12
-1
@@ -59,7 +59,8 @@ public class KotlinDefinitionsSearcher implements QueryExecutor<PsiElement, Defi
|
|||||||
|
|
||||||
if (element instanceof KtParameter) {
|
if (element instanceof KtParameter) {
|
||||||
KtParameter parameter = (KtParameter) element;
|
KtParameter parameter = (KtParameter) element;
|
||||||
if (KtPsiUtil.getClassIfParameterIsProperty(parameter) != null) {
|
|
||||||
|
if (isFieldParameter(parameter)) {
|
||||||
return processPropertyImplementations((KtParameter) element, scope, consumer);
|
return processPropertyImplementations((KtParameter) element, scope, consumer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -84,6 +85,16 @@ public class KotlinDefinitionsSearcher implements QueryExecutor<PsiElement, Defi
|
|||||||
return element instanceof KtLightMethod && ((KtLightMethod) element).isDelegated();
|
return element instanceof KtLightMethod && ((KtLightMethod) element).isDelegated();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean isFieldParameter(final KtParameter parameter) {
|
||||||
|
return ApplicationManager.getApplication().runReadAction(
|
||||||
|
new Computable<Boolean>() {
|
||||||
|
@Override
|
||||||
|
public Boolean compute() {
|
||||||
|
return KtPsiUtil.getClassIfParameterIsProperty(parameter) != null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private static boolean processClassImplementations(@NotNull final KtClass klass, Processor<PsiElement> consumer) {
|
private static boolean processClassImplementations(@NotNull final KtClass klass, Processor<PsiElement> consumer) {
|
||||||
PsiClass psiClass = ApplicationManager.getApplication().runReadAction(new Computable<PsiClass>() {
|
PsiClass psiClass = ApplicationManager.getApplication().runReadAction(new Computable<PsiClass>() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user