diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/programtree/DnDTreeCellRenderer.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/programtree/DnDTreeCellRenderer.java index 69870d76a0..e4d2bf9ea3 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/programtree/DnDTreeCellRenderer.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/programtree/DnDTreeCellRenderer.java @@ -22,8 +22,8 @@ import java.util.*; import javax.swing.*; import javax.swing.tree.DefaultTreeCellRenderer; -import docking.DockingUtils; import docking.ToolTipManager; +import docking.widgets.GComponent; import ghidra.program.model.listing.Group; import resources.ResourceManager; @@ -87,7 +87,7 @@ class DnDTreeCellRenderer extends DefaultTreeCellRenderer { * @param enable true to enable HTML rendering; false to disable it */ public void setHTMLRenderingEnabled(boolean enable) { - putClientProperty(DockingUtils.HTML_DISABLE_STRING, !enable); + putClientProperty(GComponent.HTML_DISABLE_STRING, !enable); } void setSelectionForDrag(Color color) { diff --git a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/wizard/ChooseAddressSetEditorPanel.java b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/wizard/ChooseAddressSetEditorPanel.java index 7c17a8b6e5..38dc9bdc3e 100644 --- a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/wizard/ChooseAddressSetEditorPanel.java +++ b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/wizard/ChooseAddressSetEditorPanel.java @@ -24,9 +24,9 @@ import java.util.*; import javax.swing.*; import javax.swing.event.*; -import docking.DockingUtils; import docking.widgets.button.GRadioButton; import docking.widgets.label.GLabel; +import docking.widgets.list.GList; import ghidra.framework.plugintool.PluginTool; import ghidra.program.model.address.*; import ghidra.program.model.listing.Program; @@ -61,7 +61,7 @@ public class ChooseAddressSetEditorPanel extends JPanel { private JButton removeRangeButton; private JPanel bottomButtons; private AddressSetListModel listModel; - private JList list; + private GList list; private Set listeners = new HashSet<>(); public ChooseAddressSetEditorPanel(final PluginTool tool, final String name, @@ -235,8 +235,7 @@ public class ChooseAddressSetEditorPanel extends JPanel { headerPanel.add(buttonPanel, BorderLayout.EAST); listModel = new AddressSetListModel(myCurrentAddressSet.toList()); - list = new JList<>(listModel); - DockingUtils.turnOffHTMLRendering(list); + list = new GList<>(listModel); list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); list.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override diff --git a/Ghidra/Framework/Docking/src/main/java/docking/DockingMenuItem.java b/Ghidra/Framework/Docking/src/main/java/docking/DockingMenuItem.java index b225e06669..b39f95df8d 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/DockingMenuItem.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/DockingMenuItem.java @@ -21,12 +21,13 @@ import javax.swing.JMenuItem; import javax.swing.KeyStroke; import docking.menu.DockingMenuItemUI; +import docking.widgets.GComponent; public class DockingMenuItem extends JMenuItem { public DockingMenuItem() { setUI(DockingMenuItemUI.createUI(this)); - DockingUtils.turnOffHTMLRendering(this); + GComponent.turnOffHTMLRendering(this); } @Override diff --git a/Ghidra/Framework/Docking/src/main/java/docking/DockingUtils.java b/Ghidra/Framework/Docking/src/main/java/docking/DockingUtils.java index 3723533e60..eea6e6e833 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/DockingUtils.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/DockingUtils.java @@ -27,8 +27,6 @@ import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.TreeCellRenderer; import javax.swing.undo.UndoableEdit; -import org.apache.commons.lang3.StringUtils; - import docking.widgets.button.GRadioButton; import docking.widgets.checkbox.GCheckBox; import docking.widgets.checkbox.GHtmlCheckBox; @@ -41,9 +39,7 @@ import docking.widgets.table.GTableCellRenderer; import docking.widgets.tree.support.GTreeRenderer; import ghidra.docking.util.DockingWindowsLookAndFeelUtils; import ghidra.util.HTMLUtilities; -import ghidra.util.Msg; import resources.ResourceManager; -import utilities.util.reflection.ReflectionUtilities; /** *

Notes about how to use HTML safely:

@@ -97,9 +93,6 @@ import utilities.util.reflection.ReflectionUtilities; * */ public class DockingUtils { - // taken from BasicHTML.htmlDisable, which is private - public static final String HTML_DISABLE_STRING = "html.disable"; - private static final int ICON_SIZE = 16; /** System dependent mask for the Ctrl key */ @@ -139,55 +132,6 @@ public class DockingUtils { return separator; } - /** - * Helper function that logs a warning about a string text that looks like it has HTML text. - *

- * Use this when working with a string in a label that has already disabled HTML rendering. - *

- * @param text string to test for HTML and warn about - */ - public static void warnAboutHtmlText(String text) { - // #ifdef still_finding_html_labels_in_our_huge_codebase - if (StringUtils.startsWithIgnoreCase(text, "")) { - Msg.warn(GLabel.class, "HTML text detected in non-HTML component: " + text, - ReflectionUtilities.createJavaFilteredThrowable()); - } - // #endif - } - - /** - * Turns off the HTML rendering in the specified component. - * - * @param comp the thing - */ - public static void turnOffHTMLRendering(JComponent comp) { - comp.putClientProperty(HTML_DISABLE_STRING, true); - } - - /** - * Turns off the HTML rendering in the specified component and its current cell renderer. - * - * @param list the list - */ - public static void turnOffHTMLRendering(JList list) { - turnOffHTMLRendering((JComponent) list); - if (list.getCellRenderer() instanceof JComponent) { - turnOffHTMLRendering((JComponent) list.getCellRenderer()); - } - } - - /** - * Turns off the HTML rendering in the specified component and its current renderer. - * - * @param cb the combobox - */ - public static void turnOffHTMLRendering(JComboBox cb) { - turnOffHTMLRendering((JComponent) cb); - if (cb.getRenderer() instanceof JComponent) { - turnOffHTMLRendering((JComponent) cb.getRenderer()); - } - } - public static Icon scaleIconAsNeeded(Icon icon) { if (icon == null) { return null; diff --git a/Ghidra/Framework/Docking/src/main/java/docking/widgets/AbstractGCellRenderer.java b/Ghidra/Framework/Docking/src/main/java/docking/widgets/AbstractGCellRenderer.java index 245f7c9037..a57f383c84 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/widgets/AbstractGCellRenderer.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/AbstractGCellRenderer.java @@ -21,7 +21,6 @@ import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.border.Border; -import docking.DockingUtils; import docking.widgets.label.GDHtmlLabel; /** @@ -82,7 +81,7 @@ public abstract class AbstractGCellRenderer extends GDHtmlLabel { * @param enable true to enable HTML rendering; false to disable it */ public void setHTMLRenderingEnabled(boolean enable) { - putClientProperty(DockingUtils.HTML_DISABLE_STRING, !enable); + putClientProperty(GComponent.HTML_DISABLE_STRING, !enable); } public void setShouldAlternateRowBackgroundColors(boolean alternate) { diff --git a/Ghidra/Framework/Docking/src/main/java/docking/widgets/DropDownTextField.java b/Ghidra/Framework/Docking/src/main/java/docking/widgets/DropDownTextField.java index e11cf2e6af..30726489af 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/widgets/DropDownTextField.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/DropDownTextField.java @@ -26,7 +26,6 @@ import javax.swing.event.*; import org.apache.commons.lang3.StringUtils; -import docking.DockingUtils; import docking.widgets.label.GDLabel; import generic.util.WindowUtilities; import ghidra.util.StringUtilities; @@ -132,7 +131,7 @@ public class DropDownTextField extends JTextField { } private void init(int updateMinDelay) { - DockingUtils.turnOffHTMLRendering(list); + GComponent.turnOffHTMLRendering(list); updateManager = new SwingUpdateManager(updateMinDelay, DEFAULT_MAX_UPDATE_DELAY, "Drop Down Selection Text Field Update Manager", () -> { if (pendingTextUpdate == null) { diff --git a/Ghidra/Framework/Docking/src/main/java/docking/widgets/GComponent.java b/Ghidra/Framework/Docking/src/main/java/docking/widgets/GComponent.java new file mode 100644 index 0000000000..1758764eeb --- /dev/null +++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/GComponent.java @@ -0,0 +1,79 @@ +/* ### + * IP: GHIDRA + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package docking.widgets; + +import javax.swing.*; + +import org.apache.commons.lang3.StringUtils; + +import docking.widgets.label.GLabel; +import ghidra.util.Msg; +import utilities.util.reflection.ReflectionUtilities; + +public interface GComponent { + // taken from BasicHTML.htmlDisable, which is private + public static final String HTML_DISABLE_STRING = "html.disable"; + + /** + * Helper function that logs a warning about a string text that looks like it has HTML text. + *

+ * Use this when working with a string in a label that has already disabled HTML rendering. + *

+ * @param text string to test for HTML and warn about + */ + public static void warnAboutHtmlText(String text) { + // #ifdef still_finding_html_labels_in_our_huge_codebase + if (StringUtils.startsWithIgnoreCase(text, "")) { + Msg.warn(GLabel.class, "HTML text detected in non-HTML component: " + text, + ReflectionUtilities.createJavaFilteredThrowable()); + } + // #endif + } + + /** + * Turns off the HTML rendering in the specified component. + * + * @param comp the thing + */ + public static void turnOffHTMLRendering(JComponent comp) { + comp.putClientProperty(HTML_DISABLE_STRING, true); + } + + /** + * Turns off the HTML rendering in the specified component and its current cell renderer. + * + * @param list the list + */ + public static void turnOffHTMLRendering(JList list) { + turnOffHTMLRendering((JComponent) list); + if (list.getCellRenderer() instanceof JComponent) { + turnOffHTMLRendering((JComponent) list.getCellRenderer()); + } + } + + /** + * Turns off the HTML rendering in the specified component and its current renderer. + * + * @param cb the combobox + */ + public static void turnOffHTMLRendering(JComboBox cb) { + turnOffHTMLRendering((JComponent) cb); + if (cb.getRenderer() instanceof JComponent) { + turnOffHTMLRendering((JComponent) cb.getRenderer()); + } + } + +} diff --git a/Ghidra/Framework/Docking/src/main/java/docking/widgets/button/GRadioButton.java b/Ghidra/Framework/Docking/src/main/java/docking/widgets/button/GRadioButton.java index 4c2620ede2..38f198af90 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/widgets/button/GRadioButton.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/button/GRadioButton.java @@ -17,13 +17,13 @@ package docking.widgets.button; import javax.swing.*; -import docking.DockingUtils; +import docking.widgets.GComponent; /** * A {@link JRadioButton} that disables HTML rendering. * */ -public class GRadioButton extends JRadioButton { +public class GRadioButton extends JRadioButton implements GComponent { /** * Creates a blank radio button with HTML rendering disabled. @@ -113,6 +113,6 @@ public class GRadioButton extends JRadioButton { } private void init() { - DockingUtils.turnOffHTMLRendering(this); + GComponent.turnOffHTMLRendering(this); } } diff --git a/Ghidra/Framework/Docking/src/main/java/docking/widgets/checkbox/GCheckBox.java b/Ghidra/Framework/Docking/src/main/java/docking/widgets/checkbox/GCheckBox.java index d73361ed23..e39a3ab731 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/widgets/checkbox/GCheckBox.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/checkbox/GCheckBox.java @@ -17,7 +17,7 @@ package docking.widgets.checkbox; import javax.swing.*; -import docking.DockingUtils; +import docking.widgets.GComponent; /** * A {@link JCheckBox} that has HTML rendering disabled. @@ -29,7 +29,7 @@ import docking.DockingUtils; * {@link GHtmlCheckBox}YESHTML allowed JCheckBox * */ -public class GCheckBox extends JCheckBox { +public class GCheckBox extends JCheckBox implements GComponent { /** * Creates a check box with no text or icon, with HTML rendering disabled. @@ -133,7 +133,7 @@ public class GCheckBox extends JCheckBox { } private void init() { - DockingUtils.turnOffHTMLRendering(this); + GComponent.turnOffHTMLRendering(this); } /** @@ -145,7 +145,7 @@ public class GCheckBox extends JCheckBox { */ @Override public void setText(String text) { - DockingUtils.warnAboutHtmlText(text); + GComponent.warnAboutHtmlText(text); super.setText(text); } } diff --git a/Ghidra/Framework/Docking/src/main/java/docking/widgets/checkbox/GHtmlCheckBox.java b/Ghidra/Framework/Docking/src/main/java/docking/widgets/checkbox/GHtmlCheckBox.java index 5d12b68043..3b6bb21c63 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/widgets/checkbox/GHtmlCheckBox.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/checkbox/GHtmlCheckBox.java @@ -17,6 +17,8 @@ package docking.widgets.checkbox; import javax.swing.*; +import docking.widgets.GComponent; + /** * A {@link JCheckBox} that allows HTML rendering. *

@@ -27,7 +29,7 @@ import javax.swing.*; * {@link GHtmlCheckBox}YESHTML allowed JCheckBox * */ -public class GHtmlCheckBox extends JCheckBox { +public class GHtmlCheckBox extends JCheckBox implements GComponent { /** * Creates a check box with no text or icon, with HTML rendering allowed. diff --git a/Ghidra/Framework/Docking/src/main/java/docking/widgets/combobox/GComboBox.java b/Ghidra/Framework/Docking/src/main/java/docking/widgets/combobox/GComboBox.java index df912deaeb..cff1951ad1 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/widgets/combobox/GComboBox.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/combobox/GComboBox.java @@ -20,14 +20,14 @@ import java.util.Vector; import javax.swing.ComboBoxModel; import javax.swing.JComboBox; -import docking.DockingUtils; +import docking.widgets.GComponent; /** * A {@link JComboBox} that disables HTML rendering. * * @param the type of the elements of this combo box */ -public class GComboBox extends JComboBox { +public class GComboBox extends JComboBox implements GComponent { /** * Creates an empty combobox with a default data model. @@ -77,7 +77,7 @@ public class GComboBox extends JComboBox { } private void init() { - DockingUtils.turnOffHTMLRendering(this); + GComponent.turnOffHTMLRendering(this); } } diff --git a/Ghidra/Framework/Docking/src/main/java/docking/widgets/combobox/GhidraComboBox.java b/Ghidra/Framework/Docking/src/main/java/docking/widgets/combobox/GhidraComboBox.java index 265979d16e..acbb6c30af 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/widgets/combobox/GhidraComboBox.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/combobox/GhidraComboBox.java @@ -26,7 +26,7 @@ import javax.swing.event.DocumentListener; import javax.swing.plaf.ComboBoxUI; import javax.swing.text.*; -import docking.DockingUtils; +import docking.widgets.GComponent; /** * GhidraComboBox adds the following features: @@ -56,7 +56,7 @@ import docking.DockingUtils; * focus) in that you end up changing the button's internal state(by calling * setEnabled(true or false)) in the middle of the button press. */ -public class GhidraComboBox extends JComboBox { +public class GhidraComboBox extends JComboBox implements GComponent { private ArrayList listeners = new ArrayList<>(); private ArrayList docListeners = new ArrayList<>(); private boolean setSelectedFlag = false; @@ -102,7 +102,7 @@ public class GhidraComboBox extends JComboBox { } private void init() { - DockingUtils.turnOffHTMLRendering(this); + GComponent.turnOffHTMLRendering(this); } @Override 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.java index 14728b2e42..2b2fed254f 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 @@ -17,6 +17,7 @@ package docking.widgets.label; import javax.swing.*; +import docking.widgets.GComponent; import docking.widgets.checkbox.GCheckBox; import docking.widgets.checkbox.GHtmlCheckBox; @@ -36,7 +37,7 @@ import docking.widgets.checkbox.GHtmlCheckBox; * {@link GHtmlCheckBox}YESHtml checkbox * */ -public class GDHtmlLabel extends JLabel { +public class GDHtmlLabel extends JLabel implements GComponent { /** * Creates a label with no image and no text, with {@link SwingConstants#LEADING} horizontal diff --git a/Ghidra/Framework/Docking/src/main/java/docking/widgets/label/GDLabel.java b/Ghidra/Framework/Docking/src/main/java/docking/widgets/label/GDLabel.java index a870fd4320..9e3dfe9284 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/widgets/label/GDLabel.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/label/GDLabel.java @@ -17,7 +17,7 @@ package docking.widgets.label; import javax.swing.*; -import docking.DockingUtils; +import docking.widgets.GComponent; import docking.widgets.checkbox.GCheckBox; import docking.widgets.checkbox.GHtmlCheckBox; @@ -37,7 +37,7 @@ import docking.widgets.checkbox.GHtmlCheckBox; * {@link GHtmlCheckBox}YESHtml checkbox * */ -public class GDLabel extends JLabel { +public class GDLabel extends JLabel implements GComponent { /** * Creates a label with no image and no text, with {@link SwingConstants#LEADING} horizontal @@ -106,12 +106,12 @@ public class GDLabel extends JLabel { @Override public void setText(String text) { - DockingUtils.warnAboutHtmlText(text); + GComponent.warnAboutHtmlText(text); super.setText(text); } private void init() { - DockingUtils.turnOffHTMLRendering(this); + GComponent.turnOffHTMLRendering(this); } } 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.java index 33be4ebf4e..6270f9f7c4 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 @@ -19,6 +19,7 @@ import javax.swing.*; import org.apache.commons.lang3.StringUtils; +import docking.widgets.GComponent; import docking.widgets.checkbox.GCheckBox; import docking.widgets.checkbox.GHtmlCheckBox; import ghidra.util.Msg; @@ -40,7 +41,7 @@ import utilities.util.reflection.ReflectionUtilities; * {@link GHtmlCheckBox}YESHtml checkbox * */ -public class GHtmlLabel extends JLabel { +public class GHtmlLabel extends JLabel implements GComponent { /** * Creates a immutable label with no image and no text, with {@link SwingConstants#LEADING} horizontal diff --git a/Ghidra/Framework/Docking/src/main/java/docking/widgets/label/GIconLabel.java b/Ghidra/Framework/Docking/src/main/java/docking/widgets/label/GIconLabel.java index a405704fd9..b9ca14f595 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/widgets/label/GIconLabel.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/label/GIconLabel.java @@ -19,6 +19,7 @@ import javax.swing.*; import org.apache.commons.lang3.StringUtils; +import docking.widgets.GComponent; import docking.widgets.checkbox.GCheckBox; import docking.widgets.checkbox.GHtmlCheckBox; import ghidra.util.Msg; @@ -40,7 +41,7 @@ import utilities.util.reflection.ReflectionUtilities; * {@link GHtmlCheckBox}YESHtml checkbox * */ -public class GIconLabel extends GLabel { +public class GIconLabel extends GLabel implements GComponent { /** * Creates a immutable label with no image and no text, with {@link SwingConstants#LEADING} horizontal diff --git a/Ghidra/Framework/Docking/src/main/java/docking/widgets/label/GLabel.java b/Ghidra/Framework/Docking/src/main/java/docking/widgets/label/GLabel.java index 567a19d153..8647c398b1 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/widgets/label/GLabel.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/label/GLabel.java @@ -19,7 +19,7 @@ import javax.swing.*; import org.apache.commons.lang3.StringUtils; -import docking.DockingUtils; +import docking.widgets.GComponent; import docking.widgets.checkbox.GCheckBox; import docking.widgets.checkbox.GHtmlCheckBox; import ghidra.util.Msg; @@ -41,7 +41,7 @@ import utilities.util.reflection.ReflectionUtilities; * {@link GHtmlCheckBox}YESHtml checkbox * */ -public class GLabel extends JLabel { +public class GLabel extends JLabel implements GComponent { /** * Creates a immutable label with no image and no text, with {@link SwingConstants#LEADING} horizontal @@ -132,7 +132,7 @@ public class GLabel extends JLabel { } private void init() { - DockingUtils.turnOffHTMLRendering(this); + GComponent.turnOffHTMLRendering(this); } /** @@ -155,7 +155,7 @@ public class GLabel extends JLabel { ReflectionUtilities.createJavaFilteredThrowable()); return; } - DockingUtils.warnAboutHtmlText(text); + GComponent.warnAboutHtmlText(text); super.setText(text); } diff --git a/Ghidra/Framework/Docking/src/main/java/docking/widgets/list/GList.java b/Ghidra/Framework/Docking/src/main/java/docking/widgets/list/GList.java index e0d4233c4b..c02d3fa9c7 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/widgets/list/GList.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/list/GList.java @@ -22,7 +22,7 @@ import javax.swing.ListModel; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; -import docking.DockingUtils; +import docking.widgets.GComponent; import docking.widgets.table.GTable; /** @@ -35,7 +35,7 @@ import docking.widgets.table.GTable; *

* */ -public class GList extends JList { +public class GList extends JList implements GComponent { private static final long serialVersionUID = 1L; /**The timeout for the auto-lookup feature*/ @@ -84,7 +84,7 @@ public class GList extends JList { } private void init() { - DockingUtils.turnOffHTMLRendering(this); + GComponent.turnOffHTMLRendering(this); addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { diff --git a/Ghidra/Framework/Docking/src/main/java/docking/widgets/table/DefaultTableCellRendererWrapper.java b/Ghidra/Framework/Docking/src/main/java/docking/widgets/table/DefaultTableCellRendererWrapper.java index a40a624e56..7aaaa81bd9 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/widgets/table/DefaultTableCellRendererWrapper.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/table/DefaultTableCellRendererWrapper.java @@ -20,7 +20,7 @@ import java.awt.Component; import javax.swing.JComponent; import javax.swing.table.TableCellRenderer; -import docking.DockingUtils; +import docking.widgets.GComponent; public class DefaultTableCellRendererWrapper extends GTableCellRenderer { @@ -44,7 +44,7 @@ public class DefaultTableCellRendererWrapper extends GTableCellRenderer { @Override public void setHTMLRenderingEnabled(boolean enable) { if (renderer instanceof JComponent) { - ((JComponent) renderer).putClientProperty(DockingUtils.HTML_DISABLE_STRING, !enable); + ((JComponent) renderer).putClientProperty(GComponent.HTML_DISABLE_STRING, !enable); } super.setHTMLRenderingEnabled(enable); } diff --git a/Ghidra/Framework/Docking/src/main/java/docking/widgets/tree/support/GTreeRenderer.java b/Ghidra/Framework/Docking/src/main/java/docking/widgets/tree/support/GTreeRenderer.java index f6dedb5cac..dd1b075d3c 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/widgets/tree/support/GTreeRenderer.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/tree/support/GTreeRenderer.java @@ -21,11 +21,11 @@ import javax.swing.Icon; import javax.swing.JTree; import javax.swing.tree.DefaultTreeCellRenderer; -import docking.DockingUtils; +import docking.widgets.GComponent; import docking.widgets.tree.GTree; import docking.widgets.tree.GTreeNode; -public class GTreeRenderer extends DefaultTreeCellRenderer { +public class GTreeRenderer extends DefaultTreeCellRenderer implements GComponent { private static final long serialVersionUID = 1L; private static final Color VALID_DROP_TARGET_COLOR = new Color(200, 200, 255); private static final int DEFAULT_MIN_ICON_WIDTH = 22; @@ -38,7 +38,7 @@ public class GTreeRenderer extends DefaultTreeCellRenderer { private int minIconWidth = DEFAULT_MIN_ICON_WIDTH; public GTreeRenderer() { - DockingUtils.turnOffHTMLRendering(this); + GComponent.turnOffHTMLRendering(this); } /** diff --git a/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/RepositoryChooser.java b/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/RepositoryChooser.java index fe04731510..474f0db5c2 100644 --- a/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/RepositoryChooser.java +++ b/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/RepositoryChooser.java @@ -26,10 +26,10 @@ import javax.swing.*; import javax.swing.event.*; import docking.DialogComponentProvider; -import docking.DockingUtils; import docking.widgets.button.GRadioButton; import docking.widgets.label.GDLabel; import docking.widgets.label.GLabel; +import docking.widgets.list.GList; import ghidra.framework.client.*; import ghidra.framework.model.ServerInfo; import ghidra.framework.protocol.ghidra.GhidraURL; @@ -55,7 +55,7 @@ class RepositoryChooser extends DialogComponentProvider { private ServerInfoComponent serverInfoComponent; private JButton queryButton; - private JList nameList; + private GList nameList; private DefaultListModel listModel; private JTextField urlTextField; @@ -104,8 +104,7 @@ class RepositoryChooser extends DialogComponentProvider { lowerPanel.add(label, BorderLayout.NORTH); listModel = new DefaultListModel<>(); - nameList = new JList<>(listModel); - DockingUtils.turnOffHTMLRendering(nameList); + nameList = new GList<>(listModel); nameList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); nameList.addListSelectionListener(new ListSelectionListener() { @Override diff --git a/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/RepositoryPanel.java b/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/RepositoryPanel.java index c9544b7e29..494f55bcaf 100644 --- a/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/RepositoryPanel.java +++ b/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/RepositoryPanel.java @@ -22,9 +22,9 @@ import java.awt.event.ActionListener; import javax.swing.*; import javax.swing.event.*; -import docking.DockingUtils; import docking.widgets.button.GRadioButton; import docking.widgets.label.GDLabel; +import docking.widgets.list.GList; import docking.wizard.*; import ghidra.app.util.GenericHelpTopics; import ghidra.util.HelpLocation; @@ -42,7 +42,7 @@ public class RepositoryPanel extends AbstractWizardJPanel { private JRadioButton existingRepButton; private JRadioButton createRepButton; private ButtonGroup buttonGroup; - private JList nameList; + private GList nameList; private DefaultListModel listModel; private JTextField nameField; private JLabel nameLabel; @@ -161,8 +161,7 @@ public class RepositoryPanel extends AbstractWizardJPanel { for (String repositoryName : repositoryNames) { listModel.addElement(repositoryName); } - nameList = new JList<>(listModel); - DockingUtils.turnOffHTMLRendering(nameList); + nameList = new GList<>(listModel); nameList.setEnabled(existingRepButton.isSelected()); JScrollPane sp = new JScrollPane(nameList); innerPanel.add(sp);