void (@NotNull MergeResult result) { final byte[] applyContent = switch (result) { case CANCEL -> MergeUtil.shouldRestoreOriginalContentOnCancel(this) ? myOriginalContent : null; case LEFT -> ThreeSide.LEFT.select(myByteContents); case RIGHT -> ThreeSide.RIGHT.select(myByteContents); case RESOLVED -> null; }; if (applyContent != null) { try { VirtualFile file = myFile.getFile(); if (!file.isValid()) { throw new IOException(IdeBundle.message("error.file.not.found.message", file.getPresentableUrl())); } if (!DiffUtil.makeWritable(myProject, file)) { throw new IOException(UIBundle.message("file.is.read.only.message.text", file.getPresentableUrl())); } WriteCommandAction.writeCommandAction(null).run(() -> { file.setBinaryContent(applyContent); }); } catch (IOException e) { LOG.warn(e); Messages.showErrorDialog(myProject, e.getMessage(), DiffBundle.message("can.t.finish.merge.resolve")); } } MergeCallback.getCallback(this).applyResult(result); }