From ea24b548d6e50e1212bc84d337113d5297fbe2f3 Mon Sep 17 00:00:00 2001 From: Dmitry Batkovich Date: Wed, 30 Sep 2015 14:15:09 +0300 Subject: [PATCH] IDEA-145406 Resource Bundle editor: Undo operations for property add works incorrectly. Partially fixed --- .../lang/properties/editor/ResourceBundleEditor.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleEditor.java b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleEditor.java index 0a05474ff9d4..d8e261fca2f4 100644 --- a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleEditor.java +++ b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleEditor.java @@ -534,6 +534,7 @@ public class ResourceBundleEditor extends UserDataHolderBase implements FileEdit ((CardLayout)myValuesPanel.getLayout()).show(myValuesPanel, propertyName == null ? NO_PROPERTY_SELECTED : VALUES); if (propertyName == null) return; + final UndoManagerImpl undoManager = (UndoManagerImpl)UndoManager.getInstance(myProject); for (final PropertiesFile propertiesFile : myResourceBundle.getPropertiesFiles()) { final EditorEx editor = (EditorEx)myEditors.get(propertiesFile); if (editor == null) continue; @@ -545,19 +546,20 @@ public class ResourceBundleEditor extends UserDataHolderBase implements FileEdit ApplicationManager.getApplication().runWriteAction(new Runnable() { @Override public void run() { - final UndoManagerImpl undoManager = (UndoManagerImpl)UndoManager.getInstance(myProject); - if (!checkIsUnderUndoRedoAction || !undoManager.isActive() || !(undoManager.isRedoInProgress() || undoManager.isUndoInProgress())) { + if (!checkIsUnderUndoRedoAction || + !undoManager.isActive() || + !(undoManager.isRedoInProgress() || undoManager.isUndoInProgress())) { updateDocumentFromPropertyValue(getPropertyEditorValue(property), document, propertiesFile); } } }); } }, "", this); - JPanel titledPanel = myTitledPanels.get(propertiesFile); ((TitledBorder)titledPanel.getBorder()).setTitleColor(property == null ? JBColor.RED : UIUtil.getLabelTextForeground()); titledPanel.repaint(); } + undoManager.flushCurrentCommandMerger(); } private void installPropertiesChangeListeners() {