vcs: add success indication to 'Copy to Clipboard' action for non-applied ranges

Follow-up: ab279348262476a59ce85f429cb0f5f149697cc7

GitOrigin-RevId: a8b3ec079f6fc286be98cf5076ed9960c61cfc3d
This commit is contained in:
Aleksey Pivovarov
2023-09-26 12:28:08 +00:00
committed by intellij-monorepo-bot
parent d78f6c14b4
commit 6f8350fd7a
2 changed files with 5 additions and 0 deletions
@@ -59,6 +59,7 @@ merge.dialog.ignore.change.command=Ignore change
merge.dialog.resolve.conflict.command=Resolve conflict
merge.dialog.apply.non.conflicted.changes.command=Apply non conflicted changes
patch.dialog.copy.change.command=Copy to clipboard
patch.dialog.copy.change.command.balloon=Copied to clipboard
# suppress inspection "UnusedProperty": used by 3-party plugins
merge.dialog.exit.without.applying.changes.confirmation.message=Are you sure you want to exit without applying changes?
cancel.visual.merge.dialog.title=Cancel File Merge
@@ -1,6 +1,7 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.vcs.changes.patch.tool;
import com.intellij.codeInsight.hint.HintManager;
import com.intellij.diff.*;
import com.intellij.diff.actions.ProxyUndoRedoAction;
import com.intellij.diff.actions.impl.FocusOppositePaneAction;
@@ -451,6 +452,9 @@ class ApplyPatchViewer implements DataProvider, Disposable {
CharSequence newContent = DiffUtil.getLinesContent(myPatchEditor.getDocument(), patchRange.start, patchRange.end);
CopyPasteManager.copyTextToClipboard(newContent.toString());
myPatchEditor.getCaretModel().moveToOffset(myPatchEditor.getDocument().getLineStartOffset(patchRange.start));
HintManager.getInstance().showInformationHint(myPatchEditor, DiffBundle.message("patch.dialog.copy.change.command.balloon"), HintManager.UNDER);
}
private final class ApplySelectedChangesAction extends ApplySelectedChangesActionBase {