String (@NotNull PsiClassOwner file) { final PsiElement qualifier = myRefElement.getQualifier(); if (qualifier instanceof GrReferenceElement) { final PsiElement resolved = ((GrReferenceElement<?>)qualifier).resolve(); if (resolved instanceof PsiPackage) { return ((PsiPackage)resolved).getQualifiedName(); } } return file instanceof GroovyFile ? file.getPackageName() : ""; }