boolean (PsiElement context) { 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; }