Search in sources :

Example 1 with DeleteBranchOnSlideOutSuggestionDialog

use of com.virtuslab.gitmachete.frontend.actions.dialogs.DeleteBranchOnSlideOutSuggestionDialog in project git-machete-intellij-plugin by VirtusLab.

the class BaseSlideOutBranchAction method suggestBranchDeletion.

@UIEffect
private void suggestBranchDeletion(AnActionEvent anActionEvent, String branchName, GitRepository gitRepository, Project project) {
    val slideOutOptions = new DeleteBranchOnSlideOutSuggestionDialog(project).showAndGetSlideOutOptions();
    new Task.Backgroundable(project, "Deleting branch if required...") {

        @Override
        @UIThreadUnsafe
        public void run(ProgressIndicator indicator) {
            if (slideOutOptions != null) {
                handleBranchDeletionDecision(project, branchName, gitRepository, anActionEvent, slideOutOptions.shouldDelete());
                if (slideOutOptions.shouldRemember()) {
                    val value = String.valueOf(slideOutOptions.shouldDelete());
                    setDeleteLocalBranchOnSlideOutGitConfigValue(project, gitRepository.getRoot(), value);
                }
            } else {
                val title = getString("action.GitMachete.BaseSlideOutBranchAction.notification.title.slide-out-info.canceled");
                val message = format(getString("action.GitMachete.BaseSlideOutBranchAction.notification.message.slide-out-info.canceled"), branchName);
                IntelliJNotificationCompat.notifyInfo(project, title, message);
            }
        }
    }.queue();
}
Also used : lombok.val(lombok.val) DeleteBranchOnSlideOutSuggestionDialog(com.virtuslab.gitmachete.frontend.actions.dialogs.DeleteBranchOnSlideOutSuggestionDialog) Task(com.intellij.openapi.progress.Task) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) UIThreadUnsafe(com.virtuslab.qual.guieffect.UIThreadUnsafe) UIEffect(org.checkerframework.checker.guieffect.qual.UIEffect)

Aggregations

ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)1 Task (com.intellij.openapi.progress.Task)1 DeleteBranchOnSlideOutSuggestionDialog (com.virtuslab.gitmachete.frontend.actions.dialogs.DeleteBranchOnSlideOutSuggestionDialog)1 UIThreadUnsafe (com.virtuslab.qual.guieffect.UIThreadUnsafe)1 lombok.val (lombok.val)1 UIEffect (org.checkerframework.checker.guieffect.qual.UIEffect)1