VirtualFile (@NotNull VirtualFile file, final String toName) { final AtomicReference<VirtualFile> res = new AtomicReference<>(); WriteCommandAction.writeCommandAction(myProject).run(() -> { try { res.set(file.copy(this, file.getParent(), toName)); } catch (IOException e) { throw new RuntimeException(e); } }); return res.get(); }