Ghidra is a software reverse engineering (SRE) framework
Undo of previous change for html labels
dragonmacheracd4e04088ec
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/widgets/label/AbstractHtmlLabel.java b/Ghidra/Framework/Docking/src/main/java/docking/widgets/label/AbstractHtmlLabel.javaindex 2cd204c4cc..6266f4d05a 100644--- a/Ghidra/Framework/Docking/src/main/java/docking/widgets/label/AbstractHtmlLabel.java+++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/label/AbstractHtmlLabel.java@@ -34,21 +34,22 @@ import ghidra.util.WebColors;import ghidra.util.exception.AssertException;/**- * Base class for labels that render html using a custom rendering kit.+ * Base class for labels that render HTML using a custom rendering kit.* <p>* This implementation uses custom html rendering. This custom rendering allows for basic- * formatting while eliminating potentially unsafe html tags. If for some reason this custom+ * formatting while eliminating potentially unsafe HTML tags. If for some reason this custom* rendering is deficient, clients can instead use a standard Java {@link JLabel}.* <p>- * Clients do not need to prefix label text with "<html>", as is required for a standard- * JLabel.+ * This abstract class supports rendering as HTML or non-HTML text. The text set on this label+ * must include the "<html>" prefix to be rendered as html. See subclasses for expected+ * usage.*/public abstract class AbstractHtmlLabel extends JLabelimplements GComponent, PropertyChangeListener {private static final String HTML_TAG = "<html>";private boolean isUpdating;- private boolean expectsHtmlPrefix;+ private boolean isHtml;protected AbstractHtmlLabel() {addPropertyChangeListener(this);@@ -65,10 +66,10 @@ public abstract class AbstractHtmlLabel extends JLabel// do not pass <html> up to the parent so that it does not install its own html renderingif (text != null && text.toLowerCase().startsWith(HTML_TAG)) {text = text.substring(HTML_TAG.length());- expectsHtmlPrefix = true;+ isHtml = true;}else {- expectsHtmlPrefix = false;+ isHtml = false;}super.setText(text);@@ -85,7 +86,7 @@ public abstract class AbstractHtmlLabel extends JLabel* @return text of this label*/public String getOriginalText() {- return expectsHtmlPrefix ? HTML_TAG + getText() : getText();+ return isHtml ? HTML_TAG + getText() : getText();}@Override@@ -97,7 +98,7 @@ public abstract class AbstractHtmlLabel extends JLabelprivate void updateHtmlView() {String text = getText();- if (text == null || !isHTMLRenderingEnabled()) {+ if (text == null || !isHtml || !isHTMLRenderingEnabled()) {putClientProperty(BasicHTML.propertyKey, null);return;}diff --git a/Ghidra/Framework/Docking/src/main/java/docking/widgets/label/GDHtmlLabel.java b/Ghidra/Framework/Docking/src/main/java/docking/widgets/label/GDHtmlLabel.javaindex 9e5ce4c432..78d0aef8d0 100644--- a/Ghidra/Framework/Docking/src/main/java/docking/widgets/label/GDHtmlLabel.java+++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/label/GDHtmlLabel.java@@ -24,8 +24,9 @@ import docking.widgets.checkbox.GHtmlCheckBox;/*** A 'dynamic' label (the text can be changed), with HTML rendering allowed.* <p>- * Clients do not need to prefix label text with "<html>", as is required for a standard- * JLabel.+ * Since HTML rendering is optional, the "<html>" prefix must be added this label's text in+ * order to be rendered as HTML. Supporting both HTML and non-HTML allows clients to change how+ * this label gets used over time without having to switch to a {@link GLabel}.* <p>* See also:* <table border=1>diff --git a/Ghidra/Framework/Docking/src/main/java/docking/widgets/label/GHtmlLabel.java b/Ghidra/Framework/Docking/src/main/java/docking/widgets/label/GHtmlLabel.javaindex cd9e1e2eb5..32bb5de9fe 100644--- a/Ghidra/Framework/Docking/src/main/java/docking/widgets/label/GHtmlLabel.java+++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/label/GHtmlLabel.java@@ -28,8 +28,9 @@ import utilities.util.reflection.ReflectionUtilities;/*** An immutable label (the text can NOT be changed), with HTML rendering allowed.* <p>- * Clients do not need to prefix label text with "<html>", as is required for a standard- * JLabel.+ * Since HTML rendering is optional, the "<html>" prefix must be added this label's text in+ * order to be rendered as HTML. Supporting both HTML and non-HTML allows clients to change how+ * this label gets used over time without having to switch to a {@link GLabel}.** <p>* See also: