void () { Runnable runnable = () -> { PsiPackage aPackage = JavaPsiFacade.getInstance(myPsiManager.getProject()).findPackage("bla"); assertNotNull("Package bla not found", aPackage); PsiDirectory dir = aPackage.getDirectories()[0]; new RenameProcessor(myProject, dir, "anotherBla", true, true).run(); FileDocumentManager.getInstance().saveAllDocuments(); }; CommandProcessor.getInstance().executeCommand(myProject, runnable, "", null); }