Index: modules/swing/src/main/java/common/javax/swing/text/AbstractDocument.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/text/AbstractDocument.java (revision 430288) +++ modules/swing/src/main/java/common/javax/swing/text/AbstractDocument.java (working copy) @@ -559,7 +559,7 @@ } public String getRedoPresentationName() { - return RedoName + " " + getPresentationName(); + return getRedoName() + " " + getPresentationName(); } public EventType getType() { @@ -567,7 +567,7 @@ } public String getUndoPresentationName() { - return UndoName + " " + getPresentationName(); + return getUndoName() + " " + getPresentationName(); } public boolean isSignificant() { @@ -625,6 +625,13 @@ } } + private String getUndoName() { + return UIManager.getString("AbstractDocument.undoText"); + } + + private String getRedoName() { + return UIManager.getString("AbstractDocument.redoText"); + } } public static class ElementEdit extends AbstractUndoableEdit Index: modules/swing/src/main/java/common/javax/swing/undo/UndoManager.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/undo/UndoManager.java (revision 430288) +++ modules/swing/src/main/java/common/javax/swing/undo/UndoManager.java (working copy) @@ -124,7 +124,7 @@ if (inProgress) { UndoableEdit undoEdit = editToBeUndone(); if (undoEdit == null) { - return UndoName; + return getUndoName(); } return undoEdit.getUndoPresentationName(); } else { @@ -144,7 +144,7 @@ if (inProgress) { UndoableEdit redoEdit = editToBeRedone(); if (redoEdit == null) { - return RedoName; + return getRedoName(); } return redoEdit.getRedoPresentationName(); } else { Index: modules/swing/src/main/java/common/javax/swing/undo/AbstractUndoableEdit.java =================================================================== --- modules/swing/src/main/java/common/javax/swing/undo/AbstractUndoableEdit.java (revision 430288) +++ modules/swing/src/main/java/common/javax/swing/undo/AbstractUndoableEdit.java (working copy) @@ -22,6 +22,8 @@ import java.io.Serializable; import javax.swing.UIManager; +import org.apache.harmony.x.swing.Utilities; + public class AbstractUndoableEdit implements UndoableEdit, Serializable { private static final long serialVersionUID = 580150227676302096L; @@ -60,21 +62,11 @@ } public String getUndoPresentationName() { - String presentationName = getPresentationName(); - String name = getUndoName(); - if (presentationName.length() == 0) { - return name; - } - return name + " " + presentationName; + return getOperationPresentationName(getUndoName()); } public String getRedoPresentationName() { - String presentationName = getPresentationName(); - String name = getRedoName(); - if (presentationName.length() == 0) { - return name; - } - return name + " " + presentationName; + return getOperationPresentationName(getRedoName()); } public String getPresentationName() { @@ -113,21 +105,20 @@ alive = false; } - private String undoName; - private String redoName; - private String getUndoName() { - if (undoName == null) { - undoName = UIManager.getString("AbstractUndoableEdit.undoText"); - } - return undoName; + final String getUndoName() { + return UIManager.getString("AbstractUndoableEdit.undoText"); } - private String getRedoName() { - if (redoName == null) { - redoName = UIManager.getString("AbstractUndoableEdit.redoText"); - } - return redoName; + final String getRedoName() { + return UIManager.getString("AbstractUndoableEdit.redoText"); } + private String getOperationPresentationName(final String operationName) { + final String presentationName = getPresentationName(); + return Utilities.isEmptyString(presentationName) + ? operationName + : operationName + " " + presentationName; + } }