void () { if (myProject != null) { StoreReloadManager.Companion.getInstance(myProject).blockReloadingProjectOnExternalChanges(); } myProjectLevelVcsManager.startBackgroundVcsOperation(); myBefore = LocalHistory.getInstance().putSystemLabel(myProject, VcsBundle.message("update.label.before.update")); myLocalHistoryAction = LocalHistory.getInstance().startAction(VcsBundle.message("local.history.update.from.vcs")); ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator(); if (progressIndicator != null) { progressIndicator.setIndeterminate(false); } StructuredIdeActivity activity = UPDATE_ACTIVITY.started(myProject); try { int toBeProcessed = myVcsToVirtualFiles.size(); int processed = 0; for (AbstractVcs vcs : myVcsToVirtualFiles.keySet()) { final UpdateEnvironment updateEnvironment = myActionInfo.getEnvironment(vcs); updateEnvironment.fillGroups(myUpdatedFiles); Collection<FilePath> files = myVcsToVirtualFiles.get(vcs); final SequentialUpdatesContext context = myContextInfo.get(vcs); final Ref<SequentialUpdatesContext> refContext = new Ref<>(context); // actual update UpdateSession updateSession = performUpdate(progressIndicator, updateEnvironment, files, refContext); myContextInfo.put(vcs, refContext.get()); processed++; if (progressIndicator != null) { progressIndicator.setFraction((double)processed / (double)toBeProcessed); progressIndicator.setText2(""); } final List<VcsException> exceptionList = updateSession.getExceptions(); gatherExceptions(vcs, exceptionList); myUpdateSessions.add(updateSession); } } finally { try { ProgressManager.progress(VcsBundle.message("progress.text.synchronizing.files")); doVfsRefresh(); } finally { myProjectLevelVcsManager.stopBackgroundVcsOperation(); BackgroundTaskUtil.syncPublisher(myProject, UpdatedFilesListener.UPDATED_FILES). consume(UpdatedFilesReverseSide.getPathsFromUpdatedFiles(myUpdatedFiles)); activity.finished(); } } }