PsiPackage (String newQualifiedName) { PsiDirectory dir = PackageUtil.findOrCreateDirectoryForPackage(myProject, newQualifiedName, null, false); if (dir == null) return null; return JavaDirectoryService.getInstance().getPackage(dir); }