String (final SourcePosition position) { PsiElement element = findElementAt(position); while (true) { element = PsiTreeUtil.getParentOfType(element, GrTypeDefinition.class, PsiClassImpl.class); if (element == null || (element instanceof GrTypeDefinition && !((GrTypeDefinition)element).isAnonymous()) || (element instanceof PsiClassImpl && ((PsiClassImpl)element).getName() != null) ) { break; } } if (element != null) { return getClassNameForJvm((PsiClass)element); } return null; }