Skip to content

Ghidra is a software reverse engineering (SRE) framework

Update theming code to clear UIDefaults values; undo test call to change the Look and Feel

dragonmacherfc5bb69cbc0c
diff --git a/Ghidra/Framework/Gui/src/main/java/generic/test/AbstractGuiTest.java b/Ghidra/Framework/Gui/src/main/java/generic/test/AbstractGuiTest.java
index 6b7b987f6d..b589decc8e 100644
--- a/Ghidra/Framework/Gui/src/main/java/generic/test/AbstractGuiTest.java
+++ b/Ghidra/Framework/Gui/src/main/java/generic/test/AbstractGuiTest.java
@@ -1092,28 +1092,7 @@ public class AbstractGuiTest extends AbstractGenericTest {
* running <code>doRun</code>
*/
public static void fixupGUI() throws InterruptedException, InvocationTargetException {
- // Make the test look & feel as it would normally.
- SwingUtilities.invokeAndWait(() -> {
- try {
- UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
- }
- catch (ClassNotFoundException e1) {
- // don't care
- }
- catch (InstantiationException e2) {
- // don't care
- }
- catch (IllegalAccessException e3) {
- // don't care
- }
- catch (UnsupportedLookAndFeelException e4) {
- // don't care
- }
- });
- // Fix up the default fonts that Java 1.5.0 changed to Courier, which looked terrible.
- Font f = new Font("monospaced", Font.PLAIN, 12);
- UIManager.put("PasswordField.font", f);
- UIManager.put("TextArea.font", f);
+ // here to prevent compiler errors; should not be needed now that we have theming
}
/**
diff --git a/Ghidra/Framework/Gui/src/main/java/generic/theme/laf/LookAndFeelManager.java b/Ghidra/Framework/Gui/src/main/java/generic/theme/laf/LookAndFeelManager.java
index c9973ba03e..8c4559d7af 100644
--- a/Ghidra/Framework/Gui/src/main/java/generic/theme/laf/LookAndFeelManager.java
+++ b/Ghidra/Framework/Gui/src/main/java/generic/theme/laf/LookAndFeelManager.java
@@ -70,6 +70,7 @@ public abstract class LookAndFeelManager {
public void installLookAndFeel() throws ClassNotFoundException, InstantiationException,
IllegalAccessException, UnsupportedLookAndFeelException {
+ clearUiDefaults();
doInstallLookAndFeel();
processJavaDefaults();
fixupLookAndFeelIssues();
@@ -77,6 +78,16 @@ public abstract class LookAndFeelManager {
updateComponentUis();
}
+ protected void clearUiDefaults() {
+ /*
+ The UIDefaults extends hash table. It has 2 layers into which it puts values: the base
+ hash table and the set of tables created by the Look and Feel. When the LaF changes,
+ any values it puts in will get replaced. Any values we put in will be in the non-Laf
+ layer. Thus, to remove our old values, we need to clear the main hash table.
+ */
+ UIManager.getDefaults().clear();
+ }
+
/**
* Called when all colors, fonts, and icons may have changed
* @param javaDefaults the current set of java defaults so that those ids can be updated