void (@NotNull UastCodeGenerationPlugin plugin, @NotNull PsiElement element) { var refProcessor = new PsiRecursiveElementWalkingVisitor() { final List<UReferenceExpression> list = new ArrayList<>(); @Override public void visitElement(@NotNull PsiElement element) { super.visitElement(element); ContainerUtil.addIfNotNull(list, UastContextKt.toUElement(element, UReferenceExpression.class)); } }; element.accept(refProcessor); for (UReferenceExpression expression : refProcessor.list) { if (expression.isPsiValid()) { plugin.shortenReference(expression); } } var staticImportProcessor = new PsiRecursiveElementWalkingVisitor() { final List<UQualifiedReferenceExpression> list = new ArrayList<>(); @Override public void visitElement(@NotNull PsiElement element) { super.visitElement(element); UQualifiedReferenceExpression expression = UastContextKt.toUElement(element, UQualifiedReferenceExpression.class); if (expression != null && expression.getReceiver() instanceof UReferenceExpression qualifier) { PsiElement target = qualifier.resolve(); if (target instanceof PsiClass cls && OPT_PANE.equals(cls.getQualifiedName())) { list.add(expression); } } } }; element.accept(staticImportProcessor); for (UQualifiedReferenceExpression expression : staticImportProcessor.list) { if (expression.isPsiValid()) { plugin.importMemberOnDemand(expression); } } }