void (@NotNull final PyFile file) { final VirtualFile vFile = file.getVirtualFile(); final VirtualFile parentDir = vFile.getParent(); final String newPackageName = vFile.getNameWithoutExtension(); final VirtualFile existing = parentDir.findChild(newPackageName); if (existing != null) { showFileExistsErrorMessage(existing, ID, file.getProject()); return; } WriteCommandAction.runWriteCommandAction(file.getProject(), () -> { try { final VirtualFile packageDir = parentDir.createChildDirectory(this, newPackageName); vFile.move(this, packageDir); vFile.rename(this, PyNames.INIT_DOT_PY); } catch (IOException e) { LOG.error(e); } }); }