cachedForms.clear();
super.dispose();
}
private void switchSettingsPanel(ConnectionSettings connectionSettings) {
CardLayout cardLayout = (CardLayout) connectionSetupPanel.getLayout();
if (connectionSettings == null) {
cardLayout.show(connectionSetupPanel, BLANK_PANEL_ID);
} else {
ConnectionSettingsForm currentForm = cachedForms.get(currentPanelId);
String selectedTabName = currentForm == null ? null : currentForm.getSelectedTabName();
currentPanelId = connectionSettings.getDatabaseSettings().getId();
if (!cachedForms.keySet().contains(currentPanelId)) {
JComponent setupPanel = connectionSettings.createComponent();
this.connectionSetupPanel.add(setupPanel, currentPanelId);
cachedForms.put(currentPanelId, connectionSettings.getSettingsEditor());
}
ConnectionSettingsForm settingsEditor = connectionSettings.getSettingsEditor();
if (settingsEditor != null) {
settingsEditor.selectTab(selectedTabName);
}
cardLayout.show(connectionSetupPanel, currentPanelId);
}
}