diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/designSurface/GuiEditor.java b/plugins/ui-designer/src/com/intellij/uiDesigner/designSurface/GuiEditor.java index 19784cd03e1a..b39c07f8285f 100644 --- a/plugins/ui-designer/src/com/intellij/uiDesigner/designSurface/GuiEditor.java +++ b/plugins/ui-designer/src/com/intellij/uiDesigner/designSurface/GuiEditor.java @@ -965,6 +965,11 @@ public final class GuiEditor extends JPanel implements DataProvider, ModuleProvi return null; } + public boolean isUndoRedoInProgress() { + UndoManager undoManager = UndoManager.getInstance(getProject()); + return undoManager.isUndoInProgress() || undoManager.isRedoInProgress(); + } + private boolean isActiveEditor() { return UIDesignerToolWindowManager.getInstance(getProject()).getActiveFormEditor() == this; } diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/designSurface/InplaceEditingLayer.java b/plugins/ui-designer/src/com/intellij/uiDesigner/designSurface/InplaceEditingLayer.java index 766916515186..1f8f59ebfd88 100644 --- a/plugins/ui-designer/src/com/intellij/uiDesigner/designSurface/InplaceEditingLayer.java +++ b/plugins/ui-designer/src/com/intellij/uiDesigner/designSurface/InplaceEditingLayer.java @@ -240,25 +240,28 @@ public final class InplaceEditingLayer extends JComponent{ * Finishes current inplace editing */ private void finishInplaceEditing(){ - if(myInplaceComponent == null || myInsideChange){ // nothing to finish + if (myInplaceComponent == null || myInsideChange) { // nothing to finish return; } myInsideChange = true; try{ // 1. Apply new value to the component LOG.assertTrue(myInplaceEditor != null); - CommandProcessor.getInstance().executeCommand( - myInplaceComponent.getProject(), - new Runnable() { - public void run() { - try { - final Object value = myInplaceEditor.getValue(); - myInplaceProperty.setValue(myInplaceComponent, value); - } catch (Exception ignored){} - myEditor.refreshAndSave(true); - } - }, UIDesignerBundle.message("command.set.property.value"), null); - + if (!myEditor.isUndoRedoInProgress()) { + CommandProcessor.getInstance().executeCommand( + myInplaceComponent.getProject(), + new Runnable() { + public void run() { + try { + final Object value = myInplaceEditor.getValue(); + myInplaceProperty.setValue(myInplaceComponent, value); + } + catch (Exception ignored) { + } + myEditor.refreshAndSave(true); + } + }, UIDesignerBundle.message("command.set.property.value"), null); + } // 2. Remove editor from the layer if (myInplaceEditorComponent != null) { // reenterability guard diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/propertyInspector/PropertyInspectorTable.java b/plugins/ui-designer/src/com/intellij/uiDesigner/propertyInspector/PropertyInspectorTable.java index 69dbbf467aeb..20edd7e75a7c 100644 --- a/plugins/ui-designer/src/com/intellij/uiDesigner/propertyInspector/PropertyInspectorTable.java +++ b/plugins/ui-designer/src/com/intellij/uiDesigner/propertyInspector/PropertyInspectorTable.java @@ -654,14 +654,18 @@ public final class PropertyInspectorTable extends Table implements DataProvider{ public void editingStopped(final ChangeEvent ignored){ LOG.assertTrue(isEditing()); LOG.assertTrue(editingRow!=-1); - if (myStoppingEditing) return; + if (myStoppingEditing) { + return; + } myStoppingEditing = true; final Property property=myProperties.get(editingRow); final PropertyEditor editor=property.getEditor(); editor.removePropertyEditorListener(myPropertyEditorListener); try { - final Object value = editor.getValue(); - setValueAt(value, editingRow, editingColumn); + if (myEditor != null && !myEditor.isUndoRedoInProgress()) { + final Object value = editor.getValue(); + setValueAt(value, editingRow, editingColumn); + } } catch (final Exception exc) { showInvalidInput(exc);