From cc8755dc023ac51590f750ff7aa8f33367fcdd2c Mon Sep 17 00:00:00 2001 From: Anton Makeev Date: Fri, 30 Nov 2012 15:23:01 +0100 Subject: [PATCH] Undo: fix 'cannot undo dummy file' (IDEA-92378) --- .../com/intellij/openapi/command/impl/CommandMerger.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/command/impl/CommandMerger.java b/platform/platform-impl/src/com/intellij/openapi/command/impl/CommandMerger.java index cdd3b27502ef..d91cdacbbbb8 100644 --- a/platform/platform-impl/src/com/intellij/openapi/command/impl/CommandMerger.java +++ b/platform/platform-impl/src/com/intellij/openapi/command/impl/CommandMerger.java @@ -188,13 +188,17 @@ public class CommandMerger { Set affectedFiles = new HashSet(); for (DocumentReference each : myAllAffectedDocuments) { VirtualFile file = each.getFile(); - if (file == null || file instanceof LightVirtualFile) continue; + if (isVirtualDocumentChange(file)) continue; affectedFiles.add(file); if (affectedFiles.size() > 1) return true; } return false; } + private static boolean isVirtualDocumentChange(VirtualFile file) { + return file == null || file instanceof LightVirtualFile; + } + public void undoOrRedo(FileEditor editor, boolean isUndo) { flushCurrentCommand(); @@ -235,7 +239,7 @@ public class CommandMerger { public boolean isPhysical() { if (myAllAffectedDocuments.isEmpty()) return false; for (DocumentReference each : myAllAffectedDocuments) { - if (each.getFile() == null) return false; + if (isVirtualDocumentChange(each.getFile())) return false; } return true; }