Fix the problem where the PresetModel drop down was not closing when the ComponentPresetChooserDialog is opened.

This commit is contained in:
Kevin Ruland 2012-04-12 04:12:45 +00:00
parent f92034db56
commit ef8499e6a8

View File

@ -65,14 +65,18 @@ public class PresetModel extends AbstractListModel implements ComboBoxModel, Com
} else if (item.equals(NONE_SELECTED)) {
component.clearPreset();
} else if (item.equals(SELECT_DATABASE)) {
// FIXME - when the dialog first appears, the preset drop down still is open and has focus.
// we need to force focus to the new dialog.
SwingUtilities.invokeLater( new Runnable() {
@Override
public void run() {
ComponentPresetChooserDialog dialog =
new ComponentPresetChooserDialog( SwingUtilities.getWindowAncestor(PresetModel.this.parent),
PresetModel.this.component);
dialog.setVisible(true);
ComponentPreset preset = dialog.getSelectedComponentPreset();
setSelectedItem(preset);
}
});
} else {
// FIXME: Add undo point here
component.loadPreset((ComponentPreset) item);