ChooseByNamePanel (@NotNull Project project, boolean useClass) { //@formatter:off ChooseByNameModel model = useClass ? new GotoClassModel2(project) { @Override public boolean loadInitialCheckBoxState() { return true; } @Override public void saveInitialCheckBoxState(boolean state) {} @Override public@Nullable String getPromptText() { return null; }} : new GotoFileModel(project) { @Override public boolean loadInitialCheckBoxState() { return true; } @Override public void saveInitialCheckBoxState(boolean state) {} @Override public String getPromptText() { return null; }}; //@formatter:on ChooseByNamePanel panel = new ChooseByNamePanel(project, model, "", false, null) { @Override protected void showTextFieldPanel() { } @Override protected void close(boolean isOk) { super.close(isOk); if (isOk) { final List<Object> elements = getChosenElements(); if (!elements.isEmpty()) { myActionListener.elementChosen(elements.get(0)); } doOKAction(); } else { doCancelAction(); } } }; UiNotifyConnector.doWhenFirstShown(panel.getPanel(), () -> { panel.invoke(new ChooseByNamePopupComponent.Callback() { @Override public void elementChosen(Object element) { setSelection(element); } }, ModalityState.stateForComponent(getRootPane()), false); }); Disposer.register(myDisposable, panel); return panel; }