PsiElement (PsiElement element, boolean onlyNonStatic) { PsiFile file = element.getContainingFile(); if (file instanceof GroovyFile) { GrImportStatement anImport = PsiTreeUtil.getParentOfType(element, GrImportStatement.class); if (!(anImport == null || anImport.isStatic() && onlyNonStatic)) { return anImport; } } return null; }