Skip to content

Commit daca354

Browse files
committed
Merge remote-tracking branch
'origin/GP-4172_ghidragon_theme_switch_dialog--SQUASHED' (Closes NationalSecurityAgency#6024)
2 parents 676e60f + e98aac1 commit daca354

File tree

2 files changed

+10
-21
lines changed

2 files changed

+10
-21
lines changed

Ghidra/Framework/Docking/src/main/help/help/topics/Theming/ThemingUserDocs.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ <H2>Theme Chooser Dialog<A name="Switch_Theme"></A></H2>
3232
<P align="center"><IMG alt="" src="images/ThemeChooserDialog.png"><BR>
3333
&nbsp;</P>
3434

35-
<P>The Theme Chooser dialog displays a list of all the know themes, both built-in and custom.
36-
As you pick different themes, the application will switch to that theme. Press the "OK" button
37-
when the desired theme is selected. Pressing the "Cancel" button will restore the theme to
38-
the what it was when the dialog was invoked.</P>
35+
<P>The Theme Chooser dialog displays a list of all the known themes, both built-in and custom.
36+
Select the desired theme and press the "OK" button to have the application switch to that
37+
theme. Pressing the "Cancel" button will exit the dialog without changing the theme. You
38+
can also double click on a theme to switch to that theme and exit the dialog.</P>
3939

4040
</BlOCKQUOTE>
4141

Ghidra/Framework/Project/src/main/java/ghidra/app/plugin/gui/ThemeChooserDialog.java

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,21 @@ public class ThemeChooserDialog extends DialogComponentProvider {
3535
public ThemeChooserDialog(ThemeManager themeManager) {
3636
super("Change Theme");
3737
this.themeManager = themeManager;
38+
3839
addWorkPanel(buildMainPanel());
3940
addOKButton();
40-
addApplyButton();
4141
addCancelButton();
4242
setRememberSize(false);
4343
setHelpLocation(new HelpLocation("Theming", "Switch_Theme"));
44-
updateOkApplyButtons();
44+
updateButtonEnablement();
4545
}
4646

47-
private void updateOkApplyButtons() {
47+
private void updateButtonEnablement() {
4848

4949
GTheme selectedValue = listPanel.getSelectedValue();
5050
GTheme currentTheme = themeManager.getActiveTheme();
5151
boolean canApplyTheme = selectedValue != null && !currentTheme.equals(selectedValue);
5252
setOkEnabled(canApplyTheme);
53-
setApplyEnabled(canApplyTheme);
5453
}
5554

5655
@Override
@@ -59,22 +58,12 @@ protected void okCallback() {
5958
close();
6059
}
6160

62-
@Override
63-
protected void applyCallback() {
64-
applyTheme();
65-
}
66-
6761
private void applyTheme() {
6862
GTheme selectedValue = listPanel.getSelectedValue();
69-
if (selectedValue == null) {
70-
return;
71-
}
7263
GTheme activeTheme = themeManager.getActiveTheme();
73-
if (selectedValue != activeTheme) {
64+
if (selectedValue != null && selectedValue != activeTheme) {
7465
Swing.runLater(() -> themeManager.setTheme(selectedValue));
7566
}
76-
setOkEnabled(false);
77-
setApplyEnabled(false);
7867
}
7968

8069
protected void cancelCallback() {
@@ -93,12 +82,12 @@ private JComponent buildMainPanel() {
9382
listPanel.setSelectedValue(activeTheme);
9483
listPanel.addListSelectionListener(e -> selectionChanged());
9584
panel.add(listPanel);
96-
85+
listPanel.setDoubleClickActionListener(e -> okCallback());
9786
return panel;
9887
}
9988

10089
private void selectionChanged() {
101-
updateOkApplyButtons();
90+
updateButtonEnablement();
10291
}
10392

10493
private class ThemeListModel extends AbstractListModel<GTheme> {

0 commit comments

Comments
 (0)