Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-2961 - Theme Fixes - Fixed analysis dialog; bitfield editor; VT dual diff highlighting; references window

dragonmacher895be954b10a
diff --git a/Ghidra/Features/Base/data/base.listing.theme.properties b/Ghidra/Features/Base/data/base.listing.theme.properties
index f5bc76c5cc..0a8ede3bfe 100644
--- a/Ghidra/Features/Base/data/base.listing.theme.properties
+++ b/Ghidra/Features/Base/data/base.listing.theme.properties
@@ -114,6 +114,13 @@ color.fg.listing.function.param.dynamic = color.palette.teal
color.fg.listing.function.tag = #ff7090
color.fg.listing.label.primary = color.palette.cyan
+color.bg.listing.comparison.bytes = #C6F4DD
+color.bg.listing.comparison.mnemonic = #C6F4DD
+color.bg.listing.comparison.operand = #C6F4DD
+color.bg.listing.comparison.code.units.diff = #9B6631
+color.bg.listing.comparison.code.units.unmatched = #2A4651
+
+
color.fg.listing.mnemonic.override = color.palette.pink
color.fg.listing.mnemonic = color.palette.cyan
color.fg.listing.mnemonic.unimplemented = color.palette.cyan
diff --git a/Ghidra/Features/Base/data/base.theme.properties b/Ghidra/Features/Base/data/base.theme.properties
index 0dd6c67c68..9666a21797 100644
--- a/Ghidra/Features/Base/data/base.theme.properties
+++ b/Ghidra/Features/Base/data/base.theme.properties
@@ -47,6 +47,7 @@ color.bg.tree.renderer.icon.line = #8282FF
color.bg.analysis.options.not.default.enablement = rgb(255, 255, 200)
color.bg.analysis.options.not.default.enablement.selected = rgb(177, 212, 236)
color.fg.analysis.options.prototype = crimson
+color.fg.analysis.options.prototype.selected = crimson
color.fg.plugin.assembler.completion.least = rgb(0, 128, 0)
color.fg.plugin.assembler.completion.middle = rgb(0, 0, 128)
@@ -170,6 +171,9 @@ font.plugin.tabs.list = SansSerif-BOLD-9
font.plugin.tips = Dialog-PLAIN-12
font.plugin.tips.label = font.plugin.tips[BOLD]
+
+
+
[Dark Defaults]
color.bg.undefined = #5C4D68
@@ -198,16 +202,21 @@ color.bg.listing.highlighter.scoped.read = #ff8000 // blinding orange
color.bg.listing.highlighter.scoped.write = #00ff00 // blinding green
-color.bg.analysis.options.not.default.enablement = DarkOliveGreen
-color.bg.analysis.options.not.default.enablement.selected = olive
+color.bg.analysis.options.not.default.enablement = #707063
+color.bg.analysis.options.not.default.enablement.selected = #536C85
color.fg.analysis.options.prototype = lightcoral
+color.fg.analysis.options.prototype.selected = #FFDDDD
color.bg.plugin.datamgr.edge.default = deepskyblue
color.bg.plugin.datamgr.edge.composite = plum
color.bg.plugin.datamgr.edge.reference = deepskyblue
+color.bg.plugin.editors.compositeeditor.byte.header = [color]text
+
color.fg.plugin.equate.enum = deepskyblue
color.bg.plugin.programdiff.highlight = darkRed
+color.bg.plugin.references.table.active.operand = #5A5E60
+
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/AnalysisEnablementTableModel.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/AnalysisEnablementTableModel.java
index d50651da09..0aac30cb92 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/AnalysisEnablementTableModel.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/AnalysisEnablementTableModel.java
@@ -37,12 +37,13 @@ import ghidra.util.table.column.GColumnRenderer;
public class AnalysisEnablementTableModel
extends GDynamicColumnTableModel<AnalyzerEnablementState, Object> {
+ //@formatter:off
private static Color FG_COLOR_PROTOTYPE = new GColor("color.fg.analysis.options.prototype");
+ private static Color FG_COLOR_PROTOTYPE_SELECTED = new GColor("color.fg.analysis.options.prototype.selected");
- private static Color BG_COLOR_NOT_DEFAULT_ENABLEMENT =
- new GColor("color.bg.analysis.options.not.default.enablement");
- private static Color BG_COLOR_NOT_DEFAULT_ENABLEMENT_SELECTED =
- new GColor("color.bg.analysis.options.not.default.enablement.selected");
+ private static Color BG_COLOR_NOT_DEFAULT_ENABLEMENT = new GColor("color.bg.analysis.options.not.default.enablement");
+ private static Color BG_COLOR_NOT_DEFAULT_ENABLEMENT_SELECTED = new GColor("color.bg.analysis.options.not.default.enablement.selected");
+ //@formatter:on
private List<AnalyzerEnablementState> analyzerStates;
private AnalysisPanel panel;
@@ -209,9 +210,8 @@ public class AnalysisEnablementTableModel
String analyzerName = (String) value;
if (analyzerName.endsWith(AnalysisPanel.PROTOTYPE)) {
- if (!data.isSelected()) {
- component.setForeground(FG_COLOR_PROTOTYPE);
- }
+ Color c = data.isSelected() ? FG_COLOR_PROTOTYPE_SELECTED : FG_COLOR_PROTOTYPE;
+ component.setForeground(c);
}
AnalyzerEnablementState state = (AnalyzerEnablementState) data.getRowObject();
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/compositeeditor/BitFieldEditorPanel.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/compositeeditor/BitFieldEditorPanel.java
index 00fe100de6..be9dad7904 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/compositeeditor/BitFieldEditorPanel.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/compositeeditor/BitFieldEditorPanel.java
@@ -21,6 +21,7 @@ import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.CellEditorListener;
import javax.swing.event.ChangeEvent;
+import javax.swing.plaf.UIResource;
import com.google.common.base.Predicate;
@@ -465,7 +466,13 @@ public class BitFieldEditorPanel extends JPanel {
JScrollPane scrollPane =
new JScrollPane(placementComponent, ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
- scrollPane.getViewport().setBackground(getBackground());
+
+ Color bg = getBackground();
+ if (bg instanceof UIResource) {
+ // Nimbus does not honor the color if it is a UIResource
+ bg = new Color(bg.getRGB());
+ }
+ scrollPane.getViewport().setBackground(bg);
scrollPane.setBorder(null);
bitViewPanel.add(scrollPane);
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/functioncompare/FunctionComparisonPanel.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/functioncompare/FunctionComparisonPanel.java
index 5dd2e8cc3e..59b0d2f2f1 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/functioncompare/FunctionComparisonPanel.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/functioncompare/FunctionComparisonPanel.java
@@ -47,7 +47,7 @@ import help.Help;
import help.HelpService;
/**
- * A panel for displaying {@link Function functions}, {@link Data data}, or
+ * A panel for displaying {@link Function functions}, {@link Data data}, or
* {@link AddressSet address sets} side-by-side for comparison purposes
* <p>
* Note: This is strictly for a one-to-one comparison; if multiple items are to
@@ -84,7 +84,7 @@ public class FunctionComparisonPanel extends JPanel implements ChangeListener {
/**
* Constructor
- *
+ *
* @param provider the GUI provider that includes this panel
* @param tool the tool containing this panel
* @param leftFunction the function displayed in the left side of the panel
@@ -108,7 +108,7 @@ public class FunctionComparisonPanel extends JPanel implements ChangeListener {
/**
* Load the given functions into the views of this panel
- *
+ *
* @param leftFunction The function for the left side of the panel
* @param rightFunction The function for the right side of the panel
*/
@@ -126,7 +126,7 @@ public class FunctionComparisonPanel extends JPanel implements ChangeListener {
/**
* Load the given data into the views of this panel
- *
+ *
* @param leftData The data for the left side of the panel
* @param rightData The data for the right side of the panel
*/
@@ -137,20 +137,19 @@ public class FunctionComparisonPanel extends JPanel implements ChangeListener {
CodeComparisonPanel<? extends FieldPanelCoordinator> activePanel =
getActiveComparisonPanel();
if (activePanel != null) {
- activePanel.loadData(leftComparisonData.getData(),
- rightComparisonData.getData());
+ activePanel.loadData(leftComparisonData.getData(), rightComparisonData.getData());
}
}
/**
- * Load the given addresses of the indicated programs into the views of
+ * Load the given addresses of the indicated programs into the views of
* this panel
- *
+ *
* @param leftProgram the program for the left side of the panel
* @param rightProgram the program for the right side of the panel
- * @param leftAddresses addresses for the info to display in the left side
+ * @param leftAddresses addresses for the info to display in the left side
* of the panel
- * @param rightAddresses addresses for the info to display in the right
+ * @param rightAddresses addresses for the info to display in the right
* side of the panel
*/
public void loadAddresses(Program leftProgram, Program rightProgram,
@@ -170,7 +169,7 @@ public class FunctionComparisonPanel extends JPanel implements ChangeListener {
/**
* Get the actions for this FunctionComparisonPanel
- *
+ *
* @return an array containing the actions
*/
public DockingAction[] getActions() {
@@ -180,7 +179,7 @@ public class FunctionComparisonPanel extends JPanel implements ChangeListener {
/**
* Gets a description to help distinguish this comparison panel from others
- *
+ *
* @return the description
*/
public String getDescription() {
@@ -190,12 +189,10 @@ public class FunctionComparisonPanel extends JPanel implements ChangeListener {
Data rightData = rightComparisonData.getData();
if (leftFunc != null && rightFunc != null) {
- return leftFunc.getName(true) + " & " +
- rightFunc.getName(true);
+ return leftFunc.getName(true) + " & " + rightFunc.getName(true);
}
if (leftData != null && rightData != null) {
- return leftData.getDataType().getName() + " & " +
- rightData.getDataType().getName();
+ return leftData.getDataType().getName() + " & " + rightData.getDataType().getName();
}
// Otherwise give a simple description for address sets
@@ -221,7 +218,7 @@ public class FunctionComparisonPanel extends JPanel implements ChangeListener {
/**
* Returns true if the comparison window has no information to display in
* either the left or right panel
- *
+ *
* @return true if the comparison window has no information to display
*/
public boolean isEmpty() {
@@ -229,9 +226,9 @@ public class FunctionComparisonPanel extends JPanel implements ChangeListener {
}
/**
- * Gets the ListingCodeComparisonPanel being displayed by this panel
+ * Gets the ListingCodeComparisonPanel being displayed by this panel
* if one exists
- *
+ *
* @return the comparison panel or null
*/
public ListingCodeComparisonPanel getDualListingPanel() {
@@ -258,7 +255,7 @@ public class FunctionComparisonPanel extends JPanel implements ChangeListener {
/**
* Set the current tabbed panel to be the component with the given name
- *
+ *
* @param name name of view to set as the current tab
* @return true if the named view was found in the provider map
*/
@@ -276,7 +273,7 @@ public class FunctionComparisonPanel extends JPanel implements ChangeListener {
/**
* Get the name of the current comparison panel being viewed
- *
+ *
* @return the tab name, or null if there is nothing selected
*/
public String getCurrentComponentName() {
@@ -289,13 +286,14 @@ public class FunctionComparisonPanel extends JPanel implements ChangeListener {
/**
* Get the number of views in the tabbed pane
+ * @return the number of views in the tabbed pane
*/
int getNumberOfTabbedComponents() {
return tabNameToComponentMap.size();
}
/**
- * Remove all views in the tabbed pane
+ * Remove all views in the tabbed pane
*/
public void dispose() {
tool.removeComponentProvider(provider);
@@ -355,7 +353,7 @@ public class FunctionComparisonPanel extends JPanel implements ChangeListener {
/**
* Returns the comparison panel that is in the selected tab
- *
+ *
* @return the currently selected comparison panel, or null if nothing
* selected
*/
@@ -373,7 +371,7 @@ public class FunctionComparisonPanel extends JPanel implements ChangeListener {
/**
* Returns the comparison data object for the left panel
- *
+ *
* @return the comparison data object for the left panel
*/
public FunctionComparisonData getLeftComparisonData() {
@@ -382,7 +380,7 @@ public class FunctionComparisonPanel extends JPanel implements ChangeListener {
/**
* Returns the comparison data object for the right panel
- *
+ *
* @return the comparison data object for the right panel
*/
public FunctionComparisonData getRightComparisonData() {
@@ -391,7 +389,7 @@ public class FunctionComparisonPanel extends JPanel implements ChangeListener {
/**
* Gets the function currently displayed in the left side of this panel
- *
+ *
* @return the left function or null
*/
public Function getLeftFunction() {
@@ -400,7 +398,7 @@ public class FunctionComparisonPanel extends JPanel implements ChangeListener {
/**
* Sets the function to display in the left side of this panel
- *
+ *
* @param function the function to display
*/
protected void setLeftFunction(Function function) {
@@ -409,7 +407,7 @@ public class FunctionComparisonPanel extends JPanel implements ChangeListener {
/**
* Gets the function currently displayed in the right side of this panel
- *
+ *
* @return the right function or null
*/
public Function getRightFunction() {
@@ -418,7 +416,7 @@ public class FunctionComparisonPanel extends JPanel implements ChangeListener {
/**
* Sets the function to display in the right side of this panel
- *
+ *
* @param function the function to display
*/
protected void setRightFunction(Function function) {
@@ -427,7 +425,7 @@ public class FunctionComparisonPanel extends JPanel implements ChangeListener {
/**
* Gets the data displayed in the left side of this panel
- *
+ *
* @return the left data or null
*/
public Data getLeftData() {
@@ -436,7 +434,7 @@ public class FunctionComparisonPanel extends JPanel implements ChangeListener {
/**
* Gets the data displayed in the right side of this panel
- *
+ *
* @return the right data
*/
public Data getRightData() {
@@ -444,9 +442,9 @@ public class FunctionComparisonPanel extends JPanel implements ChangeListener {
}
/**
- * Enables/disables mouse navigation for all the CodeComparisonPanels
+ * Enables/disables mouse navigation for all the CodeComparisonPanels
* displayed by this panel
- *
+ *
* @param enabled true to enable mouse navigation in the panels
*/
public void setMouseNavigationEnabled(boolean enabled) {
@@ -456,9 +454,9 @@ public class FunctionComparisonPanel extends JPanel implements ChangeListener {
}
/**
- * Sets up the FunctionComparisonPanel and which CodeComparisonPanel is currently
+ * Sets up the FunctionComparisonPanel and which CodeComparisonPanel is currently
* displayed based on the specified saveState
- *
+ *
* @param prefix identifier to prepend to any save state names to make them unique
* @param saveState the save state for retrieving information
*/
@@ -475,9 +473,9 @@ public class FunctionComparisonPanel extends JPanel implements ChangeListener {
}
/**
- * Saves the information to the save state about the FunctionComparisonPanel and
+ * Saves the information to the save state about the FunctionComparisonPanel and
* which CodeComparisonPanel is currently displayed
- *
+ *
* @param prefix identifier to prepend to any save state names to make them unique
* @param saveState the save state where the information gets written
*/
@@ -494,9 +492,9 @@ public class FunctionComparisonPanel extends JPanel implements ChangeListener {
}
/**
- * Gets all actions for the FunctionComparisonPanel and all CodeComparisonPanels in this
+ * Gets all actions for the FunctionComparisonPanel and all CodeComparisonPanels in this
* FunctionComparisonPanel
- *
+ *
* @return the code comparison actions
*/
public DockingAction[] getCodeComparisonActions() {
@@ -517,9 +515,9 @@ public class FunctionComparisonPanel extends JPanel implements ChangeListener {
}
/**
- * Sets the prefixes that are to be prepended to the title displayed for each side of
+ * Sets the prefixes that are to be prepended to the title displayed for each side of
* each CodeComparisonPanel
- *
+ *
* @param leftTitlePrefix the prefix to prepend to the left titles
* @param rightTitlePrefix the prefix to prepend to the right titles
*/
@@ -535,7 +533,7 @@ public class FunctionComparisonPanel extends JPanel implements ChangeListener {
/**
* Returns the action context for a given mouse event and provider
- *
+ *
* @param event the mouse event
* @param componentProvider the component provider
* @return the action context
@@ -548,13 +546,34 @@ public class FunctionComparisonPanel extends JPanel implements ChangeListener {
if (dualListingPanel != null && dualListingPanel.isAncestorOf(sourceComponent)) {
return dualListingPanel.getActionContext(event, componentProvider);
}
+
+ CodeComparisonPanel<? extends FieldPanelCoordinator> activePanel =
+ getFocusedComparisonPanel();
+ if (activePanel != null) {
+ return activePanel.getActionContext(componentProvider, event);
+ }
+
+ return null;
+ }
+
+ private CodeComparisonPanel<? extends FieldPanelCoordinator> getFocusedComparisonPanel() {
+ Component focused = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
+ if (focused != null) {
+ for (CodeComparisonPanel<? extends FieldPanelCoordinator> codeComparisonPanel : codeComparisonPanels) {
+ JComponent component = codeComparisonPanel.getComponent();
+ boolean isParent = SwingUtilities.isDescendingFrom(focused, component);
+ if (isParent) {
+ return codeComparisonPanel;
+ }
+ }
+ }
return null;
}
/**
- * Determines if the layouts of the views are synchronized with respect
+ * Determines if the layouts of the views are synchronized with respect
* to scrolling and location
- *
+ *
* @return true if scrolling is synchronized between the two views
*/
public final boolean isScrollingSynced() {
@@ -563,8 +582,8 @@ public class FunctionComparisonPanel extends JPanel implements ChangeListener {
/**
* Sets whether or not scrolling is synchronized
- *
- * @param syncScrolling true means synchronize scrolling and location
+ *
+ * @param syncScrolling true means synchronize scrolling and location
* between the two views
*/
public void setScrollingSyncState(boolean syncScrolling) {
@@ -583,7 +602,7 @@ public class FunctionComparisonPanel extends JPanel implements ChangeListener {
/**
* Gets the currently displayed CodeComparisonPanel
- *
+ *
* @return the current panel or null.
*/
public CodeComparisonPanel<? extends FieldPanelCoordinator> getDisplayedPanel() {
@@ -603,7 +622,7 @@ public class FunctionComparisonPanel extends JPanel implements ChangeListener {
/**
* Get the current code comparison panel being viewed
- *
+ *
* @return null if there is no code comparison panel
*/
CodeComparisonPanel<? extends FieldPanelCoordinator> getCurrentComponent() {
@@ -612,7 +631,7 @@ public class FunctionComparisonPanel extends JPanel implements ChangeListener {
/**
* Returns true if the clicked object is a tab
- *
+ *
* @param event the mouse event
* @return true if the clicked object is a tab
*/
@@ -664,7 +683,7 @@ public class FunctionComparisonPanel extends JPanel implements ChangeListener {
/**
* Discovers the CodeComparisonPanels which are extension points
- *
+ *
* @return the CodeComparisonPanels which are extension points
*/
private List<CodeComparisonPanel<? extends FieldPanelCoordinator>> getCodeComparisonPanels() {
@@ -673,7 +692,7 @@ public class FunctionComparisonPanel extends JPanel implements ChangeListener {
Set<CodeComparisonPanel<? extends FieldPanelCoordinator>> instances =
createAllPossibleCodeComparisonPanels();
- // Put all panels in CodeComparisonPanel list; at same time, get a
+ // Put all panels in CodeComparisonPanel list; at same time, get a
// list of superseded panels.
ArrayList<Class<? extends CodeComparisonPanel<? extends FieldPanelCoordinator>>> classesOfPanelsToSupersede =
new ArrayList<>();
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/references/EditReferencesProvider.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/references/EditReferencesProvider.java
index 41dbbd3899..39dd6b7022 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/references/EditReferencesProvider.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/references/EditReferencesProvider.java
@@ -933,6 +933,7 @@ public class EditReferencesProvider extends ComponentProviderAdapter
RefCellBooleanRenderer() {
// cb.setBorder(BorderFactory.createEmptyBorder(0, 3, 0, 0));
+ cb.setOpaque(true);
}
@Override
@@ -953,14 +954,13 @@ public class EditReferencesProvider extends ComponentProviderAdapter
enabled = tableModel.isCellEditable(row, column);
}
cb.setEnabled(enabled);
- cb.setOpaque(false);
cb.setFont(table.getFont());
+ cb.setBackground(getBackground());
if (!isSelected) {
if (ref.getOperandIndex() == instrPanel.getSelectedOpIndex()) {
cb.setBackground(BG_COLOR_ACTIVE_OPERAND);
setBackground(BG_COLOR_ACTIVE_OPERAND);
- cb.setOpaque(true);
}
}
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/action/DockingAction.java b/Ghidra/Framework/Docking/src/main/java/docking/action/DockingAction.java
index b06989062b..5f6e96b545 100644
--- a/Ghidra/Framework/Docking/src/main/java/docking/action/DockingAction.java
+++ b/Ghidra/Framework/Docking/src/main/java/docking/action/DockingAction.java
@@ -25,12 +25,12 @@ import javax.swing.*;
import docking.*;
import docking.widgets.EmptyBorderButton;
+import generic.theme.GIcon;
import ghidra.util.*;
import ghidra.util.datastruct.WeakDataStructureFactory;
import ghidra.util.datastruct.WeakSet;
import ghidra.util.exception.AssertException;
import resources.ResourceManager;
-import resources.icons.FileBasedIcon;
import utilities.util.reflection.ReflectionUtilities;
/**
@@ -491,10 +491,15 @@ public abstract class DockingAction implements DockingActionIf {
buffer.append('\n');
}
- Icon icon = menuBarData.getMenuIcon();
- if (icon instanceof FileBasedIcon filebasedIcon) {
- String filename = filebasedIcon.getFilename();
- buffer.append(" MENU ICON: ").append(filename);
+ String iconName = getIconName(menuBarData.getMenuIcon());
+ if (iconName != null) {
+ buffer.append(" MENU ICON: ").append(iconName);
+ buffer.append('\n');
+ }
+
+ String iconId = getIconId(menuBarData.getMenuIcon());
+ if (iconId != null) {
+ buffer.append(" MENU ICON ID: ").append(iconId);
buffer.append('\n');
}
}
@@ -519,10 +524,15 @@ public abstract class DockingAction implements DockingActionIf {
buffer.append('\n');
}
- Icon icon = popupMenuData.getMenuIcon();
- if (icon instanceof FileBasedIcon fileBasedIcon) {
- String filename = fileBasedIcon.getFilename();
- buffer.append(" POPUP ICON: ").append(filename);
+ String iconName = getIconName(popupMenuData.getMenuIcon());
+ if (iconName != null) {
+ buffer.append(" POPUP ICON: ").append(iconName);
+ buffer.append('\n');
+ }
+
+ String iconId = getIconId(popupMenuData.getMenuIcon());
+ if (iconId != null) {
+ buffer.append(" POPUP ICON ID: ").append(iconId);
buffer.append('\n');
}
}
@@ -530,20 +540,17 @@ public abstract class DockingAction implements DockingActionIf {
if (toolBarData != null) {
buffer.append(" TOOLBAR GROUP: ").append(toolBarData.getToolBarGroup());
buffer.append('\n');
- Icon icon = toolBarData.getIcon();
- if (icon != null) {
- if (icon instanceof FileBasedIcon) {
- FileBasedIcon wrapper = (FileBasedIcon) icon;
- String filename = wrapper.getFilename();
- buffer.append(" TOOLBAR ICON: ").append(filename);
- buffer.append('\n');
- }
- else if (icon instanceof ImageIcon) {
- ImageIcon ii = (ImageIcon) icon;
- String text = ii.getDescription();
- buffer.append(" TOOLBAR ICON: ").append(text);
- buffer.append('\n');
- }
+
+ String iconName = getIconName(toolBarData.getIcon());
+ if (iconName != null) {
+ buffer.append(" TOOLBAR ICON: ").append(iconName);
+ buffer.append('\n');
+ }
+
+ String iconId = getIconId(toolBarData.getIcon());
+ if (iconId != null) {
+ buffer.append(" TOOLBAR ICON ID: ").append(iconId);
+ buffer.append('\n');
}
}
@@ -566,6 +573,30 @@ public abstract class DockingAction implements DockingActionIf {
return buffer.toString();
}
+ private String getIconId(Icon icon) {
+ if (icon instanceof GIcon gIcon) {
+ return gIcon.getId();
+ }
+ return null;
+ }
+
+ private String getIconName(Icon icon) {
+ if (icon == null) {
+ return null;
+ }
+
+ String iconName = ResourceManager.getIconName(icon);
+ if (iconName == null) {
+ return null;
+ }
+
+ int index = iconName.lastIndexOf('/');
+ if (index != -1) {
+ return iconName.substring(index + 1);
+ }
+ return iconName;
+ }
+
public void firePropertyChanged(String propertyName, Object oldValue, Object newValue) {
if (Objects.equals(oldValue, newValue)) {
return;
diff --git a/Ghidra/Framework/Gui/data/gui.theme.properties b/Ghidra/Framework/Gui/data/gui.theme.properties
index deeb30c889..dc27d18403 100644
--- a/Ghidra/Framework/Gui/data/gui.theme.properties
+++ b/Ghidra/Framework/Gui/data/gui.theme.properties
@@ -127,6 +127,8 @@ color.fg.table.uneditable.unselected = lightgray
color.bg.tree = color.bg
color.bg.tree.selected = [color]Tree.selectionBackground
+// this looks different than the light mode version; good enough until we make a better icon
+icon.make.selection = stack.png
[CDE/Motif]
diff --git a/Ghidra/Framework/Gui/src/main/java/resources/ResourceManager.java b/Ghidra/Framework/Gui/src/main/java/resources/ResourceManager.java
index c59046825f..424a7add97 100644
--- a/Ghidra/Framework/Gui/src/main/java/resources/ResourceManager.java
+++ b/Ghidra/Framework/Gui/src/main/java/resources/ResourceManager.java
@@ -437,7 +437,12 @@ public class ResourceManager {
if (icon instanceof ImageIcon) {
return ((ImageIcon) icon).getDescription();
}
- if (icon instanceof GIcon) {
+ if (icon instanceof GIcon gIcon) {
+ Icon delegateIcon = gIcon.getDelegate();
+ String name = getIconName(delegateIcon);
+ if (name != null) {
+ return name;
+ }
return ((GIcon) icon).getId();
}
if (icon instanceof TranslateIcon) {