use of com.google.jstestdriver.idea.util.TextChangeListener in project intellij-plugins by JetBrains.
the class AllInDirectoryRunSettingsSection method createInfoComponent.
private static JComponent createInfoComponent(@NotNull final Project project, @NotNull JTextField directoryTextField) {
JPanel panel = new JPanel(new BorderLayout());
panel.add(new JLabel("Matched configuration files (*.jstd and jsTestDriver.conf):"), BorderLayout.NORTH);
final JBList fileList = new JBList(ArrayUtil.EMPTY_STRING_ARRAY);
fileList.setBorder(BorderFactory.createLineBorder(JBColor.GRAY));
fileList.setCellRenderer(new ListCellRendererWrapper<String>() {
@Override
public void customize(JList list, String value, int index, boolean selected, boolean hasFocus) {
setText(value);
}
});
SwingUtils.addTextChangeListener(directoryTextField, new TextChangeListener() {
@Override
public void textChanged(String oldText, @NotNull String newText) {
List<String> configs = getConfigsInDir(project, newText);
fileList.setListData(configs.toArray());
}
});
panel.add(fileList, BorderLayout.CENTER);
return panel;
}
use of com.google.jstestdriver.idea.util.TextChangeListener in project intellij-plugins by JetBrains.
the class TestCaseRunSettingsSection method trackJsTestFilePathChanges.
private void trackJsTestFilePathChanges(@NotNull final Project project) {
SwingUtils.addTextChangeListener(myJsFileRunSettingsSection.getJsTestFileTextField(), new TextChangeListener() {
@Override
public void textChanged(String oldJsTestFilePath, @NotNull String newJsTestFilePath) {
String oldValue = getTestCaseName();
try {
updateTestCaseVariants(project, newJsTestFilePath);
fireStateChanged(project);
} finally {
myTestCaseNameComboBox.setSelectedItem(oldValue);
}
}
});
myTestCaseNameComboBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
fireStateChanged(project);
}
});
}
Aggregations