FileChooserFactory.getInstance().installFileCompletion(configFileTextField, descriptor, false, null);
myConfigFileTextFieldWithBrowseButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
PsiFile initialPsiFile = getConfigFile(project);
TreeFileChooserDialog fileChooser = new TreeFileChooserDialog(
project,
"Select JsTestDriver configuration file",
initialPsiFile,
JstdConfigFileType.INSTANCE,
new TreeFileChooser.PsiFileFilter() {
@Override
public boolean accept(PsiFile psiFile) {
return true;
}
},
false,
false
);
boolean jstdConfigFilesExists = JstdSettingsUtil.areJstdConfigFilesInProject(project);
if (jstdConfigFilesExists) {
fileChooser.selectSearchByNameTab();
}
fileChooser.showDialog();
PsiFile psiFile = fileChooser.getSelectedFile();
if (psiFile != null) {
VirtualFile vFile = psiFile.getVirtualFile();
if (vFile != null) {
String path = FileUtil.toSystemDependentName(vFile.getPath());
configFileTextField.setText(path);