Search in sources :

Example 1 with MacheteGeneratedBranch

use of com.virtuslab.gitmachete.frontend.file.grammar.MacheteGeneratedBranch in project git-machete-intellij-plugin by VirtusLab.

the class MacheteAnnotator method processMacheteGeneratedEntry.

@UIThreadUnsafe
private void processMacheteGeneratedEntry(MacheteGeneratedEntry macheteEntry, AnnotationHolder holder) {
    MacheteGeneratedBranch branch = macheteEntry.getBranch();
    PsiFile file = macheteEntry.getContainingFile();
    val branchNames = MacheteFileUtils.getBranchNamesForPsiFile(file);
    if (branchNames.isEmpty()) {
        if (!cantGetBranchesMessageWasShown) {
            UiThreadExecutionCompat.invokeLaterIfNeeded(NON_MODAL, () -> showCantGetBranchesMessage(file));
        }
        return;
    }
    cantGetBranchesMessageWasShown = false;
    val processedBranchName = branch.getText();
    if (!branchNames.contains(processedBranchName)) {
        holder.newAnnotation(HighlightSeverity.ERROR, format(getString("string.GitMachete.MacheteAnnotator.cannot-find-local-branch-in-repo"), processedBranchName)).range(branch).create();
    }
}
Also used : MacheteGeneratedBranch(com.virtuslab.gitmachete.frontend.file.grammar.MacheteGeneratedBranch) lombok.val(lombok.val) PsiFile(com.intellij.psi.PsiFile) UIThreadUnsafe(com.virtuslab.qual.guieffect.UIThreadUnsafe)

Aggregations

PsiFile (com.intellij.psi.PsiFile)1 MacheteGeneratedBranch (com.virtuslab.gitmachete.frontend.file.grammar.MacheteGeneratedBranch)1 UIThreadUnsafe (com.virtuslab.qual.guieffect.UIThreadUnsafe)1 lombok.val (lombok.val)1