mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-24 21:21:56 +00:00
Fixed Structure Editor UI border bug when switching Look and Feel; fixed
help location inception
This commit is contained in:
parent
9d67b8c6ef
commit
d53aa193f0
@ -24,6 +24,7 @@ import java.awt.event.*;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
import javax.swing.border.Border;
|
||||||
import javax.swing.border.TitledBorder;
|
import javax.swing.border.TitledBorder;
|
||||||
import javax.swing.text.DefaultFormatterFactory;
|
import javax.swing.text.DefaultFormatterFactory;
|
||||||
|
|
||||||
@ -36,6 +37,7 @@ import docking.widgets.label.GDLabel;
|
|||||||
import docking.widgets.textfield.GFormattedTextField;
|
import docking.widgets.textfield.GFormattedTextField;
|
||||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||||
import generic.theme.GThemeDefaults.Colors.Viewport;
|
import generic.theme.GThemeDefaults.Colors.Viewport;
|
||||||
|
import generic.theme.Gui;
|
||||||
import ghidra.app.plugin.core.compositeeditor.BitFieldPlacementComponent.BitAttributes;
|
import ghidra.app.plugin.core.compositeeditor.BitFieldPlacementComponent.BitAttributes;
|
||||||
import ghidra.program.model.data.*;
|
import ghidra.program.model.data.*;
|
||||||
import ghidra.program.model.data.Composite;
|
import ghidra.program.model.data.Composite;
|
||||||
@ -695,9 +697,19 @@ public class CompEditorPanel extends CompositeEditorPanel {
|
|||||||
packingPanel.add(packingEnablementButton);
|
packingPanel.add(packingEnablementButton);
|
||||||
|
|
||||||
JPanel innerPanel = new JPanel(new GridBagLayout());
|
JPanel innerPanel = new JPanel(new GridBagLayout());
|
||||||
innerPanel.setBorder(UIManager.getBorder("TitledBorder.border"));
|
Border titledBorder = UIManager.getBorder("TitledBorder.border");
|
||||||
|
innerPanel.setBorder(titledBorder);
|
||||||
packingPanel.add(innerPanel);
|
packingPanel.add(innerPanel);
|
||||||
|
|
||||||
|
// Since we set the border manually, it does not get updated when switching LaFs. Add a
|
||||||
|
// theme listener to update the border ourselves.
|
||||||
|
Gui.addThemeListener(e -> {
|
||||||
|
if (e.isLookAndFeelChanged()) {
|
||||||
|
Border updatedTitledBorder = UIManager.getBorder("TitledBorder.border");
|
||||||
|
innerPanel.setBorder(updatedTitledBorder);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
setupDefaultPackingButton();
|
setupDefaultPackingButton();
|
||||||
setupExplicitPackingButtonAndTextField();
|
setupExplicitPackingButtonAndTextField();
|
||||||
setupPackingEnablementButton();
|
setupPackingEnablementButton();
|
||||||
|
@ -31,11 +31,13 @@ import ghidra.framework.plugintool.Plugin;
|
|||||||
import ghidra.program.model.data.*;
|
import ghidra.program.model.data.*;
|
||||||
import ghidra.program.model.listing.Program;
|
import ghidra.program.model.listing.Program;
|
||||||
import ghidra.util.HelpLocation;
|
import ghidra.util.HelpLocation;
|
||||||
|
import ghidra.util.SystemUtilities;
|
||||||
import ghidra.util.datastruct.WeakDataStructureFactory;
|
import ghidra.util.datastruct.WeakDataStructureFactory;
|
||||||
import ghidra.util.datastruct.WeakSet;
|
import ghidra.util.datastruct.WeakSet;
|
||||||
import ghidra.util.exception.AssertException;
|
import ghidra.util.exception.AssertException;
|
||||||
import help.Help;
|
import help.Help;
|
||||||
import help.HelpService;
|
import help.HelpService;
|
||||||
|
import utilities.util.reflection.ReflectionUtilities;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Editor provider for a Composite Data Type.
|
* Editor provider for a Composite Data Type.
|
||||||
@ -335,8 +337,22 @@ public abstract class CompositeEditorProvider extends ComponentProviderAdapter
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void registerHelp(Object object, String anchor) {
|
protected void registerHelp(Object object, String anchor) {
|
||||||
|
String inception = recordHelpInception();
|
||||||
HelpService help = Help.getHelpService();
|
HelpService help = Help.getHelpService();
|
||||||
help.registerHelp(object, new HelpLocation(getHelpTopic(), getHelpName() + "_" + anchor));
|
String fullAnchor = getHelpName() + "_" + anchor;
|
||||||
|
help.registerHelp(object, new HelpLocation(getHelpTopic(), fullAnchor, inception));
|
||||||
|
}
|
||||||
|
|
||||||
|
private String recordHelpInception() {
|
||||||
|
if (!SystemUtilities.isInDevelopmentMode()) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return getInceptionFromTheFirstClassThatIsNotUsOrABuilder();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getInceptionFromTheFirstClassThatIsNotUsOrABuilder() {
|
||||||
|
Throwable t = ReflectionUtilities.createThrowableWithStackOlderThan("registerHelp");
|
||||||
|
return t.getStackTrace()[0].toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void requestTableFocus() {
|
protected void requestTableFocus() {
|
||||||
|
@ -27,8 +27,8 @@ import docking.DockingUtils;
|
|||||||
import docking.action.*;
|
import docking.action.*;
|
||||||
import docking.widgets.checkbox.GCheckBox;
|
import docking.widgets.checkbox.GCheckBox;
|
||||||
import docking.widgets.label.GLabel;
|
import docking.widgets.label.GLabel;
|
||||||
import docking.widgets.table.*;
|
import docking.widgets.table.GTableCellRenderer;
|
||||||
import docking.widgets.table.threaded.ThreadedTableModel;
|
import docking.widgets.table.GTableCellRenderingData;
|
||||||
import docking.widgets.textfield.IntegerTextField;
|
import docking.widgets.textfield.IntegerTextField;
|
||||||
import generic.theme.GIcon;
|
import generic.theme.GIcon;
|
||||||
import ghidra.app.util.HelpTopics;
|
import ghidra.app.util.HelpTopics;
|
||||||
@ -488,27 +488,10 @@ public class StringTableProvider extends ComponentProviderAdapter implements Dom
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class StringTable extends GhidraTable {
|
|
||||||
public StringTable(ThreadedTableModel<FoundString, ?> model) {
|
|
||||||
super(model);
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Override
|
|
||||||
// protected <T> SelectionManager createSelectionManager(TableModel tableModel) {
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private JComponent buildTablePanel() {
|
private JComponent buildTablePanel() {
|
||||||
stringModel = new StringTableModel(tool, options);
|
stringModel = new StringTableModel(tool, options);
|
||||||
|
|
||||||
threadedTablePanel = new GhidraThreadedTablePanel<>(stringModel, 1000) {
|
threadedTablePanel = new GhidraThreadedTablePanel<>(stringModel, 1000);
|
||||||
@Override
|
|
||||||
protected GTable createTable(ThreadedTableModel<FoundString, ?> model) {
|
|
||||||
return new StringTable(model);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
table = threadedTablePanel.getTable();
|
table = threadedTablePanel.getTable();
|
||||||
table.setActionsEnabled(true);
|
table.setActionsEnabled(true);
|
||||||
table.setName("DataTable");
|
table.setName("DataTable");
|
||||||
|
Loading…
Reference in New Issue
Block a user