Search in sources :

Example 1 with UpdateInfoTree

use of com.intellij.openapi.vcs.update.UpdateInfoTree in project intellij-community by JetBrains.

the class ProjectLevelVcsManagerImpl method showUpdateProjectInfo.

@Override
public UpdateInfoTree showUpdateProjectInfo(UpdatedFiles updatedFiles, String displayActionName, ActionInfo actionInfo, boolean canceled) {
    if (!myProject.isOpen() || myProject.isDisposed())
        return null;
    ContentManager contentManager = getContentManager();
    if (contentManager == null) {
        // content manager is made null during dispose; flag is set later
        return null;
    }
    final UpdateInfoTree updateInfoTree = new UpdateInfoTree(contentManager, myProject, updatedFiles, displayActionName, actionInfo);
    ContentUtilEx.addTabbedContent(contentManager, updateInfoTree, "Update Info", DateFormatUtil.formatDateTime(System.currentTimeMillis()), true, updateInfoTree);
    ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.VCS).activate(null);
    updateInfoTree.expandRootChildren();
    return updateInfoTree;
}
Also used : ContentManager(com.intellij.ui.content.ContentManager) UpdateInfoTree(com.intellij.openapi.vcs.update.UpdateInfoTree)

Example 2 with UpdateInfoTree

use of com.intellij.openapi.vcs.update.UpdateInfoTree in project intellij-community by JetBrains.

the class GitMergeUtil method showUpdates.

/**
   * Show updates caused by git operation
   *
   * @param project     the context project
   * @param exceptions  the exception list
   * @param root        the git root
   * @param currentRev  the revision before update
   * @param beforeLabel the local history label before update
   * @param actionName  the action name
   * @param actionInfo  the information about the action
   */
public static void showUpdates(final Project project, final List<VcsException> exceptions, final VirtualFile root, final GitRevisionNumber currentRev, final Label beforeLabel, final String actionName, final ActionInfo actionInfo) {
    UpdatedFiles files = UpdatedFiles.create();
    MergeChangeCollector collector = new MergeChangeCollector(project, root, currentRev);
    collector.collect(files, exceptions);
    if (!exceptions.isEmpty())
        return;
    GuiUtils.invokeLaterIfNeeded(() -> {
        ProjectLevelVcsManagerEx manager = (ProjectLevelVcsManagerEx) ProjectLevelVcsManager.getInstance(project);
        UpdateInfoTree tree = manager.showUpdateProjectInfo(files, actionName, actionInfo, false);
        tree.setBefore(beforeLabel);
        tree.setAfter(LocalHistory.getInstance().putSystemLabel(project, "After update"));
    }, ModalityState.defaultModalityState());
    Collection<String> unmergedNames = files.getGroupById(FileGroup.MERGED_WITH_CONFLICT_ID).getFiles();
    if (!unmergedNames.isEmpty()) {
        List<VirtualFile> unmerged = mapNotNull(unmergedNames, name -> LocalFileSystem.getInstance().findFileByPath(name));
        GuiUtils.invokeLaterIfNeeded(() -> {
            GitVcs vcs = GitVcs.getInstance(project);
            if (vcs != null) {
                AbstractVcsHelper.getInstance(project).showMergeDialog(unmerged, vcs.getMergeProvider());
            }
        }, ModalityState.defaultModalityState());
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) GitVcs(git4idea.GitVcs) ProjectLevelVcsManagerEx(com.intellij.openapi.vcs.ex.ProjectLevelVcsManagerEx) UpdatedFiles(com.intellij.openapi.vcs.update.UpdatedFiles) UpdateInfoTree(com.intellij.openapi.vcs.update.UpdateInfoTree)

Aggregations

UpdateInfoTree (com.intellij.openapi.vcs.update.UpdateInfoTree)2 ProjectLevelVcsManagerEx (com.intellij.openapi.vcs.ex.ProjectLevelVcsManagerEx)1 UpdatedFiles (com.intellij.openapi.vcs.update.UpdatedFiles)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 ContentManager (com.intellij.ui.content.ContentManager)1 GitVcs (git4idea.GitVcs)1