Search in sources :

Example 1 with OverrideForkPointDialog

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

the class BaseOverrideForkPointAction method actionPerformed.

@Override
@UIEffect
public void actionPerformed(AnActionEvent anActionEvent) {
    val project = getProject(anActionEvent);
    val gitRepository = getSelectedGitRepository(anActionEvent).getOrNull();
    val branchUnderAction = getNameOfBranchUnderAction(anActionEvent);
    val branch = branchUnderAction.flatMap(pn -> getManagedBranchByName(anActionEvent, pn)).getOrNull();
    if (gitRepository == null || branch == null || branch.isRoot()) {
        return;
    }
    val nonRootBranch = branch.asNonRoot();
    val selectedCommit = new OverrideForkPointDialog(project, nonRootBranch.getParent(), nonRootBranch).showAndGetSelectedCommit();
    if (selectedCommit == null) {
        log().debug("Commit selected to be the new fork point is null: most likely the action has been canceled from override-fork-point dialog");
        return;
    }
    LOG.debug("Enqueueing fork point override");
    new Task.Backgroundable(project, "Overriding fork point...") {

        @Override
        @UIThreadUnsafe
        public void run(ProgressIndicator indicator) {
            overrideForkPoint(anActionEvent, branch, selectedCommit);
        }
    }.queue();
}
Also used : lombok.val(lombok.val) GENERAL(org.checkerframework.checker.i18nformatter.qual.I18nConversionCategory.GENERAL) ICommitOfManagedBranch(com.virtuslab.gitmachete.backend.api.ICommitOfManagedBranch) VirtualFile(com.intellij.openapi.vfs.VirtualFile) lombok.val(lombok.val) IManagedBranchSnapshot(com.virtuslab.gitmachete.backend.api.IManagedBranchSnapshot) CustomLog(lombok.CustomLog) SyncToParentStatus(com.virtuslab.gitmachete.backend.api.SyncToParentStatus) List(io.vavr.collection.List) GitMacheteBundle.getString(com.virtuslab.gitmachete.frontend.resourcebundles.GitMacheteBundle.getString) I18nFormat(org.checkerframework.checker.i18nformatter.qual.I18nFormat) IExpectsKeyGitMacheteRepository(com.virtuslab.gitmachete.frontend.actions.expectedkeys.IExpectsKeyGitMacheteRepository) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) UIEffect(org.checkerframework.checker.guieffect.qual.UIEffect) Task(com.intellij.openapi.progress.Task) UIThreadUnsafe(com.virtuslab.qual.guieffect.UIThreadUnsafe) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) IEnhancedLambdaLogger(com.virtuslab.logger.IEnhancedLambdaLogger) Project(com.intellij.openapi.project.Project) GitConfigUtil(git4idea.config.GitConfigUtil) VcsException(com.intellij.openapi.vcs.VcsException) OverrideForkPointDialog(com.virtuslab.gitmachete.frontend.actions.dialogs.OverrideForkPointDialog) Task(com.intellij.openapi.progress.Task) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) OverrideForkPointDialog(com.virtuslab.gitmachete.frontend.actions.dialogs.OverrideForkPointDialog) UIThreadUnsafe(com.virtuslab.qual.guieffect.UIThreadUnsafe) UIEffect(org.checkerframework.checker.guieffect.qual.UIEffect)

Aggregations

AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)1 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)1 Task (com.intellij.openapi.progress.Task)1 Project (com.intellij.openapi.project.Project)1 VcsException (com.intellij.openapi.vcs.VcsException)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 ICommitOfManagedBranch (com.virtuslab.gitmachete.backend.api.ICommitOfManagedBranch)1 IManagedBranchSnapshot (com.virtuslab.gitmachete.backend.api.IManagedBranchSnapshot)1 SyncToParentStatus (com.virtuslab.gitmachete.backend.api.SyncToParentStatus)1 OverrideForkPointDialog (com.virtuslab.gitmachete.frontend.actions.dialogs.OverrideForkPointDialog)1 IExpectsKeyGitMacheteRepository (com.virtuslab.gitmachete.frontend.actions.expectedkeys.IExpectsKeyGitMacheteRepository)1 GitMacheteBundle.getString (com.virtuslab.gitmachete.frontend.resourcebundles.GitMacheteBundle.getString)1 IEnhancedLambdaLogger (com.virtuslab.logger.IEnhancedLambdaLogger)1 UIThreadUnsafe (com.virtuslab.qual.guieffect.UIThreadUnsafe)1 GitConfigUtil (git4idea.config.GitConfigUtil)1 List (io.vavr.collection.List)1 CustomLog (lombok.CustomLog)1 lombok.val (lombok.val)1 UIEffect (org.checkerframework.checker.guieffect.qual.UIEffect)1 GENERAL (org.checkerframework.checker.i18nformatter.qual.I18nConversionCategory.GENERAL)1