Skip to content

Commit

Permalink
When adding to the project view, don't show a popup if there is only …
Browse files Browse the repository at this point in the history
…one option.

Instead, just do it!

PiperOrigin-RevId: 586936092
  • Loading branch information
Googler authored and copybara-github committed Dec 1, 2023
1 parent bd253ff commit 8043a48
Showing 1 changed file with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package com.google.idea.blaze.base.qsync.action;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import com.google.errorprone.annotations.FormatMethod;
import com.google.errorprone.annotations.FormatString;
import com.google.idea.blaze.base.actions.BlazeProjectAction;
Expand Down Expand Up @@ -167,12 +168,17 @@ protected ImmutableList<CandidatePackage> compute(
workspacePathToAdd, progressIndicator::checkCanceled);
}
});
ListPopup popup =
JBPopupFactory.getInstance()
.createListPopup(
SelectPackagePopupStep.create(
candidatePackages, Performer.this::doAddToProjectView));
popup.showInBestPositionFor(event.getDataContext());

if (candidatePackages.size() == 1) {
doAddToProjectView(Iterables.getOnlyElement(candidatePackages));
} else {
ListPopup popup =
JBPopupFactory.getInstance()
.createListPopup(
SelectPackagePopupStep.create(
candidatePackages, Performer.this::doAddToProjectView));
popup.showInBestPositionFor(event.getDataContext());
}
} catch (BuildException e) {
notify(
NotificationType.ERROR,
Expand Down

0 comments on commit 8043a48

Please sign in to comment.