use of com.intellij.openapi.ui.popup.PopupChooserBuilder in project intellij-plugins by StepicOrg.
the class DownloadSubmission method showPopup.
private void showPopup(@NotNull Project project, @NotNull StepNode stepNode, @NotNull List<Submission> submissions) {
JBPopupFactory popupFactory = JBPopupFactory.getInstance();
PopupChooserBuilder builder;
if (!submissions.isEmpty()) {
JList<SubmissionDecorator> list;
List<SubmissionDecorator> submissionDecorators = submissions.stream().map(SubmissionDecorator::new).collect(Collectors.toList());
list = new JBList<>(submissionDecorators);
builder = popupFactory.createListPopupBuilder(list).addListener(new Listener(list, project, stepNode));
} else {
JList<String> emptyList = new JBList<>("Empty");
builder = popupFactory.createListPopupBuilder(emptyList);
}
builder = builder.setTitle("Choose submission");
JBPopup popup = builder.createPopup();
popup.showCenteredInCurrentWindow(project);
}
Aggregations