Ghidra is a software reverse engineering (SRE) framework
GP-4172 simplified theme switcher dialog. Also added in double click to pick and exit
ghidragone98aac1e6765
diff --git a/Ghidra/Framework/Docking/src/main/help/help/topics/Theming/ThemingUserDocs.html b/Ghidra/Framework/Docking/src/main/help/help/topics/Theming/ThemingUserDocs.htmlindex 67fc52ce8d..0b3ce4947e 100644--- a/Ghidra/Framework/Docking/src/main/help/help/topics/Theming/ThemingUserDocs.html+++ b/Ghidra/Framework/Docking/src/main/help/help/topics/Theming/ThemingUserDocs.html@@ -32,10 +32,10 @@<P align="center"><IMG alt="" src="images/ThemeChooserDialog.png"><BR> </P>- <P>The Theme Chooser dialog displays a list of all the know themes, both built-in and custom.- As you pick different themes, the application will switch to that theme. Press the "OK" button- when the desired theme is selected. Pressing the "Cancel" button will restore the theme to- the what it was when the dialog was invoked.</P>+ <P>The Theme Chooser dialog displays a list of all the known themes, both built-in and custom.+ Select the desired theme and press the "OK" button to have the application switch to that+ theme. Pressing the "Cancel" button will exit the dialog without changing the theme. You+ can also double click on a theme to switch to that theme and exit the dialog.</P></BlOCKQUOTE>diff --git a/Ghidra/Framework/Project/src/main/java/ghidra/app/plugin/gui/ThemeChooserDialog.java b/Ghidra/Framework/Project/src/main/java/ghidra/app/plugin/gui/ThemeChooserDialog.javaindex 925fb7eddf..32dfa7c461 100644--- a/Ghidra/Framework/Project/src/main/java/ghidra/app/plugin/gui/ThemeChooserDialog.java+++ b/Ghidra/Framework/Project/src/main/java/ghidra/app/plugin/gui/ThemeChooserDialog.java@@ -35,22 +35,21 @@ public class ThemeChooserDialog extends DialogComponentProvider {public ThemeChooserDialog(ThemeManager themeManager) {super("Change Theme");this.themeManager = themeManager;+addWorkPanel(buildMainPanel());addOKButton();- addApplyButton();addCancelButton();setRememberSize(false);setHelpLocation(new HelpLocation("Theming", "Switch_Theme"));- updateOkApplyButtons();+ updateButtonEnablement();}- private void updateOkApplyButtons() {+ private void updateButtonEnablement() {GTheme selectedValue = listPanel.getSelectedValue();GTheme currentTheme = themeManager.getActiveTheme();boolean canApplyTheme = selectedValue != null && !currentTheme.equals(selectedValue);setOkEnabled(canApplyTheme);- setApplyEnabled(canApplyTheme);}@Override@@ -59,22 +58,12 @@ public class ThemeChooserDialog extends DialogComponentProvider {close();}- @Override- protected void applyCallback() {- applyTheme();- }-private void applyTheme() {GTheme selectedValue = listPanel.getSelectedValue();- if (selectedValue == null) {- return;- }GTheme activeTheme = themeManager.getActiveTheme();- if (selectedValue != activeTheme) {+ if (selectedValue != null && selectedValue != activeTheme) {Swing.runLater(() -> themeManager.setTheme(selectedValue));}- setOkEnabled(false);- setApplyEnabled(false);}protected void cancelCallback() {@@ -93,12 +82,12 @@ public class ThemeChooserDialog extends DialogComponentProvider {listPanel.setSelectedValue(activeTheme);listPanel.addListSelectionListener(e -> selectionChanged());panel.add(listPanel);-+ listPanel.setDoubleClickActionListener(e -> okCallback());return panel;}private void selectionChanged() {- updateOkApplyButtons();+ updateButtonEnablement();}private class ThemeListModel extends AbstractListModel<GTheme> {