Search in sources :

Example 1 with HgQGotoCommand

use of org.zmlx.hg4idea.command.mq.HgQGotoCommand in project intellij-community by JetBrains.

the class HgQGotoFromLogAction method actionPerformed.

protected void actionPerformed(@NotNull final HgRepository repository, @NotNull final VcsFullCommitDetails commit) {
    final Project project = repository.getProject();
    List<Hash> parents = commit.getParents();
    final Hash parentHash = parents.isEmpty() ? null : parents.get(0);
    final HgNameWithHashInfo parentPatchName = ContainerUtil.find(repository.getMQAppliedPatches(), new Condition<HgNameWithHashInfo>() {

        @Override
        public boolean value(HgNameWithHashInfo info) {
            return info.getHash().equals(parentHash);
        }
    });
    new Task.Backgroundable(repository.getProject(), parentPatchName != null ? HgVcsMessages.message("hg4idea.mq.progress.goto", parentPatchName) : HgVcsMessages.message("hg4idea.mq.progress.pop")) {

        @Override
        public void run(@NotNull ProgressIndicator indicator) {
            if (parentPatchName != null) {
                new HgQGotoCommand(repository).executeInCurrentThread(parentPatchName.getName());
            } else {
                new HgQPopCommand(repository).executeInCurrentThread();
            }
        }

        @Override
        public void onSuccess() {
            HgShowUnAppliedPatchesAction.showUnAppliedPatches(project, repository);
        }
    }.queue();
}
Also used : HgQGotoCommand(org.zmlx.hg4idea.command.mq.HgQGotoCommand) Project(com.intellij.openapi.project.Project) Task(com.intellij.openapi.progress.Task) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) Hash(com.intellij.vcs.log.Hash) HgNameWithHashInfo(org.zmlx.hg4idea.HgNameWithHashInfo) HgQPopCommand(org.zmlx.hg4idea.command.mq.HgQPopCommand)

Aggregations

ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)1 Task (com.intellij.openapi.progress.Task)1 Project (com.intellij.openapi.project.Project)1 Hash (com.intellij.vcs.log.Hash)1 HgNameWithHashInfo (org.zmlx.hg4idea.HgNameWithHashInfo)1 HgQGotoCommand (org.zmlx.hg4idea.command.mq.HgQGotoCommand)1 HgQPopCommand (org.zmlx.hg4idea.command.mq.HgQPopCommand)1