From dfd667a96599e2dfe2ace52618910c266d1521bf Mon Sep 17 00:00:00 2001 From: irengrig Date: Mon, 23 Jul 2012 21:49:03 +0400 Subject: [PATCH] VCS: for tests: patch applier to do actions-after-vfs-refresh not directly under write action --- .../diff/impl/patch/formove/PatchApplier.java | 59 ++++++++++--------- 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/PatchApplier.java b/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/PatchApplier.java index 9fce780dece4..72181f99fb13 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/PatchApplier.java +++ b/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/PatchApplier.java @@ -379,39 +379,44 @@ public class PatchApplier { } final RefreshSession session = RefreshQueue.getInstance().createSession(false, true, new Runnable() { public void run() { - if (project.isDisposed()) return; + ApplicationManager.getApplication().invokeLater(new Runnable() { + @Override + public void run() { + if (project.isDisposed()) return; - final ChangeListManager changeListManager = ChangeListManager.getInstance(project); - if (! directlyAffected.isEmpty() && targetChangelistMover != null) { - changeListManager.invokeAfterUpdate(new Runnable() { - @Override - public void run() { - if (targetChangelistMover != null) { - targetChangelistMover.consume(directlyAffected); + final ChangeListManager changeListManager = ChangeListManager.getInstance(project); + if (! directlyAffected.isEmpty() && targetChangelistMover != null) { + changeListManager.invokeAfterUpdate(new Runnable() { + @Override + public void run() { + if (targetChangelistMover != null) { + targetChangelistMover.consume(directlyAffected); + } + scheduleProjectFilesReload.run(); + if (context != null) { + context.ping(); + } + } + }, InvokeAfterUpdateMode.BACKGROUND_CANCELLABLE, + VcsBundle.message("change.lists.manager.move.changes.to.list"), + new Consumer() { + public void consume(final VcsDirtyScopeManager vcsDirtyScopeManager) { + vcsDirtyScopeManager.filePathsDirty(directlyAffected, null); + vcsDirtyScopeManager.filesDirty(indirectlyAffected, null); } - scheduleProjectFilesReload.run(); - if (context != null) { - context.ping(); - } - } - }, InvokeAfterUpdateMode.BACKGROUND_CANCELLABLE, - VcsBundle.message("change.lists.manager.move.changes.to.list"), - new Consumer() { - public void consume(final VcsDirtyScopeManager vcsDirtyScopeManager) { + }, null); + } else { + final VcsDirtyScopeManager vcsDirtyScopeManager = VcsDirtyScopeManager.getInstance(project); + // will schedule update vcsDirtyScopeManager.filePathsDirty(directlyAffected, null); vcsDirtyScopeManager.filesDirty(indirectlyAffected, null); + scheduleProjectFilesReload.run(); + if (context != null) { + context.ping(); + } } - }, null); - } else { - final VcsDirtyScopeManager vcsDirtyScopeManager = VcsDirtyScopeManager.getInstance(project); - // will schedule update - vcsDirtyScopeManager.filePathsDirty(directlyAffected, null); - vcsDirtyScopeManager.filesDirty(indirectlyAffected, null); - scheduleProjectFilesReload.run(); - if (context != null) { - context.ping(); } - } + }); } }); session.addAllFiles(indirectlyAffected);