From c2733bd6aea7ee0353cb1f2292d76b369995ad09 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Fri, 19 Jun 2015 18:43:10 +0300 Subject: [PATCH] [vcs] no need to reload project after applying patch The project is reloaded with confirmation anyway from the ProjectManager --- .../diff/impl/patch/formove/PatchApplier.java | 40 ++++--------------- 1 file changed, 7 insertions(+), 33 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 988179e30a2f..349be6d88f87 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 @@ -18,7 +18,6 @@ package com.intellij.openapi.diff.impl.patch.formove; import com.intellij.openapi.application.Application; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.command.CommandProcessor; -import com.intellij.openapi.diff.impl.mergeTool.MergeVersion; import com.intellij.openapi.diff.impl.patch.ApplyPatchContext; import com.intellij.openapi.diff.impl.patch.ApplyPatchStatus; import com.intellij.openapi.diff.impl.patch.FilePatch; @@ -32,7 +31,6 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.MessageType; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.util.Computable; -import com.intellij.openapi.util.EmptyRunnable; import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.Ref; import com.intellij.openapi.vcs.*; @@ -51,7 +49,6 @@ import com.intellij.vcsUtil.VcsUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import javax.swing.*; import java.io.IOException; import java.util.*; @@ -292,7 +289,7 @@ public class PatchApplier { } directlyAffected.addAll(trigger.getAffected()); final Consumer> mover = localChangeList == null ? null : createMover(project, localChangeList); - refreshPassedFilesAndMoveToChangelist(project, null, directlyAffected, indirectlyAffected, mover, false); + refreshPassedFilesAndMoveToChangelist(project, null, directlyAffected, indirectlyAffected, mover); showApplyStatus(project, result); return result; } @@ -354,7 +351,7 @@ public class PatchApplier { final List indirectlyAffected = myVerifier.getAllAffected(); directlyAffected.addAll(additionalDirectly); - refreshPassedFilesAndMoveToChangelist(myProject, context, directlyAffected, indirectlyAffected, myToTargetListsMover, mySystemOperation); + refreshPassedFilesAndMoveToChangelist(myProject, context, directlyAffected, indirectlyAffected, myToTargetListsMover); } public List getDirectlyAffected() { @@ -365,36 +362,15 @@ public class PatchApplier { return myVerifier.getAllAffected(); } - public static void refreshPassedFilesAndMoveToChangelist(@NotNull final Project project, final ContinuationContext context, - final Collection directlyAffected, final Collection indirectlyAffected, - final Consumer> targetChangelistMover, final boolean systemOperation) { + public static void refreshPassedFilesAndMoveToChangelist(@NotNull final Project project, + final ContinuationContext context, + final Collection directlyAffected, + final Collection indirectlyAffected, + final Consumer> targetChangelistMover) { if (context != null) { context.suspend(); } - final Runnable scheduleProjectFilesReload = systemOperation ? EmptyRunnable.getInstance() : new Runnable() { - @Override - public void run() { - final Runnable projectFilesReload = - MergeVersion.MergeDocumentVersion.prepareToReportChangedProjectFiles(project, ObjectsConvertor.fp2vf(directlyAffected)); - final TaskDescriptor projectFilesReloadTaskDescriptor = projectFilesReload == null ? null : new TaskDescriptor("", Where.AWT) { - @Override - public void run(final ContinuationContext context) { - projectFilesReload.run(); - } - }; - - if (projectFilesReloadTaskDescriptor != null) { - if (context != null) { - context.last(projectFilesReloadTaskDescriptor); - } - else { - SwingUtilities.invokeLater(projectFilesReload); - } - } - } - }; - final LocalFileSystem lfs = LocalFileSystem.getInstance(); for (FilePath filePath : directlyAffected) { lfs.refreshAndFindFileByIoFile(filePath.getIOFile()); @@ -413,7 +389,6 @@ public class PatchApplier { @Override public void run() { targetChangelistMover.consume(directlyAffected); - scheduleProjectFilesReload.run(); if (context != null) { context.ping(); } @@ -432,7 +407,6 @@ public class PatchApplier { // will schedule update vcsDirtyScopeManager.filePathsDirty(directlyAffected, null); vcsDirtyScopeManager.filesDirty(indirectlyAffected, null); - scheduleProjectFilesReload.run(); if (context != null) { context.ping(); }