void (@NotNull PsiElement referringElement, @NotNull PsiClass targetClass) { PsiFile file = referringElement.getContainingFile(); if (file instanceof GroovyFile) { ((GroovyFile)file).importClass(targetClass); } }