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 87c12abf6c76..712550235c29 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 @@ -32,6 +32,7 @@ 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.*; @@ -43,7 +44,6 @@ import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.newvfs.RefreshQueue; import com.intellij.openapi.vfs.newvfs.RefreshSession; -import com.intellij.ui.GuiUtils; import com.intellij.util.Consumer; import com.intellij.util.WaitForProgressToShow; import com.intellij.util.continuation.*; @@ -66,6 +66,7 @@ public class PatchApplier { private final Consumer> myToTargetListsMover; private final List myRemainingPatches; private final PathsVerifier myVerifier; + private boolean mySystemOperation; public PatchApplier(final Project project, final VirtualFile baseDirectory, final List patches, @Nullable final Consumer> toTargetListsMover, final CustomBinaryPatchApplier customForBinaries, @@ -96,6 +97,10 @@ public class PatchApplier { this(project, baseDirectory, patches, createMover(project, targetChangeList), customForBinaries, commitContext); } + public void setIsSystemOperation(boolean systemOperation) { + mySystemOperation = systemOperation; + } + @Nullable private static Consumer> createMover(final Project project, final LocalChangeList targetChangeList) { final ChangeListManager clm = ChangeListManager.getInstance(project); @@ -122,12 +127,12 @@ public class PatchApplier { public class ApplyPatchTask extends TaskDescriptor { private ApplyPatchStatus myStatus; private final boolean myShowNotification; - private final boolean mySilentAddDelete; + private final boolean mySystemOperation; - public ApplyPatchTask(final boolean showNotification, boolean silentAddDelete) { + public ApplyPatchTask(final boolean showNotification, boolean systemOperation) { super("", Where.AWT); myShowNotification = showNotification; - mySilentAddDelete = silentAddDelete; + mySystemOperation = systemOperation; } @Override @@ -143,7 +148,7 @@ public class PatchApplier { return; } - final TriggerAdditionOrDeletion trigger = new TriggerAdditionOrDeletion(myProject, mySilentAddDelete); + final TriggerAdditionOrDeletion trigger = new TriggerAdditionOrDeletion(myProject, mySystemOperation); final ApplyPatchStatus applyStatus; try { applyStatus = ApplicationManager.getApplication().runReadAction(new Computable() { @@ -232,7 +237,7 @@ public class PatchApplier { } directlyAffected.addAll(trigger.getAffected()); final Consumer> mover = localChangeList == null ? null : createMover(project, localChangeList); - PatchApplier.refreshPassedFilesAndMoveToChangelist(project, null, directlyAffected, indirectlyAffected, mover); + PatchApplier.refreshPassedFilesAndMoveToChangelist(project, null, directlyAffected, indirectlyAffected, mover, false); showApplyStatus(project, result); return result; } @@ -294,7 +299,7 @@ public class PatchApplier { final List indirectlyAffected = myVerifier.getAllAffected(); directlyAffected.addAll(additionalDirectly); - refreshPassedFilesAndMoveToChangelist(myProject, context, directlyAffected, indirectlyAffected, myToTargetListsMover); + refreshPassedFilesAndMoveToChangelist(myProject, context, directlyAffected, indirectlyAffected, myToTargetListsMover, mySystemOperation); } public List getDirectlyAffected() { @@ -306,21 +311,23 @@ public class PatchApplier { } public static void refreshPassedFilesAndMoveToChangelist(final Project project, final ContinuationContext context, - final Collection directlyAffected, final Collection indirectlyAffected, final Consumer> targetChangelistMover) { + final Collection directlyAffected, final Collection indirectlyAffected, + final Consumer> targetChangelistMover, final boolean systemOperation) { if (context != null) { context.suspend(); } - 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(); - } - }; - final Runnable scheduleProjectFilesReload = new Runnable() { + final Runnable scheduleProjectFilesReload = systemOperation ? EmptyRunnable.getInstance() : new Runnable() { 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); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelveChangesManager.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelveChangesManager.java index a426483d0a65..dbd269205530 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelveChangesManager.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelveChangesManager.java @@ -366,7 +366,7 @@ public class ShelveChangesManager implements ProjectComponent, JDOMExternalizabl @Nullable final List binaryFiles, @Nullable final LocalChangeList targetChangeList, final boolean showSuccessNotification, final ContinuationContext context, - final boolean silentAddDelete) { + final boolean systemOperation) { context.next(new TaskDescriptor("", Where.AWT) { @Override public void run(ContinuationContext contextInner) { @@ -400,6 +400,7 @@ public class ShelveChangesManager implements ProjectComponent, JDOMExternalizabl final BinaryPatchApplier binaryPatchApplier = new BinaryPatchApplier(binaryFilesToUnshelve.size()); final PatchApplier patchApplier = new PatchApplier(myProject, myProject.getBaseDir(), patches, targetChangeList, binaryPatchApplier, commitContext); + patchApplier.setIsSystemOperation(systemOperation); // after patch applier part contextInner.next(new TaskDescriptor("", Where.AWT) { @@ -416,7 +417,7 @@ public class ShelveChangesManager implements ProjectComponent, JDOMExternalizabl } }); - patchApplier.scheduleSelf(showSuccessNotification, contextInner, silentAddDelete); + patchApplier.scheduleSelf(showSuccessNotification, contextInner, systemOperation); } }); }