VCS: allow Git to report changed on server files comparing the whole tree. !! require...
[fedora-idea.git] / platform / vcs-impl / src / com / intellij / openapi / vcs / update / AbstractCommonUpdateAction.java
blobb0ceb5b1a4d8290cb73562b33b66afa79cd3d824
1 /*
2 * Copyright (c) 2004 JetBrains s.r.o. All Rights Reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
8 * -Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
11 * -Redistribution in binary form must reproduct the above copyright
12 * notice, this list of conditions and the following disclaimer in
13 * the documentation and/or other materials provided with the distribution.
15 * Neither the name of JetBrains or IntelliJ IDEA
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
19 * This software is provided "AS IS," without a warranty of any kind. ALL
20 * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
21 * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
22 * OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. JETBRAINS AND ITS LICENSORS SHALL NOT
23 * BE LIABLE FOR ANY DAMAGES OR LIABILITIES SUFFERED BY LICENSEE AS A RESULT
24 * OF OR RELATING TO USE, MODIFICATION OR DISTRIBUTION OF THE SOFTWARE OR ITS
25 * DERIVATIVES. IN NO EVENT WILL JETBRAINS OR ITS LICENSORS BE LIABLE FOR ANY LOST
26 * REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL,
27 * INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY
28 * OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE SOFTWARE, EVEN
29 * IF JETBRAINS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
32 package com.intellij.openapi.vcs.update;
34 import com.intellij.history.Label;
35 import com.intellij.history.LocalHistory;
36 import com.intellij.history.LocalHistoryAction;
37 import com.intellij.ide.errorTreeView.HotfixData;
38 import com.intellij.openapi.actionSystem.AnActionEvent;
39 import com.intellij.openapi.actionSystem.Presentation;
40 import com.intellij.openapi.application.ApplicationManager;
41 import com.intellij.openapi.diagnostic.Logger;
42 import com.intellij.openapi.options.Configurable;
43 import com.intellij.openapi.progress.ProcessCanceledException;
44 import com.intellij.openapi.progress.ProgressIndicator;
45 import com.intellij.openapi.progress.ProgressManager;
46 import com.intellij.openapi.progress.Task;
47 import com.intellij.openapi.project.Project;
48 import com.intellij.openapi.project.ex.ProjectManagerEx;
49 import com.intellij.openapi.ui.MessageType;
50 import com.intellij.openapi.util.Ref;
51 import com.intellij.openapi.vcs.*;
52 import com.intellij.openapi.vcs.actions.AbstractVcsAction;
53 import com.intellij.openapi.vcs.actions.VcsContext;
54 import com.intellij.openapi.vcs.changes.VcsDirtyScopeManager;
55 import com.intellij.openapi.vcs.changes.VcsDirtyScopeManagerImpl;
56 import com.intellij.openapi.vcs.changes.RemoteRevisionsCache;
57 import com.intellij.openapi.vcs.changes.committed.CommittedChangesAdapter;
58 import com.intellij.openapi.vcs.changes.committed.CommittedChangesCache;
59 import com.intellij.openapi.vcs.changes.ui.ChangesViewContentManager;
60 import com.intellij.openapi.vcs.ex.ProjectLevelVcsManagerEx;
61 import com.intellij.openapi.vcs.versionBrowser.CommittedChangeList;
62 import com.intellij.openapi.vfs.VfsUtil;
63 import com.intellij.openapi.vfs.VirtualFile;
64 import com.intellij.openapi.vfs.VirtualFileManager;
65 import com.intellij.openapi.wm.ToolWindowManager;
66 import com.intellij.util.messages.MessageBusConnection;
67 import com.intellij.util.ui.OptionsDialog;
68 import com.intellij.vcsUtil.VcsUtil;
69 import org.jetbrains.annotations.NonNls;
70 import org.jetbrains.annotations.NotNull;
71 import org.jetbrains.annotations.Nullable;
73 import java.io.File;
74 import java.util.*;
76 public abstract class AbstractCommonUpdateAction extends AbstractVcsAction {
77 private final static Logger LOG = Logger.getInstance("#com.intellij.openapi.vcs.update.AbstractCommonUpdateAction");
79 private final ActionInfo myActionInfo;
80 private final ScopeInfo myScopeInfo;
82 protected AbstractCommonUpdateAction(ActionInfo actionInfo, ScopeInfo scopeInfo) {
83 myActionInfo = actionInfo;
84 myScopeInfo = scopeInfo;
87 private String getCompleteActionName(VcsContext dataContext) {
88 return myActionInfo.getActionName(myScopeInfo.getScopeName(dataContext, myActionInfo));
91 protected void actionPerformed(final VcsContext context) {
92 final Project project = context.getProject();
94 boolean showUpdateOptions = myActionInfo.showOptions(project);
96 if (project != null) {
97 try {
98 if (ApplicationManager.getApplication().isDispatchThread()) {
99 ApplicationManager.getApplication().saveAll();
102 final FilePath[] filePaths = myScopeInfo.getRoots(context, myActionInfo);
103 final FilePath[] roots = filterDescindingFiles(filterRoots(filePaths, context), project);
104 if (roots.length == 0) {
105 return;
108 final Map<AbstractVcs, Collection<FilePath>> vcsToVirtualFiles = createVcsToFilesMap(roots, project);
110 if (showUpdateOptions || OptionsDialog.shiftIsPressed(context.getModifiers())) {
111 showOptionsDialog(vcsToVirtualFiles, project, context);
114 for (AbstractVcs vcs : vcsToVirtualFiles.keySet()) {
115 final UpdateEnvironment updateEnvironment = myActionInfo.getEnvironment(vcs);
116 if ((updateEnvironment != null) && (! updateEnvironment.validateOptions(vcsToVirtualFiles.get(vcs)))) {
117 // messages already shown
118 return;
122 Task.Backgroundable task = new Updater(project, roots, vcsToVirtualFiles);
123 ProgressManager.getInstance().run(task);
125 catch (ProcessCanceledException e1) {
126 //ignore
131 private boolean canGroupByChangelist(final Set<AbstractVcs> abstractVcses) {
132 if (myActionInfo.canGroupByChangelist()) {
133 for(AbstractVcs vcs: abstractVcses) {
134 if (vcs.getCachingCommittedChangesProvider() != null) {
135 return true;
139 return false;
142 private static boolean someSessionWasCanceled(List<UpdateSession> updateSessions) {
143 for (UpdateSession updateSession : updateSessions) {
144 if (updateSession.isCanceled()) {
145 return true;
148 return false;
151 private static String getAllFilesAreUpToDateMessage(FilePath[] roots) {
152 if (roots.length == 1 && !roots[0].isDirectory()) {
153 return VcsBundle.message("message.text.file.is.up.to.date");
155 else {
156 return VcsBundle.message("message.text.all.files.are.up.to.date");
160 private void showOptionsDialog(final Map<AbstractVcs, Collection<FilePath>> updateEnvToVirtualFiles, final Project project,
161 final VcsContext dataContext) {
162 LinkedHashMap<Configurable, AbstractVcs> envToConfMap = createConfigurableToEnvMap(updateEnvToVirtualFiles);
163 if (!envToConfMap.isEmpty()) {
164 UpdateOrStatusOptionsDialog dialogOrStatus = myActionInfo.createOptionsDialog(project, envToConfMap,
165 myScopeInfo.getScopeName(dataContext,
166 myActionInfo));
167 dialogOrStatus.show();
168 if (!dialogOrStatus.isOK()) {
169 throw new ProcessCanceledException();
174 private LinkedHashMap<Configurable, AbstractVcs> createConfigurableToEnvMap(Map<AbstractVcs, Collection<FilePath>> updateEnvToVirtualFiles) {
175 LinkedHashMap<Configurable, AbstractVcs> envToConfMap = new LinkedHashMap<Configurable, AbstractVcs>();
176 for (AbstractVcs vcs : updateEnvToVirtualFiles.keySet()) {
177 Configurable configurable = myActionInfo.getEnvironment(vcs).createConfigurable(updateEnvToVirtualFiles.get(vcs));
178 if (configurable != null) {
179 envToConfMap.put(configurable, vcs);
182 return envToConfMap;
185 private Map<AbstractVcs,Collection<FilePath>> createVcsToFilesMap(FilePath[] roots, Project project) {
186 HashMap<AbstractVcs, Collection<FilePath>> resultPrep = new HashMap<AbstractVcs, Collection<FilePath>>();
188 for (FilePath file : roots) {
189 AbstractVcs vcs = VcsUtil.getVcsFor(project, file);
190 if (vcs != null) {
191 UpdateEnvironment updateEnvironment = myActionInfo.getEnvironment(vcs);
192 if (updateEnvironment != null) {
193 if (!resultPrep.containsKey(vcs)) resultPrep.put(vcs, new HashSet<FilePath>());
194 resultPrep.get(vcs).add(file);
199 final Map<AbstractVcs, Collection<FilePath>> result = new HashMap<AbstractVcs, Collection<FilePath>>();
200 for (Map.Entry<AbstractVcs, Collection<FilePath>> entry : resultPrep.entrySet()) {
201 final AbstractVcs vcs = entry.getKey();
202 final List<FilePath> paths = new ArrayList<FilePath>(entry.getValue());
203 final List<VirtualFile> files = ObjectsConvertor.convert(paths, ObjectsConvertor.FILEPATH_TO_VIRTUAL, ObjectsConvertor.NOT_NULL);
204 result.put(vcs, ObjectsConvertor.vf2fp(vcs.filterUniqueRoots(files)));
207 return result;
210 private static boolean containsParent(FilePath[] array, FilePath file) {
211 for (FilePath virtualFile : array) {
212 if (virtualFile == file) continue;
213 if (VfsUtil.isAncestor(virtualFile.getIOFile(), file.getIOFile(), false)) return true;
215 return false;
218 @NotNull
219 private FilePath[] filterRoots(FilePath[] roots, VcsContext vcsContext) {
220 final ArrayList<FilePath> result = new ArrayList<FilePath>();
221 final Project project = vcsContext.getProject();
222 for (FilePath file : roots) {
223 AbstractVcs vcs = VcsUtil.getVcsFor(project, file);
224 if (vcs != null) {
225 if (!myScopeInfo.filterExistsInVcs() || AbstractVcs.fileInVcsByFileStatus(project, file)) {
226 UpdateEnvironment updateEnvironment = myActionInfo.getEnvironment(vcs);
227 if (updateEnvironment != null) {
228 result.add(file);
231 else {
232 final VirtualFile virtualFile = file.getVirtualFile();
233 if (virtualFile != null && virtualFile.isDirectory()) {
234 final VirtualFile[] vcsRoots = ProjectLevelVcsManager.getInstance(vcsContext.getProject()).getAllVersionedRoots();
235 for(VirtualFile vcsRoot: vcsRoots) {
236 if (VfsUtil.isAncestor(virtualFile, vcsRoot, false)) {
237 result.add(file);
244 return result.toArray(new FilePath[result.size()]);
247 protected abstract boolean filterRootsBeforeAction();
249 protected void update(VcsContext vcsContext, Presentation presentation) {
250 Project project = vcsContext.getProject();
252 if (project != null) {
254 String actionName = getCompleteActionName(vcsContext);
255 if (myActionInfo.showOptions(project) || OptionsDialog.shiftIsPressed(vcsContext.getModifiers())) {
256 actionName += "...";
259 presentation.setText(actionName);
261 presentation.setVisible(true);
262 presentation.setEnabled(true);
264 if (supportingVcsesAreEmpty(vcsContext.getProject(), myActionInfo)) {
265 presentation.setVisible(false);
266 presentation.setEnabled(false);
269 if (filterRootsBeforeAction()) {
270 FilePath[] roots = filterRoots(myScopeInfo.getRoots(vcsContext, myActionInfo), vcsContext);
271 if (roots.length == 0) {
272 presentation.setVisible(false);
273 presentation.setEnabled(false);
277 if (presentation.isVisible() && presentation.isEnabled() &&
278 ProjectLevelVcsManager.getInstance(project).isBackgroundVcsOperationRunning()) {
279 presentation.setEnabled(false);
281 } else {
282 presentation.setVisible(false);
283 presentation.setEnabled(false);
287 protected boolean forceSyncUpdate(final AnActionEvent e) {
288 return true;
291 private static boolean supportingVcsesAreEmpty(final Project project, final ActionInfo actionInfo) {
292 if (project == null) return true;
293 final AbstractVcs[] allActiveVcss = ProjectLevelVcsManager.getInstance(project).getAllActiveVcss();
294 for (AbstractVcs activeVcs : allActiveVcss) {
295 if (actionInfo.getEnvironment(activeVcs) != null) return false;
297 return true;
300 private class Updater extends Task.Backgroundable {
301 private final Project myProject;
302 private final ProjectLevelVcsManagerEx myProjectLevelVcsManager;
303 private UpdatedFiles myUpdatedFiles;
304 private final FilePath[] myRoots;
305 private final Map<AbstractVcs, Collection<FilePath>> myVcsToVirtualFiles;
306 private final Map<HotfixData, List<VcsException>> myGroupedExceptions;
307 private final List<UpdateSession> myUpdateSessions;
308 private int myUpdateNumber;
310 // vcs name, context object
311 private final Map<AbstractVcs, SequentialUpdatesContext> myContextInfo;
312 private VcsDirtyScopeManager myDirtyScopeManager;
314 private Label myBefore;
315 private Label myAfter;
317 public Updater(final Project project, final FilePath[] roots, final Map<AbstractVcs, Collection<FilePath>> vcsToVirtualFiles) {
318 super(project, getTemplatePresentation().getText(), true, VcsConfiguration.getInstance(project).getUpdateOption());
319 myProject = project;
320 myProjectLevelVcsManager = ProjectLevelVcsManagerEx.getInstanceEx(project);
321 myDirtyScopeManager = VcsDirtyScopeManager.getInstance(myProject);
322 myRoots = roots;
323 myVcsToVirtualFiles = vcsToVirtualFiles;
325 myUpdatedFiles = UpdatedFiles.create();
326 myGroupedExceptions = new HashMap<HotfixData, List<VcsException>>();
327 myUpdateSessions = new ArrayList<UpdateSession>();
329 // create from outside without any context; context is created by vcses
330 myContextInfo = new HashMap<AbstractVcs, SequentialUpdatesContext>();
331 myUpdateNumber = 1;
334 private void reset() {
335 myUpdatedFiles = UpdatedFiles.create();
336 myGroupedExceptions.clear();
337 myUpdateSessions.clear();
338 ++ myUpdateNumber;
341 private void suspendIfNeeded() {
342 if (! myActionInfo.canChangeFileStatus()) {
343 // i.e. for update but not for integrate or status
344 ((VcsDirtyScopeManagerImpl) myDirtyScopeManager).suspendMe();
348 private void releaseIfNeeded() {
349 if (! myActionInfo.canChangeFileStatus()) {
350 // i.e. for update but not for integrate or status
351 ((VcsDirtyScopeManagerImpl) myDirtyScopeManager).reanimate();
355 public void run(@NotNull final ProgressIndicator indicator) {
356 suspendIfNeeded();
357 try {
358 runImpl(indicator);
359 } catch (Throwable t) {
360 releaseIfNeeded();
361 if (t instanceof Error) {
362 throw ((Error) t);
363 } else if (t instanceof RuntimeException) {
364 throw ((RuntimeException) t);
366 throw new RuntimeException(t);
370 private void runImpl(@NotNull final ProgressIndicator indicator) {
371 ProjectManagerEx.getInstanceEx().blockReloadingProjectOnExternalChanges();
372 myProjectLevelVcsManager.startBackgroundVcsOperation();
374 myBefore = LocalHistory.putSystemLabel(myProject, "Before update");
376 ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator();
378 try {
379 int toBeProcessed = myVcsToVirtualFiles.size();
380 int processed = 0;
381 for (AbstractVcs vcs : myVcsToVirtualFiles.keySet()) {
382 final UpdateEnvironment updateEnvironment = myActionInfo.getEnvironment(vcs);
383 updateEnvironment.fillGroups(myUpdatedFiles);
384 Collection<FilePath> files = myVcsToVirtualFiles.get(vcs);
386 final SequentialUpdatesContext context = myContextInfo.get(vcs);
387 final Ref<SequentialUpdatesContext> refContext = new Ref<SequentialUpdatesContext>(context);
388 UpdateSession updateSession =
389 updateEnvironment.updateDirectories(files.toArray(new FilePath[files.size()]), myUpdatedFiles, progressIndicator, refContext);
390 myContextInfo.put(vcs, refContext.get());
391 processed++;
392 if (progressIndicator != null) {
393 progressIndicator.setFraction((double)processed / (double)toBeProcessed);
395 final List<VcsException> exceptionList = updateSession.getExceptions();
396 gatherExceptions(vcs, exceptionList);
397 myUpdateSessions.add(updateSession);
399 } finally {
400 try {
401 if (progressIndicator != null) {
402 progressIndicator.setText(VcsBundle.message("progress.text.synchronizing.files"));
403 progressIndicator.setText2("");
405 doVfsRefresh();
406 } finally {
407 myAfter = LocalHistory.putSystemLabel(myProject, "After update");
408 myProjectLevelVcsManager.stopBackgroundVcsOperation();
413 private void gatherExceptions(final AbstractVcs vcs, final List<VcsException> exceptionList) {
414 final VcsExceptionsHotFixer fixer = vcs.getVcsExceptionsHotFixer();
415 if (fixer == null) {
416 putExceptions(null, exceptionList);
417 } else {
418 putExceptions(fixer.groupExceptions(ActionType.update, exceptionList));
422 private void putExceptions(final Map<HotfixData, List<VcsException>> map) {
423 for (Map.Entry<HotfixData, List<VcsException>> entry : map.entrySet()) {
424 putExceptions(entry.getKey(), entry.getValue());
428 private void putExceptions(final HotfixData key, @NotNull final List<VcsException> list) {
429 if (list.isEmpty()) return;
430 List<VcsException> exceptionList = myGroupedExceptions.get(key);
431 if (exceptionList == null) {
432 exceptionList = new ArrayList<VcsException>();
433 myGroupedExceptions.put(key, exceptionList);
435 exceptionList.addAll(list);
438 private void doVfsRefresh() {
439 final String actionName = VcsBundle.message("local.history.update.from.vcs");
440 final LocalHistoryAction action = LocalHistory.startAction(myProject, actionName);
441 try {
442 LOG.info("Calling refresh files after update for roots: " + Arrays.toString(myRoots));
443 RefreshVFsSynchronously.updateAllChanged(myUpdatedFiles);
445 finally {
446 action.finish();
447 LocalHistory.putSystemLabel(myProject, actionName);
451 @Nullable
452 public NotificationInfo getNotificationInfo() {
453 StringBuffer text = new StringBuffer();
454 final List<FileGroup> groups = myUpdatedFiles.getTopLevelGroups();
455 for (FileGroup group : groups) {
456 appendGroup(text, group);
459 return new NotificationInfo("VCS Update", "VCS Update Finished", text.toString(), true);
462 private void appendGroup(final StringBuffer text, final FileGroup group) {
463 final int s = group.getFiles().size();
464 if (s > 0) {
465 if (text.length() > 0) text.append("\n");
466 text.append(s + " Files " + group.getUpdateName());
469 final List<FileGroup> list = group.getChildren();
470 for (FileGroup g : list) {
471 appendGroup(text, g);
475 public void onSuccess() {
476 try {
477 onSuccessImpl();
478 } finally {
479 releaseIfNeeded();
483 private void onSuccessImpl() {
484 if (myProject.isDisposed()) {
485 ProjectManagerEx.getInstanceEx().unblockReloadingProjectOnExternalChanges();
486 return;
488 boolean continueChain = false;
489 for (SequentialUpdatesContext context : myContextInfo.values()) {
490 continueChain |= context != null;
492 final boolean continueChainFinal = continueChain;
494 final boolean someSessionWasCancelled = someSessionWasCanceled(myUpdateSessions);
495 if (! someSessionWasCancelled) {
496 for (final UpdateSession updateSession : myUpdateSessions) {
497 updateSession.onRefreshFilesCompleted();
501 if (myActionInfo.canChangeFileStatus()) {
502 final List<VirtualFile> files = new ArrayList<VirtualFile>();
503 final RemoteRevisionsCache revisionsCache = RemoteRevisionsCache.getInstance(myProject);
504 revisionsCache.invalidate(myUpdatedFiles);
505 UpdateFilesHelper.iterateFileGroupFiles(myUpdatedFiles, new UpdateFilesHelper.Callback() {
506 public void onFile(final String filePath, final String groupId) {
507 @NonNls final String path = VfsUtil.pathToUrl(filePath.replace(File.separatorChar, '/'));
508 final VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(path);
509 if (file != null) {
510 files.add(file);
514 myDirtyScopeManager.filesDirty(files, null);
517 final boolean updateSuccess = (! someSessionWasCancelled) && (myGroupedExceptions.isEmpty());
519 if (! someSessionWasCancelled) {
520 ApplicationManager.getApplication().invokeLater(new Runnable() {
521 public void run() {
522 if (myProject.isDisposed()) {
523 ProjectManagerEx.getInstanceEx().unblockReloadingProjectOnExternalChanges();
524 return;
526 if (! myGroupedExceptions.isEmpty()) {
527 if (continueChainFinal) {
528 gatherContextInterruptedMessages();
530 AbstractVcsHelper.getInstance(myProject).showErrors(myGroupedExceptions, VcsBundle.message("message.title.vcs.update.errors",
531 getTemplatePresentation().getText()));
533 else {
534 final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
535 if (indicator != null) {
536 indicator.setText(VcsBundle.message("progress.text.updating.done"));
540 final boolean noMerged = myUpdatedFiles.getGroupById(FileGroup.MERGED_WITH_CONFLICT_ID).isEmpty();
541 if (myUpdatedFiles.isEmpty() && myGroupedExceptions.isEmpty()) {
542 ToolWindowManager.getInstance(myProject).notifyByBalloon(
543 ChangesViewContentManager.TOOLWINDOW_ID, MessageType.INFO, getAllFilesAreUpToDateMessage(myRoots));
545 else if (! myUpdatedFiles.isEmpty()) {
546 showUpdateTree(continueChainFinal && updateSuccess && noMerged);
548 final CommittedChangesCache cache = CommittedChangesCache.getInstance(myProject);
549 cache.processUpdatedFiles(myUpdatedFiles);
552 ProjectManagerEx.getInstanceEx().unblockReloadingProjectOnExternalChanges();
554 if (continueChainFinal && updateSuccess) {
555 if (!noMerged) {
556 showContextInterruptedError();
557 } else {
558 // trigger next update; for CVS when updating from several branvhes simultaneously
559 reset();
560 ProgressManager.getInstance().run(Updater.this);
565 } else if (continueChain) {
566 // since error
567 showContextInterruptedError();
568 ProjectManagerEx.getInstanceEx().unblockReloadingProjectOnExternalChanges();
572 private void showContextInterruptedError() {
573 gatherContextInterruptedMessages();
574 AbstractVcsHelper.getInstance(myProject).showErrors(myGroupedExceptions,
575 VcsBundle.message("message.title.vcs.update.errors", getTemplatePresentation().getText()));
578 private void gatherContextInterruptedMessages() {
579 for (Map.Entry<AbstractVcs, SequentialUpdatesContext> entry : myContextInfo.entrySet()) {
580 final SequentialUpdatesContext context = entry.getValue();
581 if (context == null) continue;
582 final VcsException exception = new VcsException(context.getMessageWhenInterruptedBeforeStart());
583 gatherExceptions(entry.getKey(), Collections.singletonList(exception));
587 private void showUpdateTree(final boolean willBeContinued) {
588 RestoreUpdateTree restoreUpdateTree = RestoreUpdateTree.getInstance(myProject);
589 restoreUpdateTree.registerUpdateInformation(myUpdatedFiles, myActionInfo);
590 final String text = getTemplatePresentation().getText() + ((willBeContinued || (myUpdateNumber > 1)) ? ("#" + myUpdateNumber) : "");
591 final UpdateInfoTree updateInfoTree = myProjectLevelVcsManager.showUpdateProjectInfo(myUpdatedFiles, text, myActionInfo);
593 updateInfoTree.setBefore(myBefore);
594 updateInfoTree.setAfter(myAfter);
596 // todo make temporal listener of changes reload
597 if (updateInfoTree != null) {
598 updateInfoTree.setCanGroupByChangeList(canGroupByChangelist(myVcsToVirtualFiles.keySet()));
599 final MessageBusConnection messageBusConnection = myProject.getMessageBus().connect();
600 messageBusConnection.subscribe(CommittedChangesCache.COMMITTED_TOPIC, new CommittedChangesAdapter() {
601 public void incomingChangesUpdated(final List<CommittedChangeList> receivedChanges) {
602 if (receivedChanges != null) {
603 updateInfoTree.setChangeLists(receivedChanges);
604 messageBusConnection.disconnect();
611 public void onCancel() {
612 onSuccess();