final JButton testButton = WidgetFactory.createButton("Test connection", "images/actions/refresh.png");
testButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
JdbcDatastore datastore = createDatastore();
try {
Connection connection = datastore.createConnection();
connection.close();
JOptionPane.showMessageDialog(JdbcDatastoreDialog.this, "Connection successful!");
} catch (Throwable e) {
WidgetUtils.showErrorMessage("Could not establish connection", e);
}
}
});
final JButton saveButton = WidgetFactory.createButton("Save datastore", "images/model/datastore.png");
saveButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JdbcDatastore datastore = createDatastore();
if (_originalDatastore != null) {
_catalog.removeDatastore(_originalDatastore);
}
_catalog.addDatastore(datastore);