Undo: do no record originator for non-physical documents (like refactorings dialogs)

This commit is contained in:
Anton Makeev
2012-07-11 14:18:50 +02:00
parent 647a9d01a4
commit dbb9614a6b
2 changed files with 9 additions and 1 deletions
@@ -231,6 +231,14 @@ public class CommandMerger {
return !myCurrentActions.isEmpty();
}
public boolean isPhysical() {
if (myAllAffectedDocuments.isEmpty()) return false;
for (DocumentReference each : myAllAffectedDocuments) {
if (each.getFile() == null) return false;
}
return true;
}
public boolean isUndoAvailable(@NotNull Collection<DocumentReference> refs) {
if (hasNonUndoableActions()) {
return false;
@@ -283,7 +283,7 @@ public class UndoManagerImpl extends UndoManager implements ProjectComponent, Ap
myCommandLevel--;
if (myCommandLevel > 0) return;
if (myProject != null && myCurrentMerger.hasActions() && !myCurrentMerger.isTransparent()) {
if (myProject != null && myCurrentMerger.hasActions() && !myCurrentMerger.isTransparent() && myCurrentMerger.isPhysical()) {
addFocusedDocumentAsAffected();
}
myOriginatorReference = null;