use of com.intellij.ide.util.PsiElementListCellRenderer in project intellij-community by JetBrains.
the class GrCreateFromUsageBaseFix method chooseClass.
private void chooseClass(List<PsiClass> classes, Editor editor) {
final Project project = classes.get(0).getProject();
final JList list = new JBList(classes);
PsiElementListCellRenderer renderer = new PsiClassListCellRenderer();
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
list.setCellRenderer(renderer);
final PopupChooserBuilder builder = new PopupChooserBuilder(list);
renderer.installSpeedSearch(builder);
Runnable runnable = () -> {
int index = list.getSelectedIndex();
if (index < 0)
return;
final PsiClass aClass = (PsiClass) list.getSelectedValue();
CommandProcessor.getInstance().executeCommand(project, () -> ApplicationManager.getApplication().runWriteAction(() -> invokeImpl(project, aClass)), getText(), null);
};
builder.setTitle(QuickFixBundle.message("target.class.chooser.title")).setItemChoosenCallback(runnable).createPopup().showInBestPositionFor(editor);
}
Aggregations