VirtualFile (final @NotNull VirtualFile directory, final @NotNull Project project) { ThreadingAssertions.assertEventDispatchThread(); try { return WriteAction.compute(() -> { VirtualFile dir = directory; if (!dir.getName().equals(MANIFEST_DIR_NAME)) { dir = VfsUtil.createDirectoryIfMissing(dir, MANIFEST_DIR_NAME); } final VirtualFile f = dir.createChildData(dir, MANIFEST_FILE_NAME); try (OutputStream output = f.getOutputStream(dir)) { final Manifest manifest = new Manifest(); ManifestBuilder.setVersionAttribute(manifest.getMainAttributes()); manifest.write(output); } return f; }); } catch (IOException e) { LOG.info(e); Messages.showErrorDialog(project, e.getMessage(), CommonBundle.getErrorTitle()); return null; } }