String (ClassElement classElement, Project project) { String qualifiedName = classElement.getQualifiedName(); PsiClass aClass = JavaPsiFacade.getInstance(project).findClass(qualifiedName, GlobalSearchScope.projectScope(project)); if (aClass != null) { PsiFile containingFile = aClass.getContainingFile(); if (containingFile instanceof PsiJavaFile) { String packageName = ((PsiJavaFile)containingFile).getPackageName(); if (qualifiedName.startsWith(packageName)) { if (packageName.isEmpty()) return qualifiedName; return qualifiedName.substring(packageName.length() + 1); } } } return classElement.getName(); }