String (final PsiElement psiElement) { if (psiElement instanceof PsiPackage psiPackage) { final PsiPackage parentPackage = psiPackage.getParentPackage(); return parentPackage != null ? parentPackage.getQualifiedName() : ""; } else if (psiElement instanceof PsiDirectory) { PsiPackage aPackage = JavaDirectoryService.getInstance().getPackage((PsiDirectory)psiElement); return aPackage != null ? getTargetPackageNameForMovedElement(aPackage) : ""; } else if (psiElement != null) { PsiDirectory directory = PlatformPackageUtil.getDirectory(psiElement); PsiPackage aPackage = directory == null ? null : JavaDirectoryService.getInstance().getPackage(directory); return aPackage != null ? aPackage.getQualifiedName() : ""; } else { return null; } }