void (@NotNull File sourceFile, @NotNull VirtualFile targetFile) { try { WriteAction.runAndWait(() -> { targetFile.setBinaryContent(FileUtil.loadFileBytes(sourceFile)); // update the document now, otherwise MemoryDiskConflictResolver will do it later at unexpected moment of time FileDocumentManager.getInstance().reloadFiles(targetFile); }); } catch (IOException e) { throw new RuntimeException(e); } }