[ui] moves undo/redo-related messages to a platform bundle; drops duplicates

GitOrigin-RevId: 9037ca8f7306ac76037d42f0497887c8f7fc66c8
This commit is contained in:
Roman Shevchenko
2019-08-22 01:50:10 +03:00
committed by intellij-monorepo-bot
parent 9548104854
commit b9042910f0
9 changed files with 52 additions and 62 deletions
@@ -1,8 +1,8 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.command.undo;
import com.intellij.CommonBundle;
import com.intellij.ide.DataManager;
import com.intellij.ide.IdeBundle;
import com.intellij.idea.ActionsBundle;
import com.intellij.openapi.actionSystem.IdeActions;
import com.intellij.openapi.application.ApplicationManager;
@@ -155,7 +155,7 @@ public class EditorTypingAndNavigationUndoTest extends EditorUndoTestCase {
public void testStripTrailingSpacesNoCommand() {
typeInText(" test");
enter();
stripTrailingSpaces(false);
stripTrailingSpaces();
undoFirstEditor();
checkEditorState(" test", 8, 0, 0);
}
@@ -210,17 +210,11 @@ public class EditorTypingAndNavigationUndoTest extends EditorUndoTestCase {
assertTrue(editor.getScrollingModel().getVisibleAreaOnScrollingFinished().contains(caretXY));
}
private void stripTrailingSpaces(boolean startCommand) {
final Runnable command =
() -> CommandProcessor.getInstance().runUndoTransparentAction(() -> WriteCommandAction.runWriteCommandAction(null, () -> {
private void stripTrailingSpaces() {
CommandProcessor.getInstance().runUndoTransparentAction(
() -> WriteCommandAction.runWriteCommandAction(null, () -> {
((DocumentImpl)getFirstEditor().getDocument()).stripTrailingSpaces(getProject());
}));
if (startCommand) {
executeCommand(command, "Save");
}
else {
command.run();
}
}
public void testEditingView() {
@@ -299,11 +293,11 @@ public class EditorTypingAndNavigationUndoTest extends EditorUndoTestCase {
undoFirstEditor();
checkEditorText("");
assertEquals(CommonBundle.message("undo.command.confirmation.text", ActionsBundle.message("action.undo.description.empty")) + "?",
assertEquals(IdeBundle.message("undo.command", ActionsBundle.message("action.undo.description.empty")) + "?",
message.get());
redoFirstEditor();
checkEditorText(" ");
assertEquals(CommonBundle.message("redo.command.confirmation.text", ActionsBundle.message("action.redo.description.empty")) + "?",
assertEquals(IdeBundle.message("redo.command", ActionsBundle.message("action.redo.description.empty")) + "?",
message.get());
}
}
}
@@ -1,8 +1,8 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.command.impl;
import com.intellij.CommonBundle;
import com.intellij.ide.IdeBundle;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.actionSystem.DataProvider;
import com.intellij.openapi.command.undo.DocumentReference;
@@ -66,7 +66,7 @@ public class CannotUndoReportDialog extends DialogWrapper implements DataProvide
myProblemFilesList.setModel(model);
EditSourceOnDoubleClickHandler.install(myProblemFilesList, () -> doOKAction());
EditSourceOnEnterKeyHandler.install(myProblemFilesList, () -> doOKAction());
setTitle(CommonBundle.message("cannot.undo.dialog.title"));
setTitle(IdeBundle.message("cannot.undo.title"));
myProblemMessageLabel.setText(problemText);
myProblemMessageLabel.setIcon(Messages.getErrorIcon());
@@ -98,4 +98,4 @@ public class CannotUndoReportDialog extends DialogWrapper implements DataProvide
}
return null;
}
}
}
@@ -1,13 +1,13 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.command.impl;
import com.intellij.CommonBundle;
import com.intellij.ide.IdeBundle;
import com.intellij.idea.ActionsBundle;
import com.intellij.openapi.fileEditor.FileEditor;
import com.intellij.openapi.util.text.StringUtil;
/**
* author: lesya
* @author lesya
*/
class Redo extends UndoRedo {
Redo(UndoManagerImpl manager, FileEditor editor) {
@@ -26,13 +26,13 @@ class Redo extends UndoRedo {
@Override
protected String getActionName() {
return CommonBundle.message("redo.confirmation.title");
return IdeBundle.message("redo.dialog.title");
}
@Override
protected String getActionName(String commandName) {
if (StringUtil.isEmpty(commandName)) commandName = ActionsBundle.message("action.redo.description.empty");
return CommonBundle.message("redo.command.confirmation.text", commandName);
return IdeBundle.message("redo.command", commandName);
}
@Override
@@ -59,4 +59,4 @@ class Redo extends UndoRedo {
protected boolean isRedo() {
return true;
}
}
}
@@ -1,13 +1,13 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.command.impl;
import com.intellij.CommonBundle;
import com.intellij.ide.IdeBundle;
import com.intellij.idea.ActionsBundle;
import com.intellij.openapi.fileEditor.FileEditor;
import com.intellij.openapi.util.text.StringUtil;
/**
* author: lesya
* @author lesya
*/
class Undo extends UndoRedo {
Undo(UndoManagerImpl manager, FileEditor editor) {
@@ -26,13 +26,13 @@ class Undo extends UndoRedo {
@Override
protected String getActionName() {
return CommonBundle.message("undo.dialog.title");
return IdeBundle.message("undo.dialog.title");
}
@Override
protected String getActionName(String commandName) {
if (StringUtil.isEmpty(commandName))commandName = ActionsBundle.message("action.undo.description.empty");
return CommonBundle.message("undo.command.confirmation.text", commandName);
if (StringUtil.isEmpty(commandName)) commandName = ActionsBundle.message("action.undo.description.empty");
return IdeBundle.message("undo.command", commandName);
}
@Override
@@ -59,4 +59,4 @@ class Undo extends UndoRedo {
protected boolean isRedo() {
return false;
}
}
}
@@ -1,7 +1,6 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.command.impl;
import com.intellij.CommonBundle;
import com.intellij.ide.DataManager;
import com.intellij.idea.ActionsBundle;
import com.intellij.openapi.Disposable;
@@ -590,7 +589,7 @@ public class UndoManagerImpl extends UndoManager implements Disposable {
private void flushMergers() {
assert myProject == null || !myProject.isDisposed() : myProject;
// Run dummy command in order to flush all mergers...
CommandProcessor.getInstance().executeCommand(myProject, EmptyRunnable.getInstance(), CommonBundle.message("drop.undo.history.command.name"), null);
CommandProcessor.getInstance().executeCommand(myProject, EmptyRunnable.getInstance(), "Dummy", null);
}
@TestOnly
@@ -1,7 +1,7 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.command.impl;
import com.intellij.CommonBundle;
import com.intellij.ide.IdeBundle;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.TransactionGuard;
import com.intellij.openapi.command.undo.DocumentReference;
@@ -81,14 +81,14 @@ abstract class UndoRedo {
public boolean execute(boolean drop, boolean disableConfirmation) {
if (!myUndoableGroup.isUndoable()) {
reportCannotUndo(CommonBundle.message("cannot.undo.error.contains.nonundoable.changes.message"),
reportCannotUndo(IdeBundle.message("cannot.undo.error.contains.nonundoable.changes.message"),
myUndoableGroup.getAffectedDocuments());
return false;
}
Set<DocumentReference> clashing = getStackHolder().collectClashingActions(myUndoableGroup);
if (!clashing.isEmpty()) {
reportCannotUndo(CommonBundle.message("cannot.undo.error.other.affected.files.changed.message"), clashing);
reportCannotUndo(IdeBundle.message("cannot.undo.error.other.affected.files.changed.message"), clashing);
return false;
}
@@ -195,7 +195,7 @@ abstract class UndoRedo {
boolean confirmSwitchTo(@NotNull UndoRedo other) {
final boolean[] isOk = new boolean[1];
TransactionGuard.getInstance().submitTransactionAndWait(() -> {
String message = CommonBundle.message("undo.conflicting.change.confirmation.message") + "\n" +
String message = IdeBundle.message("undo.conflicting.change.confirmation") + "\n" +
getActionName(other.myUndoableGroup.getCommandName()) + "?";
isOk[0] = Messages.showOkCancelDialog(myManager.getProject(), message, getActionName(),
Messages.getQuestionIcon()) == Messages.OK;
@@ -224,4 +224,4 @@ abstract class UndoRedo {
return myUndoableGroup.isGlobal() && myUndoableGroup.isUndoable() &&
!getStackHolder().collectClashingActions(myUndoableGroup).isEmpty();
}
}
}
@@ -1,10 +1,10 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.command.impl;
import com.intellij.CommonBundle;
import com.intellij.diagnostic.Dumpable;
import com.intellij.history.LocalHistory;
import com.intellij.history.LocalHistoryAction;
import com.intellij.ide.IdeBundle;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.command.UndoConfirmationPolicy;
import com.intellij.openapi.command.undo.DocumentReference;
@@ -106,7 +106,7 @@ class UndoableGroup implements Dumpable {
}
LocalHistoryAction action;
if (myProject != null && isGlobal()) {
String actionName = CommonBundle.message(isUndo ? "local.vcs.action.name.undo.command" : "local.vcs.action.name.redo.command", myCommandName);
String actionName = IdeBundle.message(isUndo ? "undo.command" : "redo.command", myCommandName);
action = LocalHistory.getInstance().startAction(actionName);
}
else {
@@ -288,12 +288,12 @@ class UndoableGroup implements Dumpable {
String message;
if (isUndo) {
title = CommonBundle.message("cannot.undo.dialog.title");
message = CommonBundle.message("cannot.undo.message");
title = IdeBundle.message("cannot.undo.title");
message = IdeBundle.message("cannot.undo.message");
}
else {
title = CommonBundle.message("cannot.redo.dialog.title");
message = CommonBundle.message("cannot.redo.message");
title = IdeBundle.message("cannot.redo.title");
message = IdeBundle.message("cannot.redo.message");
}
if (!ApplicationManager.getApplication().isUnitTestMode()) {
@@ -120,21 +120,6 @@ format.file.size.mbytes={0}Mb
thread.dump.is.taken=Thread dump is <a href="{0}">taken</a>.
failed.to.take.thread.dump=Failed to take a thread dump.
cannot.undo.dialog.title=Cannot Undo
cannot.undo.error.other.affected.files.changed.message=Following files affected by this action have been already changed:
cannot.undo.error.contains.nonundoable.changes.message=Following files have changes that cannot be undone:
undo.conflicting.change.confirmation.message=Other files affected by this action have been already changed.
undo.dialog.title=Undo
redo.command.confirmation.text=Redo {0}
redo.confirmation.title=Redo
undo.command.confirmation.text=Undo {0}
cannot.redo.dialog.title=Cannot Redo
drop.undo.history.command.name=Dummy
cannot.undo.message=Cannot undo
cannot.redo.message=Cannot redo
local.vcs.action.name.undo.command=Undo {0}
local.vcs.action.name.redo.command=Redo {0}
error.reading.color.scheme.from.file.error.message=Error reading color scheme from {0}
button.background=&Background
button.load.file=Load File
@@ -1403,4 +1403,16 @@ navigate.command.search.reference.progress.title=Searching for reference ''{0}''
project.directory.is.not.writable=Directory ''{0}'' doesn't seem to be writeable. Please choose another location.
project.directory.is.already.taken=Directory ''{0}'' is already taken by the project ''{1}''. Please choose another location.
project.directory.is.not.directory=File ''{0}'' is not a directory. Please choose another location.
project.directory.is.not.directory=File ''{0}'' is not a directory. Please choose another location.
undo.command=Undo {0}
redo.command=Redo {0}
undo.dialog.title=Undo
redo.dialog.title=Redo
cannot.undo.title=Cannot Undo
cannot.undo.message=Cannot undo
cannot.redo.title=Cannot Redo
cannot.redo.message=Cannot redo
undo.conflicting.change.confirmation=Other files affected by this action have been already changed.
cannot.undo.error.other.affected.files.changed.message=Following files affected by this action have been already changed:
cannot.undo.error.contains.nonundoable.changes.message=Following files have changes that cannot be undone: