mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-22 04:05:39 +00:00
GT-2698 - fix for tests so Swing isn't dragged in
This commit is contained in:
parent
5764e7174e
commit
c7ce28e94c
@ -22,8 +22,8 @@ import java.util.*;
|
|||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.tree.DefaultTreeCellRenderer;
|
import javax.swing.tree.DefaultTreeCellRenderer;
|
||||||
|
|
||||||
import docking.DockingUtils;
|
|
||||||
import docking.ToolTipManager;
|
import docking.ToolTipManager;
|
||||||
|
import docking.widgets.GComponent;
|
||||||
import ghidra.program.model.listing.Group;
|
import ghidra.program.model.listing.Group;
|
||||||
import resources.ResourceManager;
|
import resources.ResourceManager;
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ class DnDTreeCellRenderer extends DefaultTreeCellRenderer {
|
|||||||
* @param enable true to enable HTML rendering; false to disable it
|
* @param enable true to enable HTML rendering; false to disable it
|
||||||
*/
|
*/
|
||||||
public void setHTMLRenderingEnabled(boolean enable) {
|
public void setHTMLRenderingEnabled(boolean enable) {
|
||||||
putClientProperty(DockingUtils.HTML_DISABLE_STRING, !enable);
|
putClientProperty(GComponent.HTML_DISABLE_STRING, !enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setSelectionForDrag(Color color) {
|
void setSelectionForDrag(Color color) {
|
||||||
|
@ -24,9 +24,9 @@ import java.util.*;
|
|||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.event.*;
|
import javax.swing.event.*;
|
||||||
|
|
||||||
import docking.DockingUtils;
|
|
||||||
import docking.widgets.button.GRadioButton;
|
import docking.widgets.button.GRadioButton;
|
||||||
import docking.widgets.label.GLabel;
|
import docking.widgets.label.GLabel;
|
||||||
|
import docking.widgets.list.GList;
|
||||||
import ghidra.framework.plugintool.PluginTool;
|
import ghidra.framework.plugintool.PluginTool;
|
||||||
import ghidra.program.model.address.*;
|
import ghidra.program.model.address.*;
|
||||||
import ghidra.program.model.listing.Program;
|
import ghidra.program.model.listing.Program;
|
||||||
@ -61,7 +61,7 @@ public class ChooseAddressSetEditorPanel extends JPanel {
|
|||||||
private JButton removeRangeButton;
|
private JButton removeRangeButton;
|
||||||
private JPanel bottomButtons;
|
private JPanel bottomButtons;
|
||||||
private AddressSetListModel listModel;
|
private AddressSetListModel listModel;
|
||||||
private JList<AddressRange> list;
|
private GList<AddressRange> list;
|
||||||
private Set<ChangeListener> listeners = new HashSet<>();
|
private Set<ChangeListener> listeners = new HashSet<>();
|
||||||
|
|
||||||
public ChooseAddressSetEditorPanel(final PluginTool tool, final String name,
|
public ChooseAddressSetEditorPanel(final PluginTool tool, final String name,
|
||||||
@ -235,8 +235,7 @@ public class ChooseAddressSetEditorPanel extends JPanel {
|
|||||||
headerPanel.add(buttonPanel, BorderLayout.EAST);
|
headerPanel.add(buttonPanel, BorderLayout.EAST);
|
||||||
|
|
||||||
listModel = new AddressSetListModel(myCurrentAddressSet.toList());
|
listModel = new AddressSetListModel(myCurrentAddressSet.toList());
|
||||||
list = new JList<>(listModel);
|
list = new GList<>(listModel);
|
||||||
DockingUtils.turnOffHTMLRendering(list);
|
|
||||||
list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
|
list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
|
||||||
list.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
|
list.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -21,12 +21,13 @@ import javax.swing.JMenuItem;
|
|||||||
import javax.swing.KeyStroke;
|
import javax.swing.KeyStroke;
|
||||||
|
|
||||||
import docking.menu.DockingMenuItemUI;
|
import docking.menu.DockingMenuItemUI;
|
||||||
|
import docking.widgets.GComponent;
|
||||||
|
|
||||||
public class DockingMenuItem extends JMenuItem {
|
public class DockingMenuItem extends JMenuItem {
|
||||||
|
|
||||||
public DockingMenuItem() {
|
public DockingMenuItem() {
|
||||||
setUI(DockingMenuItemUI.createUI(this));
|
setUI(DockingMenuItemUI.createUI(this));
|
||||||
DockingUtils.turnOffHTMLRendering(this);
|
GComponent.turnOffHTMLRendering(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -27,8 +27,6 @@ import javax.swing.tree.DefaultTreeCellRenderer;
|
|||||||
import javax.swing.tree.TreeCellRenderer;
|
import javax.swing.tree.TreeCellRenderer;
|
||||||
import javax.swing.undo.UndoableEdit;
|
import javax.swing.undo.UndoableEdit;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
|
|
||||||
import docking.widgets.button.GRadioButton;
|
import docking.widgets.button.GRadioButton;
|
||||||
import docking.widgets.checkbox.GCheckBox;
|
import docking.widgets.checkbox.GCheckBox;
|
||||||
import docking.widgets.checkbox.GHtmlCheckBox;
|
import docking.widgets.checkbox.GHtmlCheckBox;
|
||||||
@ -41,9 +39,7 @@ import docking.widgets.table.GTableCellRenderer;
|
|||||||
import docking.widgets.tree.support.GTreeRenderer;
|
import docking.widgets.tree.support.GTreeRenderer;
|
||||||
import ghidra.docking.util.DockingWindowsLookAndFeelUtils;
|
import ghidra.docking.util.DockingWindowsLookAndFeelUtils;
|
||||||
import ghidra.util.HTMLUtilities;
|
import ghidra.util.HTMLUtilities;
|
||||||
import ghidra.util.Msg;
|
|
||||||
import resources.ResourceManager;
|
import resources.ResourceManager;
|
||||||
import utilities.util.reflection.ReflectionUtilities;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h1>Notes about how to use HTML safely:</h1>
|
* <h1>Notes about how to use HTML safely:</h1>
|
||||||
@ -97,9 +93,6 @@ import utilities.util.reflection.ReflectionUtilities;
|
|||||||
* </table>
|
* </table>
|
||||||
*/
|
*/
|
||||||
public class DockingUtils {
|
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;
|
private static final int ICON_SIZE = 16;
|
||||||
|
|
||||||
/** System dependent mask for the Ctrl key */
|
/** System dependent mask for the Ctrl key */
|
||||||
@ -139,55 +132,6 @@ public class DockingUtils {
|
|||||||
return separator;
|
return separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper function that logs a warning about a string text that looks like it has HTML text.
|
|
||||||
* <p>
|
|
||||||
* Use this when working with a string in a label that has already disabled HTML rendering.
|
|
||||||
* <p>
|
|
||||||
* @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, "<html>")) {
|
|
||||||
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) {
|
public static Icon scaleIconAsNeeded(Icon icon) {
|
||||||
if (icon == null) {
|
if (icon == null) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -21,7 +21,6 @@ import javax.swing.BorderFactory;
|
|||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
import javax.swing.border.Border;
|
import javax.swing.border.Border;
|
||||||
|
|
||||||
import docking.DockingUtils;
|
|
||||||
import docking.widgets.label.GDHtmlLabel;
|
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
|
* @param enable true to enable HTML rendering; false to disable it
|
||||||
*/
|
*/
|
||||||
public void setHTMLRenderingEnabled(boolean enable) {
|
public void setHTMLRenderingEnabled(boolean enable) {
|
||||||
putClientProperty(DockingUtils.HTML_DISABLE_STRING, !enable);
|
putClientProperty(GComponent.HTML_DISABLE_STRING, !enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setShouldAlternateRowBackgroundColors(boolean alternate) {
|
public void setShouldAlternateRowBackgroundColors(boolean alternate) {
|
||||||
|
@ -26,7 +26,6 @@ import javax.swing.event.*;
|
|||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import docking.DockingUtils;
|
|
||||||
import docking.widgets.label.GDLabel;
|
import docking.widgets.label.GDLabel;
|
||||||
import generic.util.WindowUtilities;
|
import generic.util.WindowUtilities;
|
||||||
import ghidra.util.StringUtilities;
|
import ghidra.util.StringUtilities;
|
||||||
@ -132,7 +131,7 @@ public class DropDownTextField<T> extends JTextField {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void init(int updateMinDelay) {
|
private void init(int updateMinDelay) {
|
||||||
DockingUtils.turnOffHTMLRendering(list);
|
GComponent.turnOffHTMLRendering(list);
|
||||||
updateManager = new SwingUpdateManager(updateMinDelay, DEFAULT_MAX_UPDATE_DELAY,
|
updateManager = new SwingUpdateManager(updateMinDelay, DEFAULT_MAX_UPDATE_DELAY,
|
||||||
"Drop Down Selection Text Field Update Manager", () -> {
|
"Drop Down Selection Text Field Update Manager", () -> {
|
||||||
if (pendingTextUpdate == null) {
|
if (pendingTextUpdate == null) {
|
||||||
|
@ -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.
|
||||||
|
* <p>
|
||||||
|
* Use this when working with a string in a label that has already disabled HTML rendering.
|
||||||
|
* <p>
|
||||||
|
* @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, "<html>")) {
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -17,13 +17,13 @@ package docking.widgets.button;
|
|||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
import docking.DockingUtils;
|
import docking.widgets.GComponent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@link JRadioButton} that disables HTML rendering.
|
* 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.
|
* Creates a blank radio button with HTML rendering disabled.
|
||||||
@ -113,6 +113,6 @@ public class GRadioButton extends JRadioButton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void init() {
|
private void init() {
|
||||||
DockingUtils.turnOffHTMLRendering(this);
|
GComponent.turnOffHTMLRendering(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ package docking.widgets.checkbox;
|
|||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
import docking.DockingUtils;
|
import docking.widgets.GComponent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@link JCheckBox} that has HTML rendering disabled.
|
* A {@link JCheckBox} that has HTML rendering disabled.
|
||||||
@ -29,7 +29,7 @@ import docking.DockingUtils;
|
|||||||
* <tr><td>{@link GHtmlCheckBox}</td><td>YES</td><td>HTML allowed JCheckBox</td></tr>
|
* <tr><td>{@link GHtmlCheckBox}</td><td>YES</td><td>HTML allowed JCheckBox</td></tr>
|
||||||
* </table>
|
* </table>
|
||||||
*/
|
*/
|
||||||
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.
|
* 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() {
|
private void init() {
|
||||||
DockingUtils.turnOffHTMLRendering(this);
|
GComponent.turnOffHTMLRendering(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -145,7 +145,7 @@ public class GCheckBox extends JCheckBox {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setText(String text) {
|
public void setText(String text) {
|
||||||
DockingUtils.warnAboutHtmlText(text);
|
GComponent.warnAboutHtmlText(text);
|
||||||
super.setText(text);
|
super.setText(text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,8 @@ package docking.widgets.checkbox;
|
|||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
|
import docking.widgets.GComponent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@link JCheckBox} that allows HTML rendering.
|
* A {@link JCheckBox} that allows HTML rendering.
|
||||||
* <p>
|
* <p>
|
||||||
@ -27,7 +29,7 @@ import javax.swing.*;
|
|||||||
* <tr><td>{@link GHtmlCheckBox}</td><td>YES</td><td>HTML allowed JCheckBox</td></tr>
|
* <tr><td>{@link GHtmlCheckBox}</td><td>YES</td><td>HTML allowed JCheckBox</td></tr>
|
||||||
* </table>
|
* </table>
|
||||||
*/
|
*/
|
||||||
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.
|
* Creates a check box with no text or icon, with HTML rendering allowed.
|
||||||
|
@ -20,14 +20,14 @@ import java.util.Vector;
|
|||||||
import javax.swing.ComboBoxModel;
|
import javax.swing.ComboBoxModel;
|
||||||
import javax.swing.JComboBox;
|
import javax.swing.JComboBox;
|
||||||
|
|
||||||
import docking.DockingUtils;
|
import docking.widgets.GComponent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@link JComboBox} that disables HTML rendering.
|
* A {@link JComboBox} that disables HTML rendering.
|
||||||
*
|
*
|
||||||
* @param <E> the type of the elements of this combo box
|
* @param <E> the type of the elements of this combo box
|
||||||
*/
|
*/
|
||||||
public class GComboBox<E> extends JComboBox<E> {
|
public class GComboBox<E> extends JComboBox<E> implements GComponent {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an empty combobox with a default data model.
|
* Creates an empty combobox with a default data model.
|
||||||
@ -77,7 +77,7 @@ public class GComboBox<E> extends JComboBox<E> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void init() {
|
private void init() {
|
||||||
DockingUtils.turnOffHTMLRendering(this);
|
GComponent.turnOffHTMLRendering(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ import javax.swing.event.DocumentListener;
|
|||||||
import javax.swing.plaf.ComboBoxUI;
|
import javax.swing.plaf.ComboBoxUI;
|
||||||
import javax.swing.text.*;
|
import javax.swing.text.*;
|
||||||
|
|
||||||
import docking.DockingUtils;
|
import docking.widgets.GComponent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GhidraComboBox adds the following features:
|
* 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
|
* 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.
|
* setEnabled(true or false)) in the middle of the button press.
|
||||||
*/
|
*/
|
||||||
public class GhidraComboBox<E> extends JComboBox<E> {
|
public class GhidraComboBox<E> extends JComboBox<E> implements GComponent {
|
||||||
private ArrayList<ActionListener> listeners = new ArrayList<>();
|
private ArrayList<ActionListener> listeners = new ArrayList<>();
|
||||||
private ArrayList<DocumentListener> docListeners = new ArrayList<>();
|
private ArrayList<DocumentListener> docListeners = new ArrayList<>();
|
||||||
private boolean setSelectedFlag = false;
|
private boolean setSelectedFlag = false;
|
||||||
@ -102,7 +102,7 @@ public class GhidraComboBox<E> extends JComboBox<E> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void init() {
|
private void init() {
|
||||||
DockingUtils.turnOffHTMLRendering(this);
|
GComponent.turnOffHTMLRendering(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -17,6 +17,7 @@ package docking.widgets.label;
|
|||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
|
import docking.widgets.GComponent;
|
||||||
import docking.widgets.checkbox.GCheckBox;
|
import docking.widgets.checkbox.GCheckBox;
|
||||||
import docking.widgets.checkbox.GHtmlCheckBox;
|
import docking.widgets.checkbox.GHtmlCheckBox;
|
||||||
|
|
||||||
@ -36,7 +37,7 @@ import docking.widgets.checkbox.GHtmlCheckBox;
|
|||||||
* <tr><td>{@link GHtmlCheckBox}</td><td></td><td>YES</td><td>Html checkbox</td></tr>
|
* <tr><td>{@link GHtmlCheckBox}</td><td></td><td>YES</td><td>Html checkbox</td></tr>
|
||||||
* </table>
|
* </table>
|
||||||
*/
|
*/
|
||||||
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
|
* Creates a label with no image and no text, with {@link SwingConstants#LEADING} horizontal
|
||||||
|
@ -17,7 +17,7 @@ package docking.widgets.label;
|
|||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
import docking.DockingUtils;
|
import docking.widgets.GComponent;
|
||||||
import docking.widgets.checkbox.GCheckBox;
|
import docking.widgets.checkbox.GCheckBox;
|
||||||
import docking.widgets.checkbox.GHtmlCheckBox;
|
import docking.widgets.checkbox.GHtmlCheckBox;
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ import docking.widgets.checkbox.GHtmlCheckBox;
|
|||||||
* <tr><td>{@link GHtmlCheckBox}</td><td></td><td>YES</td><td>Html checkbox</td></tr>
|
* <tr><td>{@link GHtmlCheckBox}</td><td></td><td>YES</td><td>Html checkbox</td></tr>
|
||||||
* </table>
|
* </table>
|
||||||
*/
|
*/
|
||||||
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
|
* Creates a label with no image and no text, with {@link SwingConstants#LEADING} horizontal
|
||||||
@ -106,12 +106,12 @@ public class GDLabel extends JLabel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setText(String text) {
|
public void setText(String text) {
|
||||||
DockingUtils.warnAboutHtmlText(text);
|
GComponent.warnAboutHtmlText(text);
|
||||||
super.setText(text);
|
super.setText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init() {
|
private void init() {
|
||||||
DockingUtils.turnOffHTMLRendering(this);
|
GComponent.turnOffHTMLRendering(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ import javax.swing.*;
|
|||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import docking.widgets.GComponent;
|
||||||
import docking.widgets.checkbox.GCheckBox;
|
import docking.widgets.checkbox.GCheckBox;
|
||||||
import docking.widgets.checkbox.GHtmlCheckBox;
|
import docking.widgets.checkbox.GHtmlCheckBox;
|
||||||
import ghidra.util.Msg;
|
import ghidra.util.Msg;
|
||||||
@ -40,7 +41,7 @@ import utilities.util.reflection.ReflectionUtilities;
|
|||||||
* <tr><td>{@link GHtmlCheckBox}</td><td></td><td>YES</td><td>Html checkbox</td></tr>
|
* <tr><td>{@link GHtmlCheckBox}</td><td></td><td>YES</td><td>Html checkbox</td></tr>
|
||||||
* </table>
|
* </table>
|
||||||
*/
|
*/
|
||||||
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
|
* Creates a immutable label with no image and no text, with {@link SwingConstants#LEADING} horizontal
|
||||||
|
@ -19,6 +19,7 @@ import javax.swing.*;
|
|||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import docking.widgets.GComponent;
|
||||||
import docking.widgets.checkbox.GCheckBox;
|
import docking.widgets.checkbox.GCheckBox;
|
||||||
import docking.widgets.checkbox.GHtmlCheckBox;
|
import docking.widgets.checkbox.GHtmlCheckBox;
|
||||||
import ghidra.util.Msg;
|
import ghidra.util.Msg;
|
||||||
@ -40,7 +41,7 @@ import utilities.util.reflection.ReflectionUtilities;
|
|||||||
* <tr><td>{@link GHtmlCheckBox}</td><td></td><td>YES</td><td>Html checkbox</td></tr>
|
* <tr><td>{@link GHtmlCheckBox}</td><td></td><td>YES</td><td>Html checkbox</td></tr>
|
||||||
* </table>
|
* </table>
|
||||||
*/
|
*/
|
||||||
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
|
* Creates a immutable label with no image and no text, with {@link SwingConstants#LEADING} horizontal
|
||||||
|
@ -19,7 +19,7 @@ import javax.swing.*;
|
|||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import docking.DockingUtils;
|
import docking.widgets.GComponent;
|
||||||
import docking.widgets.checkbox.GCheckBox;
|
import docking.widgets.checkbox.GCheckBox;
|
||||||
import docking.widgets.checkbox.GHtmlCheckBox;
|
import docking.widgets.checkbox.GHtmlCheckBox;
|
||||||
import ghidra.util.Msg;
|
import ghidra.util.Msg;
|
||||||
@ -41,7 +41,7 @@ import utilities.util.reflection.ReflectionUtilities;
|
|||||||
* <tr><td>{@link GHtmlCheckBox}</td><td></td><td>YES</td><td>Html checkbox</td></tr>
|
* <tr><td>{@link GHtmlCheckBox}</td><td></td><td>YES</td><td>Html checkbox</td></tr>
|
||||||
* </table>
|
* </table>
|
||||||
*/
|
*/
|
||||||
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
|
* 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() {
|
private void init() {
|
||||||
DockingUtils.turnOffHTMLRendering(this);
|
GComponent.turnOffHTMLRendering(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -155,7 +155,7 @@ public class GLabel extends JLabel {
|
|||||||
ReflectionUtilities.createJavaFilteredThrowable());
|
ReflectionUtilities.createJavaFilteredThrowable());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DockingUtils.warnAboutHtmlText(text);
|
GComponent.warnAboutHtmlText(text);
|
||||||
super.setText(text);
|
super.setText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ import javax.swing.ListModel;
|
|||||||
import javax.swing.event.ListSelectionEvent;
|
import javax.swing.event.ListSelectionEvent;
|
||||||
import javax.swing.event.ListSelectionListener;
|
import javax.swing.event.ListSelectionListener;
|
||||||
|
|
||||||
import docking.DockingUtils;
|
import docking.widgets.GComponent;
|
||||||
import docking.widgets.table.GTable;
|
import docking.widgets.table.GTable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -35,7 +35,7 @@ import docking.widgets.table.GTable;
|
|||||||
* <p>
|
* <p>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class GList<T> extends JList<T> {
|
public class GList<T> extends JList<T> implements GComponent {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**The timeout for the auto-lookup feature*/
|
/**The timeout for the auto-lookup feature*/
|
||||||
@ -84,7 +84,7 @@ public class GList<T> extends JList<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void init() {
|
private void init() {
|
||||||
DockingUtils.turnOffHTMLRendering(this);
|
GComponent.turnOffHTMLRendering(this);
|
||||||
addListSelectionListener(new ListSelectionListener() {
|
addListSelectionListener(new ListSelectionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void valueChanged(ListSelectionEvent e) {
|
public void valueChanged(ListSelectionEvent e) {
|
||||||
|
@ -20,7 +20,7 @@ import java.awt.Component;
|
|||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
import javax.swing.table.TableCellRenderer;
|
import javax.swing.table.TableCellRenderer;
|
||||||
|
|
||||||
import docking.DockingUtils;
|
import docking.widgets.GComponent;
|
||||||
|
|
||||||
public class DefaultTableCellRendererWrapper extends GTableCellRenderer {
|
public class DefaultTableCellRendererWrapper extends GTableCellRenderer {
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ public class DefaultTableCellRendererWrapper extends GTableCellRenderer {
|
|||||||
@Override
|
@Override
|
||||||
public void setHTMLRenderingEnabled(boolean enable) {
|
public void setHTMLRenderingEnabled(boolean enable) {
|
||||||
if (renderer instanceof JComponent) {
|
if (renderer instanceof JComponent) {
|
||||||
((JComponent) renderer).putClientProperty(DockingUtils.HTML_DISABLE_STRING, !enable);
|
((JComponent) renderer).putClientProperty(GComponent.HTML_DISABLE_STRING, !enable);
|
||||||
}
|
}
|
||||||
super.setHTMLRenderingEnabled(enable);
|
super.setHTMLRenderingEnabled(enable);
|
||||||
}
|
}
|
||||||
|
@ -21,11 +21,11 @@ import javax.swing.Icon;
|
|||||||
import javax.swing.JTree;
|
import javax.swing.JTree;
|
||||||
import javax.swing.tree.DefaultTreeCellRenderer;
|
import javax.swing.tree.DefaultTreeCellRenderer;
|
||||||
|
|
||||||
import docking.DockingUtils;
|
import docking.widgets.GComponent;
|
||||||
import docking.widgets.tree.GTree;
|
import docking.widgets.tree.GTree;
|
||||||
import docking.widgets.tree.GTreeNode;
|
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 long serialVersionUID = 1L;
|
||||||
private static final Color VALID_DROP_TARGET_COLOR = new Color(200, 200, 255);
|
private static final Color VALID_DROP_TARGET_COLOR = new Color(200, 200, 255);
|
||||||
private static final int DEFAULT_MIN_ICON_WIDTH = 22;
|
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;
|
private int minIconWidth = DEFAULT_MIN_ICON_WIDTH;
|
||||||
|
|
||||||
public GTreeRenderer() {
|
public GTreeRenderer() {
|
||||||
DockingUtils.turnOffHTMLRendering(this);
|
GComponent.turnOffHTMLRendering(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -26,10 +26,10 @@ import javax.swing.*;
|
|||||||
import javax.swing.event.*;
|
import javax.swing.event.*;
|
||||||
|
|
||||||
import docking.DialogComponentProvider;
|
import docking.DialogComponentProvider;
|
||||||
import docking.DockingUtils;
|
|
||||||
import docking.widgets.button.GRadioButton;
|
import docking.widgets.button.GRadioButton;
|
||||||
import docking.widgets.label.GDLabel;
|
import docking.widgets.label.GDLabel;
|
||||||
import docking.widgets.label.GLabel;
|
import docking.widgets.label.GLabel;
|
||||||
|
import docking.widgets.list.GList;
|
||||||
import ghidra.framework.client.*;
|
import ghidra.framework.client.*;
|
||||||
import ghidra.framework.model.ServerInfo;
|
import ghidra.framework.model.ServerInfo;
|
||||||
import ghidra.framework.protocol.ghidra.GhidraURL;
|
import ghidra.framework.protocol.ghidra.GhidraURL;
|
||||||
@ -55,7 +55,7 @@ class RepositoryChooser extends DialogComponentProvider {
|
|||||||
|
|
||||||
private ServerInfoComponent serverInfoComponent;
|
private ServerInfoComponent serverInfoComponent;
|
||||||
private JButton queryButton;
|
private JButton queryButton;
|
||||||
private JList<String> nameList;
|
private GList<String> nameList;
|
||||||
private DefaultListModel<String> listModel;
|
private DefaultListModel<String> listModel;
|
||||||
|
|
||||||
private JTextField urlTextField;
|
private JTextField urlTextField;
|
||||||
@ -104,8 +104,7 @@ class RepositoryChooser extends DialogComponentProvider {
|
|||||||
lowerPanel.add(label, BorderLayout.NORTH);
|
lowerPanel.add(label, BorderLayout.NORTH);
|
||||||
|
|
||||||
listModel = new DefaultListModel<>();
|
listModel = new DefaultListModel<>();
|
||||||
nameList = new JList<>(listModel);
|
nameList = new GList<>(listModel);
|
||||||
DockingUtils.turnOffHTMLRendering(nameList);
|
|
||||||
nameList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
nameList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||||
nameList.addListSelectionListener(new ListSelectionListener() {
|
nameList.addListSelectionListener(new ListSelectionListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -22,9 +22,9 @@ import java.awt.event.ActionListener;
|
|||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.event.*;
|
import javax.swing.event.*;
|
||||||
|
|
||||||
import docking.DockingUtils;
|
|
||||||
import docking.widgets.button.GRadioButton;
|
import docking.widgets.button.GRadioButton;
|
||||||
import docking.widgets.label.GDLabel;
|
import docking.widgets.label.GDLabel;
|
||||||
|
import docking.widgets.list.GList;
|
||||||
import docking.wizard.*;
|
import docking.wizard.*;
|
||||||
import ghidra.app.util.GenericHelpTopics;
|
import ghidra.app.util.GenericHelpTopics;
|
||||||
import ghidra.util.HelpLocation;
|
import ghidra.util.HelpLocation;
|
||||||
@ -42,7 +42,7 @@ public class RepositoryPanel extends AbstractWizardJPanel {
|
|||||||
private JRadioButton existingRepButton;
|
private JRadioButton existingRepButton;
|
||||||
private JRadioButton createRepButton;
|
private JRadioButton createRepButton;
|
||||||
private ButtonGroup buttonGroup;
|
private ButtonGroup buttonGroup;
|
||||||
private JList<String> nameList;
|
private GList<String> nameList;
|
||||||
private DefaultListModel<String> listModel;
|
private DefaultListModel<String> listModel;
|
||||||
private JTextField nameField;
|
private JTextField nameField;
|
||||||
private JLabel nameLabel;
|
private JLabel nameLabel;
|
||||||
@ -161,8 +161,7 @@ public class RepositoryPanel extends AbstractWizardJPanel {
|
|||||||
for (String repositoryName : repositoryNames) {
|
for (String repositoryName : repositoryNames) {
|
||||||
listModel.addElement(repositoryName);
|
listModel.addElement(repositoryName);
|
||||||
}
|
}
|
||||||
nameList = new JList<>(listModel);
|
nameList = new GList<>(listModel);
|
||||||
DockingUtils.turnOffHTMLRendering(nameList);
|
|
||||||
nameList.setEnabled(existingRepButton.isSelected());
|
nameList.setEnabled(existingRepButton.isSelected());
|
||||||
JScrollPane sp = new JScrollPane(nameList);
|
JScrollPane sp = new JScrollPane(nameList);
|
||||||
innerPanel.add(sp);
|
innerPanel.add(sp);
|
||||||
|
Loading…
Reference in New Issue
Block a user