void (final Project project, final TextFieldWithBrowseButton field) { field.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final PsiClass selected = selectMainClass(project, field.getText()); if (selected != null) { field.setText(selected.getQualifiedName()); } } }); }