@Override public void run(ContinuationContext context) { final String message; final Intersection intersection; final ChangeListManager listManager = ChangeListManager.getInstance(myProject); final List<LocalChangeList> localChangeLists = listManager.getChangeListsCopy(); if (myMergeAll) { intersection = getMergeAllIntersection(localChangeLists); message = "There are local changes that can potentially intersect with merge changes.\nDo you want to continue?"; } else { intersection = checkIntersection(myLists, localChangeLists); message = "There are local changes that will intersect with merge changes.\nDo you want to continue?"; } if (intersection == null || intersection.getChangesSubset().isEmpty()) return; final LocalChangesAction action; if (!myMergeAll) { final LocalChangesAction[] possibleResults = { LocalChangesAction.shelve, LocalChangesAction.inspect, LocalChangesAction.continueMerge, LocalChangesAction.cancel }; final int result = Messages.showDialog( message, myTitle, new String[] { "Shelve local changes", "Inspect changes", "Continue merge", "Cancel" }, 0, Messages.getQuestionIcon()); action = possibleResults[result]; } else { final LocalChangesAction[] possibleResults = { LocalChangesAction.shelve, LocalChangesAction.continueMerge, LocalChangesAction.cancel }; final int result = Messages.showDialog( message, myTitle, new String[] {"Shelve local changes", "Continue merge", "Cancel"}, 0, Messages.getQuestionIcon()); action = possibleResults[result]; } switch (action) { // shelve case shelve: context.next(new ShelveLocalChanges(intersection)); return; // cancel case cancel: context.cancelEverything(); return; // continue case continueMerge: return; // inspect case inspect: final Collection<Change> changes = (Collection<Change>) intersection.getChangesSubset().values(); final List<FilePath> paths = ChangesUtil.getPaths(changes); Collections.sort(paths, FilePathByPathComparator.getInstance()); // todo rework message IntersectingLocalChangesPanel.showInVersionControlToolWindow( myProject, myTitle + ", local changes intersection", paths, "The following file(s) have local changes that will intersect with merge changes:"); context.cancelEverything(); return; default: } }