diff --git a/Ghidra/Debug/ProposedUtils/src/main/java/docking/widgets/table/CustomToStringCellRenderer.java b/Ghidra/Debug/ProposedUtils/src/main/java/docking/widgets/table/CustomToStringCellRenderer.java index e0fadc6477..3a45e45eb6 100644 --- a/Ghidra/Debug/ProposedUtils/src/main/java/docking/widgets/table/CustomToStringCellRenderer.java +++ b/Ghidra/Debug/ProposedUtils/src/main/java/docking/widgets/table/CustomToStringCellRenderer.java @@ -118,7 +118,7 @@ public class CustomToStringCellRenderer extends AbstractGColumnRenderer { public Component getTableCellRendererComponent(GTableCellRenderingData data) { super.getTableCellRendererComponent(data); setText(toString.apply(cls.cast(data.getValue()), data.getColumnSettings())); - if (getHTMLRenderingEnabled()) { + if (isHTMLRenderingEnabled()) { setVerticalAlignment(SwingConstants.TOP); } else { diff --git a/Ghidra/Features/Base/src/main/help/help/topics/About/About_Ghidra.htm b/Ghidra/Features/Base/src/main/help/help/topics/About/About_Ghidra.htm index dcf7677752..bf367a06e1 100644 --- a/Ghidra/Features/Base/src/main/help/help/topics/About/About_Ghidra.htm +++ b/Ghidra/Features/Base/src/main/help/help/topics/About/About_Ghidra.htm @@ -78,7 +78,7 @@

User Agreement

diff --git a/Ghidra/Features/Base/src/main/help/help/topics/About/About_Program_File.htm b/Ghidra/Features/Base/src/main/help/help/topics/About/About_Program_File.htm index d5e5b12677..fcaa5da665 100644 --- a/Ghidra/Features/Base/src/main/help/help/topics/About/About_Program_File.htm +++ b/Ghidra/Features/Base/src/main/help/help/topics/About/About_Program_File.htm @@ -13,7 +13,7 @@

About Program

-

The About Program... dialog displays summary information about a program. 
+

The About Program dialog displays summary information about a program. 

To view information about the currently open (active) program

diff --git a/Ghidra/Features/Base/src/main/help/help/topics/ClearPlugin/Clear.htm b/Ghidra/Features/Base/src/main/help/help/topics/ClearPlugin/Clear.htm index c44b8239ec..bf801c6999 100644 --- a/Ghidra/Features/Base/src/main/help/help/topics/ClearPlugin/Clear.htm +++ b/Ghidra/Features/Base/src/main/help/help/topics/ClearPlugin/Clear.htm @@ -5,7 +5,6 @@ -

Clear

@@ -183,7 +182,7 @@ with a Cancel button. The Cancel button may be pressed to terminate the action.

-

Note You can undo clearing of code units +

Note You can undo clearing of code units if it has an undesired effect

The Clear Flow options dialog has check boxes to control diff --git a/Ghidra/Features/Base/src/main/help/help/topics/EclipseIntegration/EclipseIntegration.htm b/Ghidra/Features/Base/src/main/help/help/topics/EclipseIntegration/EclipseIntegration.htm index d7fb178149..87761ebbfa 100644 --- a/Ghidra/Features/Base/src/main/help/help/topics/EclipseIntegration/EclipseIntegration.htm +++ b/Ghidra/Features/Base/src/main/help/help/topics/EclipseIntegration/EclipseIntegration.htm @@ -2,13 +2,9 @@ - - - Ghidra Script Manager + Eclipse Integration - @@ -22,7 +18,8 @@

The Eclipse installation location and communication ports can be configured in the Front End tool's Eclipse Integration options. If an attempt is made to launch Eclipse from Ghidra and these things are not configured correctly, the user will be taken to Eclipse - Integration options automatically./P> + Integration options automatically. +

Eclipse Integration Tool Options

diff --git a/Ghidra/Features/Base/src/main/help/help/topics/FrontEndPlugin/Ghidra_Front_end.htm b/Ghidra/Features/Base/src/main/help/help/topics/FrontEndPlugin/Ghidra_Front_end.htm index 99da150e3c..b85cfc1d1b 100644 --- a/Ghidra/Features/Base/src/main/help/help/topics/FrontEndPlugin/Ghidra_Front_end.htm +++ b/Ghidra/Features/Base/src/main/help/help/topics/FrontEndPlugin/Ghidra_Front_end.htm @@ -392,7 +392,7 @@

To view information about a - file, right mouse click on the file in the data tree and choose the About... + file, right mouse click on the file in the data tree and choose the About Program option.

diff --git a/Ghidra/Features/Base/src/main/help/help/topics/FrontEndPlugin/Ghidra_Front_end_Menus.htm b/Ghidra/Features/Base/src/main/help/help/topics/FrontEndPlugin/Ghidra_Front_end_Menus.htm index 5536640baf..6e7d68a290 100644 --- a/Ghidra/Features/Base/src/main/help/help/topics/FrontEndPlugin/Ghidra_Front_end_Menus.htm +++ b/Ghidra/Features/Base/src/main/help/help/topics/FrontEndPlugin/Ghidra_Front_end_Menus.htm @@ -24,7 +24,7 @@ and restore options show up only in the Ghidra Project Window even though the plugins providing these options can be added to other tools. To bring up the Configure Tool Plugins  dialog, select the File - Configure... option.

+ Configure option.

@@ -86,7 +86,7 @@ dialog.

To bring up the Options dialog, select EditOptions...

+ "help/shared/arrow.gif" border="0">Tool Options

Related Topics: 

diff --git a/Ghidra/Features/Base/src/main/help/help/topics/Tool/Configure_Tool.htm b/Ghidra/Features/Base/src/main/help/help/topics/Tool/Configure_Tool.htm index 0365f3887c..94eeb547f4 100644 --- a/Ghidra/Features/Base/src/main/help/help/topics/Tool/Configure_Tool.htm +++ b/Ghidra/Features/Base/src/main/help/help/topics/Tool/Configure_Tool.htm @@ -16,7 +16,7 @@

The Configure Tool dialog allows you to add/remove plugin packages or individual Plugins from a tool. To display the Configure Tool dialog, select File Configure....This dialog is also displayed when you Configure.This dialog is also displayed when you create a new tool.  

diff --git a/Ghidra/Features/Base/src/main/help/help/topics/Tool/ToolOptions_Dialog.htm b/Ghidra/Features/Base/src/main/help/help/topics/Tool/ToolOptions_Dialog.htm index 85621a9a6e..fe1527e7c8 100644 --- a/Ghidra/Features/Base/src/main/help/help/topics/Tool/ToolOptions_Dialog.htm +++ b/Ghidra/Features/Base/src/main/help/help/topics/Tool/ToolOptions_Dialog.htm @@ -31,7 +31,7 @@

To display the Options dialog, select EditTool Options... from the tool menu.

+ "help/shared/arrow.gif">Tool Options from the tool menu.

Restoring Default Settings

@@ -117,7 +117,7 @@
  1. Select Edit Tool Options... from the main + "help/shared/arrow.gif"> Tool Options from the main menu.
  2. Select the Key Bindings node in the options tree.
  3. @@ -155,7 +155,7 @@
    1. Select Edit Tool Options... from the main + "help/shared/arrow.gif"> Tool Options from the main menu.
    2. Select the Key Bindings node in the options tree.
    3. @@ -178,7 +178,7 @@
      1. Select Edit Tool Options... from the main + "help/shared/arrow.gif"> Tool Options from the main menu.
      2. Select the Key Bindings node in the options tree.
      3. @@ -259,14 +259,13 @@
        1. Select Edit Options... from the Tool - menu.
        2. + "help/shared/arrow.gif"> Tool Options from the menu bar.
        3. Select the Key Bindings node in the options tree.
        4. Press the Export... button.
        5. -
        6. If you have made changes, then you will be promted to apply those changes before +
        7. If you have made changes, then you will be prompted to apply those changes before continuing.
        8. On the file chooser dialog, choose a file to which to export key bindings.
        9. @@ -356,7 +355,7 @@
          1. From the tool, select Edit - Tool Options...
          2. + Tool Options
          3. Select the Tool node in the options tree.
          4. diff --git a/Ghidra/Features/Base/src/main/help/help/topics/TranslateStringsPlugin/TranslateStringsPlugin.htm b/Ghidra/Features/Base/src/main/help/help/topics/TranslateStringsPlugin/TranslateStringsPlugin.htm index ff66b501f9..a09edb9680 100644 --- a/Ghidra/Features/Base/src/main/help/help/topics/TranslateStringsPlugin/TranslateStringsPlugin.htm +++ b/Ghidra/Features/Base/src/main/help/help/topics/TranslateStringsPlugin/TranslateStringsPlugin.htm @@ -86,7 +86,7 @@

            Once installed, the translation service plugins, like all plugins, can be found in the File -> - Configure... window and must be enabled before they will + Configure window and must be enabled before they will appear in the Data -> Translate menu.

            diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/checksums/ComputeChecksumsProvider.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/checksums/ComputeChecksumsProvider.java index 6b06ef4886..6de494c327 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/checksums/ComputeChecksumsProvider.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/checksums/ComputeChecksumsProvider.java @@ -25,7 +25,7 @@ import docking.ActionContext; import docking.action.*; import docking.widgets.label.GDLabel; import generic.theme.GIcon; -import generic.theme.GThemeDefaults.Colors; +import generic.theme.GThemeDefaults.Colors.Messages; import ghidra.app.context.ProgramContextAction; import ghidra.framework.plugintool.ComponentProviderAdapter; import ghidra.util.HelpLocation; @@ -96,7 +96,7 @@ public class ComputeChecksumsProvider extends ComponentProviderAdapter { errorStatus = new GDLabel(" "); errorStatus.setName("message"); errorStatus.setHorizontalAlignment(SwingConstants.CENTER); - errorStatus.setForeground(Colors.ERROR); + errorStatus.setForeground(Messages.ERROR); errorStatus.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); main.add(errorStatus, BorderLayout.SOUTH); @@ -104,7 +104,7 @@ public class ComputeChecksumsProvider extends ComponentProviderAdapter { } /* - * Starts new task every time the generate button is clicked so that the tool would not + * Starts new task every time the generate button is clicked so that the tool would not * be hosed up if checksumming takes a long time */ private void generate() { @@ -122,7 +122,7 @@ public class ComputeChecksumsProvider extends ComponentProviderAdapter { } /* - * Once checksumming has completed, method will display results depending on the options + * Once checksumming has completed, method will display results depending on the options * that are selected in window */ void generateChecksumCompleted() { @@ -250,8 +250,8 @@ public class ComputeChecksumsProvider extends ComponentProviderAdapter { }; selectionAction.setHelpLocation(new HelpLocation("ComputeChecksumsPlugin", "On_Selection")); selectionAction.setEnabled(plugin.hasSelection()); - selectionAction.setToolBarData( - new ToolBarData(new GIcon("icon.plugin.checksum.select"), null)); + selectionAction + .setToolBarData(new ToolBarData(new GIcon("icon.plugin.checksum.select"), null)); selectionAction.setDescription("When toggled, generates checksums on " + "selection. Otherwise checksums are generated over the entire program"); @@ -268,8 +268,8 @@ public class ComputeChecksumsProvider extends ComponentProviderAdapter { }; showHexAction.setHelpLocation(new HelpLocation("ComputeChecksumsPlugin", "As_Hex")); showHexAction.setEnabled(true); - showHexAction.setToolBarData( - new ToolBarData(new GIcon("icon.plugin.checksum.show.hex"), null)); + showHexAction + .setToolBarData(new ToolBarData(new GIcon("icon.plugin.checksum.show.hex"), null)); showHexAction.setDescription("Toggle to show the hex values instead of decimal values."); xorAction = new ToggleDockingAction("XOR Checksum Values", plugin.getName()) { @@ -288,8 +288,7 @@ public class ComputeChecksumsProvider extends ComponentProviderAdapter { }; xorAction.setHelpLocation(new HelpLocation("ComputeChecksumsPlugin", "xor")); xorAction.setEnabled(true); - xorAction.setToolBarData( - new ToolBarData(new GIcon("icon.plugin.checksum.xor"), null)); + xorAction.setToolBarData(new ToolBarData(new GIcon("icon.plugin.checksum.xor"), null)); xorAction.setDescription("Toggle to recompute values with a xor operation."); carryAction = new ToggleDockingAction("Carry Checksum Values", plugin.getName()) { @@ -309,8 +308,7 @@ public class ComputeChecksumsProvider extends ComponentProviderAdapter { }; carryAction.setHelpLocation(new HelpLocation("ComputeChecksumsPlugin", "carry")); carryAction.setEnabled(true); - carryAction.setToolBarData( - new ToolBarData(new GIcon("icon.plugin.checksum.carry"), null)); + carryAction.setToolBarData(new ToolBarData(new GIcon("icon.plugin.checksum.carry"), null)); carryAction.setDescription("Toggle to recompute values with a carry operation."); onesCompAction = new ToggleDockingAction("Ones Complement", plugin.getName()) { diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/clear/ClearPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/clear/ClearPlugin.java index 97fba29664..ecc325c2f9 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/clear/ClearPlugin.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/clear/ClearPlugin.java @@ -208,7 +208,7 @@ public class ClearPlugin extends Plugin { new ActionBuilder(CLEAR_WITH_OPTIONS_NAME, getName()) .menuPath(ToolConstants.MENU_EDIT, CLEAR_WITH_OPTIONS_NAME + "...") .menuGroup(CLEAR_CODE_BYTES_NAME, "2") - .popupMenuPath(CLEAR_WITH_OPTIONS_NAME) + .popupMenuPath(CLEAR_WITH_OPTIONS_NAME + "...") .popupMenuGroup(CLEAR_CODE_BYTES_NAME, "2") .withContext(ListingActionContext.class) .inWindow(ActionBuilder.When.CONTEXT_MATCHES) @@ -218,7 +218,7 @@ public class ClearPlugin extends Plugin { new ActionBuilder(CLEAR_FLOW_AND_REPAIR, getName()) .menuPath(ToolConstants.MENU_EDIT, CLEAR_FLOW_AND_REPAIR + "...") .menuGroup(CLEAR_CODE_BYTES_NAME, "3") - .popupMenuPath(CLEAR_FLOW_AND_REPAIR) + .popupMenuPath(CLEAR_FLOW_AND_REPAIR + "...") .popupMenuGroup(CLEAR_CODE_BYTES_NAME, "3") .withContext(ListingActionContext.class) .inWindow(ActionBuilder.When.CONTEXT_MATCHES) @@ -258,6 +258,7 @@ public class ClearPlugin extends Plugin { clear(opts, context); } + /** * Pop up the clear with options dialog. */ diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/CodeViewerProvider.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/CodeViewerProvider.java index ec4036e92e..7bd990cc9d 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/CodeViewerProvider.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/CodeViewerProvider.java @@ -4,9 +4,9 @@ * 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. diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/hover/DataTypeListingHover.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/hover/DataTypeListingHover.java index a8be3b9be8..de0659147e 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/hover/DataTypeListingHover.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/hover/DataTypeListingHover.java @@ -19,7 +19,7 @@ import javax.swing.JComponent; import docking.widgets.fieldpanel.field.Field; import docking.widgets.fieldpanel.support.FieldLocation; -import generic.theme.GThemeDefaults.Colors; +import generic.theme.GThemeDefaults.Colors.Messages; import ghidra.GhidraOptions; import ghidra.app.plugin.core.hover.AbstractConfigurableHover; import ghidra.app.util.ToolTipUtils; @@ -111,9 +111,8 @@ public class DataTypeListingHover extends AbstractConfigurableHover implements L warningMsg += "WARNING! Invalid Storage"; } if (warningMsg.length() != 0) { - String errorText = - "
            " + - warningMsg + "!

            "; + String errorText = "
            " + warningMsg + "!

            "; toolTipText = toolTipText.replace("", errorText); } return createTooltipComponent(toolTipText); @@ -151,9 +150,8 @@ public class DataTypeListingHover extends AbstractConfigurableHover implements L result += "
            Missing NULL terminator."; } if (sdi.getStringLength() > dataInstance.getLength()) { - result += - "
            String exceeds data field."; + result += "
            String exceeds data field."; } } return result; 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 e1e015aa65..1717f59771 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 @@ -31,7 +31,7 @@ import docking.widgets.OptionDialog; import docking.widgets.button.GButton; import docking.widgets.label.GDLabel; import generic.theme.GIcon; -import generic.theme.GThemeDefaults.Colors; +import generic.theme.GThemeDefaults.Colors.Messages; import ghidra.app.plugin.core.compositeeditor.BitFieldPlacementComponent.BitAttributes; import ghidra.app.plugin.core.compositeeditor.BitFieldPlacementComponent.BitFieldAllocation; import ghidra.app.services.DataTypeManagerService; @@ -82,7 +82,6 @@ public class BitFieldEditorPanel extends JPanel { BitFieldEditorPanel(Composite composite, DataTypeManagerService dtmService, Predicate dataTypeValidator) { - super(); this.composite = composite; if (composite.isPackingEnabled()) { @@ -167,8 +166,7 @@ public class BitFieldEditorPanel extends JPanel { else { allocOffsetStr = Integer.toString(allocOffset); } - String text = - "Structure Offset of Allocation Unit: " + allocOffsetStr; + String text = "Structure Offset of Allocation Unit: " + allocOffsetStr; allocationOffsetLabel.setText(text); int offset = placementComponent.getAllocationOffset(); @@ -183,7 +181,7 @@ public class BitFieldEditorPanel extends JPanel { statusTextField = new GDLabel(" "); statusTextField.setHorizontalAlignment(SwingConstants.CENTER); - statusTextField.setForeground(Colors.ERROR); + statusTextField.setForeground(Messages.ERROR); // use a strut panel so the size of the message area does not change if we make // the message label not visible diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/actions/DeleteArchiveAction.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/actions/DeleteArchiveAction.java index 7e2343a725..bf0fba6450 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/actions/DeleteArchiveAction.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/actions/DeleteArchiveAction.java @@ -24,7 +24,7 @@ import docking.ActionContext; import docking.action.*; import docking.widgets.OptionDialog; import docking.widgets.tree.GTree; -import generic.theme.GThemeDefaults.Colors; +import generic.theme.GThemeDefaults.Colors.Messages; import ghidra.app.plugin.core.datamgr.DataTypeManagerPlugin; import ghidra.app.plugin.core.datamgr.DataTypesActionContext; import ghidra.app.plugin.core.datamgr.archive.FileArchive; @@ -95,9 +95,8 @@ public class DeleteArchiveAction extends DockingAction { if (OptionDialog.showOptionDialogWithCancelAsDefaultButton(gTree, "Confirm Delete Operation", "Are you sure you want to delete archive: " + - HTMLUtilities.escapeHTML(node.getName()) + "?

            " + - "(WARNING: This action will permanently " + + HTMLUtilities.escapeHTML(node.getName()) + "?

            " + "(WARNING: This action will permanently " + "delete the file from disk.)
            ", "Yes", OptionDialog.QUESTION_MESSAGE) != OptionDialog.OPTION_ONE) { return; diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/actions/RemoveInvalidArchiveFromProgramAction.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/actions/RemoveInvalidArchiveFromProgramAction.java index 43895edceb..634c2dc991 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/actions/RemoveInvalidArchiveFromProgramAction.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/actions/RemoveInvalidArchiveFromProgramAction.java @@ -23,7 +23,7 @@ import docking.action.MenuData; import docking.widgets.OptionDialog; import docking.widgets.tree.GTree; import docking.widgets.tree.GTreeNode; -import generic.theme.GThemeDefaults.Colors; +import generic.theme.GThemeDefaults.Colors.Messages; import ghidra.app.plugin.core.datamgr.DataTypeManagerPlugin; import ghidra.app.plugin.core.datamgr.DataTypesActionContext; import ghidra.app.plugin.core.datamgr.archive.*; @@ -79,8 +79,7 @@ public class RemoveInvalidArchiveFromProgramAction extends DockingAction { if (OptionDialog.showOptionDialog(gtree, "Confirm Remove Invalid Archive(s)", "Are you sure you want to delete archive: " + HTMLUtilities.escapeHTML(invalidArchiveNode.getName()) + - " from the program?

            " + - "
            " + "(WARNING: This action will disassociate " + "all datatypes in the program from this archive.)
            ", "Yes", OptionDialog.QUESTION_MESSAGE) != OptionDialog.OPTION_ONE) { diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/editor/EnumEditorProvider.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/editor/EnumEditorProvider.java index e9672e30ac..5d0220d841 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/editor/EnumEditorProvider.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/editor/EnumEditorProvider.java @@ -32,7 +32,7 @@ import docking.ComponentProvider; import docking.action.*; import docking.widgets.OptionDialog; import generic.theme.GIcon; -import generic.theme.GThemeDefaults.Colors; +import generic.theme.GThemeDefaults.Colors.Messages; import ghidra.app.plugin.core.compositeeditor.EditorListener; import ghidra.app.plugin.core.compositeeditor.EditorProvider; import ghidra.app.plugin.core.datamgr.DataTypeManagerPlugin; @@ -399,9 +399,9 @@ public class EnumEditorProvider extends ComponentProviderAdapter } private int showOptionDialog(Enum editedEnoom, Set oldNameFields) { - StringBuilder msg = new StringBuilder( - "If you save this Enum with the new value(s) listed below,
            " + + StringBuilder msg = + new StringBuilder("If you save this Enum with the new value(s) listed below,
            " + " it will invalidate equates created with the old value(s).
            "); msg.append("
              "); for (String field : oldNameFields) { @@ -414,7 +414,7 @@ public class EnumEditorProvider extends ComponentProviderAdapter newVal = "Missing"; } msg.append(String.format( - "
            • %s: 0x%s \u2192 %s: 0x%s \u2192 %s
            • ", HTMLUtilities.escapeHTML(field), Long.toHexString(originalEnum.getValue(field)), newVal)); diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/script/GhidraScriptEditorComponentProvider.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/script/GhidraScriptEditorComponentProvider.java index 62bbdf4135..a05cd1c781 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/script/GhidraScriptEditorComponentProvider.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/script/GhidraScriptEditorComponentProvider.java @@ -33,6 +33,7 @@ import docking.widgets.OptionDialog; import generic.jar.ResourceFile; import generic.theme.*; import generic.theme.GThemeDefaults.Colors; +import generic.theme.GThemeDefaults.Colors.Messages; import ghidra.app.script.GhidraScriptUtil; import ghidra.util.*; import ghidra.util.datastruct.FixedSizeStack; @@ -215,8 +216,7 @@ public class GhidraScriptEditorComponentProvider extends ComponentProvider { } }; undoAction.setDescription("Undo"); - undoAction.setToolBarData( - new ToolBarData(new GIcon("icon.undo"), "UndoRedo")); + undoAction.setToolBarData(new ToolBarData(new GIcon("icon.undo"), "UndoRedo")); undoAction.setEnabled(false); undoAction.setKeyBindingData(new KeyBindingData( KeyStroke.getKeyStroke(KeyEvent.VK_Z, DockingUtils.CONTROL_KEY_MODIFIER_MASK))); @@ -236,8 +236,7 @@ public class GhidraScriptEditorComponentProvider extends ComponentProvider { } }; redoAction.setDescription("Redo"); - redoAction.setToolBarData( - new ToolBarData(new GIcon("icon.redo"), "UndoRedo")); + redoAction.setToolBarData(new ToolBarData(new GIcon("icon.redo"), "UndoRedo")); redoAction.setKeyBindingData(new KeyBindingData( KeyStroke.getKeyStroke(KeyEvent.VK_Y, DockingUtils.CONTROL_KEY_MODIFIER_MASK))); redoAction.setEnabled(false); @@ -264,8 +263,7 @@ public class GhidraScriptEditorComponentProvider extends ComponentProvider { } }; saveAction.setDescription("Save"); - saveAction.setToolBarData( - new ToolBarData(Icons.SAVE_ICON, "Save")); + saveAction.setToolBarData(new ToolBarData(Icons.SAVE_ICON, "Save")); saveAction.setKeyBindingData(new KeyBindingData( KeyStroke.getKeyStroke(KeyEvent.VK_S, DockingUtils.CONTROL_KEY_MODIFIER_MASK))); @@ -301,8 +299,7 @@ public class GhidraScriptEditorComponentProvider extends ComponentProvider { } }; saveAsAction.setDescription("Save As..."); - saveAsAction.setToolBarData( - new ToolBarData(Icons.SAVE_AS_ICON, "Save")); + saveAsAction.setToolBarData(new ToolBarData(Icons.SAVE_AS_ICON, "Save")); saveAsAction.setEnabled(true); plugin.getTool().addLocalAction(this, saveAsAction); @@ -339,8 +336,7 @@ public class GhidraScriptEditorComponentProvider extends ComponentProvider { doSelectFont(); } }; - fontAction.setToolBarData( - new ToolBarData(new GIcon("icon.font"), "ZZFont")); + fontAction.setToolBarData(new ToolBarData(new GIcon("icon.font"), "ZZFont")); fontAction.setDescription("Select Font"); fontAction.setEnabled(true); plugin.getTool().addLocalAction(this, fontAction); @@ -363,7 +359,7 @@ public class GhidraScriptEditorComponentProvider extends ComponentProvider { return; } - // if not changed, then do nothing but print a message to let the user know that we + // if not changed, then do nothing but print a message to let the user know that we // tried if (!hasFileOnDiskChanged()) { plugin.getTool().setStatusInfo("Refresh Script - file has not changed"); @@ -403,7 +399,7 @@ public class GhidraScriptEditorComponentProvider extends ComponentProvider { } } - /** + /** * Returns false if the user cancels--meaning they did not make a decision regarding the * file (or 'handle' it). */ @@ -433,8 +429,7 @@ public class GhidraScriptEditorComponentProvider extends ComponentProvider { int choice = OptionDialog.showOptionDialog(scrollPane, FILE_ON_DISK_CHANGED_TITLE, "The contents of the script file have changed on disk.

              Would " + "you like to keep your changes in the editor or " + - "discard your changes?", + Colors.ERROR.toHexString() + "\">" + "discard
              your changes?", KEEP_CHANGES_TEXT, DISCARD_CHANGES_TEXT, OptionDialog.QUESTION_MESSAGE); if (choice == OptionDialog.CANCEL_OPTION) { @@ -455,8 +450,7 @@ public class GhidraScriptEditorComponentProvider extends ComponentProvider { // choice = OptionDialog.showOptionDialog(scrollPane, CHANGE_DESTINATION_TITLE, "You can save your current changes to another file or " + - "overwrite the contents of the file on disk.", SAVE_CHANGES_AS_TEXT, OVERWRITE_CHANGES_TEXT, OptionDialog.QUESTION_MESSAGE); @@ -475,7 +469,7 @@ public class GhidraScriptEditorComponentProvider extends ComponentProvider { if (choice == OptionDialog.OPTION_ONE) { // Save As... if (saveAs()) { - // Save As completed successfully; open a new editor + // Save As completed successfully; open a new editor // with the original file provider.editScriptInGhidra(previousFile); } diff --git a/Ghidra/Features/Base/src/main/java/ghidra/framework/main/InfoPanel.java b/Ghidra/Features/Base/src/main/java/ghidra/framework/main/InfoPanel.java index d88f0b2c28..df4f75472a 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/framework/main/InfoPanel.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/framework/main/InfoPanel.java @@ -104,7 +104,7 @@ class InfoPanel extends JPanel { // If the splash.txt file contains non-HTML text, view is null View view = (View) resizer.getClientProperty(javax.swing.plaf.basic.BasicHTML.propertyKey); if (view == null) { - // must not be HTML content in the splash screen text (this shouldn't + // must not be HTML content in the splash screen text (this shouldn't // happen, but let's just protect against this anyway). JLabel label = new GDLabel(content) { @Override @@ -121,9 +121,9 @@ class InfoPanel extends JPanel { float w = view.getPreferredSpan(View.X_AXIS); float h = view.getPreferredSpan(View.Y_AXIS); - JLabel distribLabel = new GHtmlLabel(content); - distribLabel.setPreferredSize(new Dimension((int) Math.ceil(w), (int) Math.ceil(h + 10))); - return distribLabel; + JLabel distLabel = new GHtmlLabel(content); + distLabel.setPreferredSize(new Dimension((int) Math.ceil(w), (int) Math.ceil(h + 10))); + return distLabel; } private Component buildMarkingLabel() { @@ -271,17 +271,4 @@ class InfoPanel extends JPanel { return SPLASH_FILENAME + " file is unreadable!"; } } - - public static void main(String[] args) { - JFrame f = new JFrame("Ghidra"); - InfoPanel p = new InfoPanel(); - f.getContentPane().add(p); - f.pack(); - f.setVisible(true); - - JDialog d = new JDialog(f, "About Ghidra", true); - d.getContentPane().add(new InfoPanel()); - d.pack(); - d.setVisible(true); - } } diff --git a/Ghidra/Features/ByteViewer/src/main/help/help/topics/ByteViewerPlugin/The_Byte_Viewer.htm b/Ghidra/Features/ByteViewer/src/main/help/help/topics/ByteViewerPlugin/The_Byte_Viewer.htm index 84a7a19bbf..5810dc25d8 100644 --- a/Ghidra/Features/ByteViewer/src/main/help/help/topics/ByteViewerPlugin/The_Byte_Viewer.htm +++ b/Ghidra/Features/ByteViewer/src/main/help/help/topics/ByteViewerPlugin/The_Byte_Viewer.htm @@ -4,7 +4,6 @@ The Byte Viewer - @@ -34,7 +33,7 @@ may be added to your view. To add or remove a data format view from the tool, press the  icon to bring up the  Byte Vieweer Options dialog.  + style="font-style: italic;">Byte Viewer Options dialog.  Select the formats that you want and press the OK button.

              @@ -65,15 +64,14 @@ program. For those addresses that can be formed and are in memory, the view shows the symbol,   So if you go to that address in the Code Browser, and make a - Pointer data type, the address pointed to is in memory. Conversely, if + href="help/topics/CodeBrowserPlugin/CodeBrowser.htm"> Code Browser, and + make a + Pointer data type, the address pointed to is in memory. Conversely, if you go to a "tic" address in the Code Browser and make a pointer, the address pointed to is not in memory (the operand is rendered in red).

              -

              This view does not support editing.

              +

              This view does not support editing.

              Disassembled

              @@ -225,7 +223,7 @@

              The alignment address specifies what address should appear in column 0.  Any address can be specified, but the address will be - normalized to be near the program's miminum address. This enables you to + normalized to be near the program's minimum address. This enables you to view bytes in an offcut manner and to identify patterns in the bytes. Changing the alignment address affects the offset, which is the column that would display the bytes for address 0 if it diff --git a/Ghidra/Features/FunctionGraph/src/main/help/help/topics/FunctionGraphPlugin/Function_Graph.html b/Ghidra/Features/FunctionGraph/src/main/help/help/topics/FunctionGraphPlugin/Function_Graph.html index ce4dc14231..34c2de01c7 100644 --- a/Ghidra/Features/FunctionGraph/src/main/help/help/topics/FunctionGraphPlugin/Function_Graph.html +++ b/Ghidra/Features/FunctionGraph/src/main/help/help/topics/FunctionGraphPlugin/Function_Graph.html @@ -802,7 +802,7 @@

            • Start Fully Zoomed Out - always start fully zoomed out so that the entire graph can be seen.
            • -
            • Start Fully Zoomed In/B> - always start fully zoomed in on the vertex containing +
            • Start Fully Zoomed In - always start fully zoomed in on the vertex containing the current location.
            • Remember User Settings - keep the zoom level where the user previously left diff --git a/Ghidra/Features/PDB/src/main/java/pdb/symbolserver/ui/SymbolFilePanel.java b/Ghidra/Features/PDB/src/main/java/pdb/symbolserver/ui/SymbolFilePanel.java index 559065001e..34a6c01536 100644 --- a/Ghidra/Features/PDB/src/main/java/pdb/symbolserver/ui/SymbolFilePanel.java +++ b/Ghidra/Features/PDB/src/main/java/pdb/symbolserver/ui/SymbolFilePanel.java @@ -27,7 +27,7 @@ import docking.DockingWindowManager; import docking.widgets.checkbox.GCheckBox; import docking.widgets.label.GHtmlLabel; import docking.widgets.label.GLabel; -import generic.theme.GThemeDefaults.Colors; +import generic.theme.GThemeDefaults.Colors.Messages; import ghidra.util.HelpLocation; import ghidra.util.table.GhidraTable; import pdb.PdbPlugin; @@ -100,8 +100,7 @@ class SymbolFilePanel extends JPanel { } SymbolFileRow getSelectedRow() { - return table.getSelectedRow() != -1 - ? tableModel.getRowObject(table.getSelectedRow()) + return table.getSelectedRow() != -1 ? tableModel.getRowObject(table.getSelectedRow()) : null; } @@ -118,9 +117,8 @@ class SymbolFilePanel extends JPanel { private JPanel buildWelcomePanel() { welcomePanel = new JPanel(); - welcomePanel.add(new GHtmlLabel( - "
              Configuration must be set first!")); + welcomePanel.add(new GHtmlLabel("
              Configuration must be set first!")); welcomePanel.setPreferredSize(tablePanel.getPreferredSize()); return welcomePanel; @@ -138,7 +136,7 @@ class SymbolFilePanel extends JPanel { isMatchColumn.setMaxWidth(32); isMatchColumn.setMinWidth(32); - // a few extra rows than needed since the table component + // a few extra rows than needed since the table component // will be resized according to the number of warning text // lines at the bottom of the dialog table.setVisibleRowCount(8); diff --git a/Ghidra/Features/PDB/src/main/java/pdb/symbolserver/ui/SymbolServerPanel.java b/Ghidra/Features/PDB/src/main/java/pdb/symbolserver/ui/SymbolServerPanel.java index f700469047..adb69f9196 100644 --- a/Ghidra/Features/PDB/src/main/java/pdb/symbolserver/ui/SymbolServerPanel.java +++ b/Ghidra/Features/PDB/src/main/java/pdb/symbolserver/ui/SymbolServerPanel.java @@ -37,7 +37,7 @@ import docking.widgets.label.GHtmlLabel; import docking.widgets.label.GLabel; import docking.widgets.table.GTable; import docking.widgets.textfield.HintTextField; -import generic.theme.GThemeDefaults.Colors; +import generic.theme.GThemeDefaults.Colors.Messages; import ghidra.framework.preferences.Preferences; import ghidra.util.*; import ghidra.util.layout.PairLayout; @@ -112,7 +112,7 @@ class SymbolServerPanel extends JPanel { JScrollPane tableScrollPane = buildTable(); defaultConfigNotice = new JPanel(); GHtmlLabel label = new GHtmlLabel("

              Missing / invalid configuration.

              " + + Messages.ERROR.toHexString() + "\">
              Missing / invalid configuration.

              " + "Using default search location:
              Program's Import Location
              "); label.setHorizontalAlignment(SwingConstants.CENTER); defaultConfigNotice.add(label); diff --git a/Ghidra/Framework/Docking/data/docking.theme.properties b/Ghidra/Framework/Docking/data/docking.theme.properties index 4e60bac34e..aa2b22ce07 100644 --- a/Ghidra/Framework/Docking/data/docking.theme.properties +++ b/Ghidra/Framework/Docking/data/docking.theme.properties @@ -159,14 +159,14 @@ color.fg.dialog.status.error = color.fg.error color.fg.dialog.status.warning = orange color.fg.dialog.status.normal = lightBlue -color.bg.currentline = rgb(40,40,56) // dark bluish gray +color.bg.currentline = #003366 color.bg.textfield.hint.invalid = maroon color.bg.filterfield = color.bg.filtered color.fg.filterfield = darkSlateGray -color.bg.selection = #284028 // greenish +color.bg.selection = #003333 // greenish color.bg.highlight = #404028 // yellowish color.bg.fieldpanel.selection.and.highlight = #344028 // yellow greenish diff --git a/Ghidra/Framework/Docking/src/main/java/docking/ErrLogDialog.java b/Ghidra/Framework/Docking/src/main/java/docking/ErrLogDialog.java index 3309341145..02c8a8ea57 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/ErrLogDialog.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/ErrLogDialog.java @@ -4,9 +4,9 @@ * 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. 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 dd3b48a7d0..8a8293fa39 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/widgets/AbstractGCellRenderer.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/AbstractGCellRenderer.java @@ -268,9 +268,9 @@ public abstract class AbstractGCellRenderer extends GDHtmlLabel { /** * Overrides this method to ensure that the new foreground color is not * a {@link GColorUIResource}. Some Look and Feels will ignore color values that extend - * {@link UIResource}, choosing instead their own custom painting behavior. By not using a + * {@link UIResource}, choosing instead their own custom painting behavior. By not using a * UIResource, we prevent the Look and Feel from overriding this renderer's color value. - * + * * @param fg the new foreground color */ @Override @@ -281,9 +281,9 @@ public abstract class AbstractGCellRenderer extends GDHtmlLabel { /** * Overrides this method to ensure that the new background color is not * a {@link GColorUIResource}. Some Look and Feels will ignore color values that extend - * {@link UIResource}, choosing instead their own custom painting behavior. By not using a + * {@link UIResource}, choosing instead their own custom painting behavior. By not using a * UIResource, we prevent the Look and Feel from overriding this renderer's color value. - * + * * @param bg the new background color */ @Override diff --git a/Ghidra/Framework/Docking/src/main/java/docking/widgets/GComponent.java b/Ghidra/Framework/Docking/src/main/java/docking/widgets/GComponent.java index 538bd01057..0242cdd149 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/widgets/GComponent.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/GComponent.java @@ -39,11 +39,11 @@ public interface GComponent { } /** - * Returns the current HTML rendering 'enable-ment' of this component. - * + * Returns the current HTML rendering enablement of this component. + * * @return boolean, true if HTML rendering is allowed */ - public default boolean getHTMLRenderingEnabled() { + public default boolean isHTMLRenderingEnabled() { Object prop = ((JComponent) this).getClientProperty(HTML_DISABLE_STRING); return prop == null || prop != Boolean.TRUE; } @@ -66,7 +66,7 @@ public interface GComponent { /** * Sets the HTML rendering flag for the specified component. - * + * * @param comp the thing * @param enabled boolean, if true html rendering will be allowed */ diff --git a/Ghidra/Framework/Docking/src/main/java/docking/widgets/label/AbstractHtmlLabel.java b/Ghidra/Framework/Docking/src/main/java/docking/widgets/label/AbstractHtmlLabel.java index dc69877504..d7e280092e 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/widgets/label/AbstractHtmlLabel.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/label/AbstractHtmlLabel.java @@ -51,13 +51,11 @@ public abstract class AbstractHtmlLabel extends JLabel protected AbstractHtmlLabel() { addPropertyChangeListener(this); - setHTMLRenderingEnabled(false); // disable parent html rendering so we can do our own } protected AbstractHtmlLabel(String text) { super(text); addPropertyChangeListener(this); - setHTMLRenderingEnabled(false); // disable parent html rendering so we can do our own } @Override @@ -82,7 +80,7 @@ public abstract class AbstractHtmlLabel extends JLabel private void updateHtmlView() { String text = getText(); - if (text == null) { + if (text == null || !isHTMLRenderingEnabled()) { putClientProperty(BasicHTML.propertyKey, null); return; } diff --git a/Ghidra/Framework/Docking/src/main/java/docking/widgets/table/constrainteditor/AbstractColumnConstraintEditor.java b/Ghidra/Framework/Docking/src/main/java/docking/widgets/table/constrainteditor/AbstractColumnConstraintEditor.java index ab7150be5a..065e706887 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/widgets/table/constrainteditor/AbstractColumnConstraintEditor.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/table/constrainteditor/AbstractColumnConstraintEditor.java @@ -207,7 +207,7 @@ public abstract class AbstractColumnConstraintEditor implements ColumnConstra * @return an HTML string suitable for a JLabel. */ protected final static String formatStatus(String message, boolean error) { - Color color = error ? Colors.ERROR : Colors.FOREGROUND; + Color color = error ? Colors.Messages.ERROR : Colors.FOREGROUND; String messageWithFont = HTMLUtilities.setFont(message, color, 12); String html = HTMLUtilities.wrapAsHTML(messageWithFont); return html; diff --git a/Ghidra/Framework/Docking/src/main/java/docking/widgets/tree/GTree.java b/Ghidra/Framework/Docking/src/main/java/docking/widgets/tree/GTree.java index 20829a5d12..82d129954b 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/widgets/tree/GTree.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/tree/GTree.java @@ -56,7 +56,7 @@ import ghidra.util.worker.PriorityWorker; * Class for creating a JTree that supports filtering, threading, and a progress bar. */ -public class GTree extends JPanel implements BusyListener, ThemeListener { +public class GTree extends JPanel implements BusyListener { private static final Color BACKGROUND = new GColor("color.bg.tree"); private AutoScrollTree tree; private GTreeModel model; @@ -93,6 +93,11 @@ public class GTree extends JPanel implements BusyListener, ThemeListener { private JTreeMouseListenerDelegate mouseListenerDelegate; private GTreeDragNDropHandler dragNDropHandler; private boolean isFilteringEnabled = true; + private ThemeListener themeListener = e -> { + if (e.isLookAndFeelChanged()) { + model.fireNodeStructureChanged(getModelRoot()); + } + }; private ThreadLocal threadLocalMonitor = new ThreadLocal<>(); private PriorityWorker worker; @@ -135,7 +140,7 @@ public class GTree extends JPanel implements BusyListener, ThemeListener { uniquePreferenceKey)); filterUpdateManager = new SwingUpdateManager(1000, 30000, () -> updateModelFilter()); - Gui.addThemeListener(this); + Gui.addThemeListener(themeListener); } /** @@ -148,13 +153,6 @@ public class GTree extends JPanel implements BusyListener, ThemeListener { threadLocalMonitor.set(monitor); } - @Override - public void themeChanged(ThemeEvent event) { - if (event.isLookAndFeelChanged()) { - model.fireNodeStructureChanged(getModelRoot()); - } - } - /** * Returns the monitor in associated with the GTree for the calling thread. This method is * designed to be used by slow loading nodes that are loading off the Swing thread. Some @@ -272,6 +270,8 @@ public class GTree extends JPanel implements BusyListener, ThemeListener { realViewRootNode.disposeClones(); } model.dispose(); + + Gui.removeThemeListener(themeListener); } public boolean isDisposed() { @@ -1091,17 +1091,17 @@ public class GTree extends JPanel implements BusyListener, ThemeListener { Consumer consumer) { /* - + If the GTree were to use Java's CompletableStage API, then the code below could be written thusly: - + tree.getNewNode(modelParent, newName) .thenCompose(newModelChild -> { tree.ignoreFilter(newModelChild); return tree.getNewNode(viewParent, newName); )) .thenAccept(consumer); - + */ // ensure we operate on the model node which will always have the given child not the view diff --git a/Ghidra/Framework/Gui/src/main/java/generic/theme/GThemeDefaults.java b/Ghidra/Framework/Gui/src/main/java/generic/theme/GThemeDefaults.java index a3ea36ecae..1da18bd934 100644 --- a/Ghidra/Framework/Gui/src/main/java/generic/theme/GThemeDefaults.java +++ b/Ghidra/Framework/Gui/src/main/java/generic/theme/GThemeDefaults.java @@ -20,8 +20,8 @@ import static generic.theme.SystemThemeIds.*; import java.awt.Color; /** TODO doc how clients should use this in their code, with - * - * + * + * * Colors.BACKGROUND * Colors.Java.BORDER */ @@ -56,7 +56,7 @@ public class GThemeDefaults { public static final GColor BACKGROUND = new GColor("color.bg"); public static final GColor CURSOR = new GColor("color.cursor.focused"); public static final GColor DISABLED = new GColor("color.palette.disabled"); - public static final GColor ERROR = new GColor("color.fg.error"); // TODO replace most uses of this with Messages.ERROR + public static final GColor ERROR = new GColor("color.fg.error"); public static final GColor FOREGROUND = new GColor("color.fg"); public static final GColor FOREGROUND_DISABLED = new GColor("color.fg.disabled"); //@formatter:on @@ -83,9 +83,10 @@ public class GThemeDefaults { public static class Messages { //@formatter:off public static final GColor NORMAL = new GColor("color.fg.messages.normal"); + @SuppressWarnings("hiding") // we know there is another 'ERROR' field in this file public static final GColor ERROR = new GColor("color.fg.messages.error"); public static final GColor HINT = new GColor("color.fg.messages.hint"); - public static final GColor WARNING = new GColor("color.fg.messages.warning"); + public static final GColor WARNING = new GColor("color.fg.messages.warning"); //@formatter:on } @@ -127,7 +128,7 @@ public class GThemeDefaults { * it prevents excess object creation. This method should be used when the desired * palette color is not in that list. Further, this method should only be called once * per use, such as when initializing a constant value. - * + * * @param name the palette entry name * @return the GColor */ diff --git a/Ghidra/Framework/Help/src/main/java/help/GHelpHTMLEditorKit.java b/Ghidra/Framework/Help/src/main/java/help/GHelpHTMLEditorKit.java index dba8dcf869..405476b8f0 100644 --- a/Ghidra/Framework/Help/src/main/java/help/GHelpHTMLEditorKit.java +++ b/Ghidra/Framework/Help/src/main/java/help/GHelpHTMLEditorKit.java @@ -26,6 +26,7 @@ import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; +import javax.swing.Icon; import javax.swing.JEditorPane; import javax.swing.event.HyperlinkEvent; import javax.swing.event.HyperlinkListener; @@ -35,6 +36,7 @@ import javax.swing.text.html.HTML.Tag; import generic.jar.ResourceFile; import generic.theme.*; +import generic.theme.GThemeDefaults.Colors; import ghidra.framework.Application; import ghidra.framework.preferences.Preferences; import ghidra.util.Msg; @@ -43,11 +45,11 @@ import utilities.util.FileUtilities; /** * A class that allows Ghidra to intercept JavaHelp navigation events in order to resolve them - * to Ghidra's help system. Without this class, contribution plugins have no way of + * to Ghidra's help system. Without this class, contribution plugins have no way of * referencing help documents within Ghidra's default help location. *

              * This class is currently installed by the {@link GHelpSet}. - * + * * @see GHelpSet */ public class GHelpHTMLEditorKit extends HTMLEditorKit { @@ -73,8 +75,7 @@ public class GHelpHTMLEditorKit extends HTMLEditorKit { colorsById.put("h3", new GColor("color.fg.help.selector.h3")); colorsById.put("p.providedbyplugin", new GColor("color.fg.help.selector.p.provided.by.plugin")); - colorsById.put("p.relatedtopic", - new GColor("color.fg.help.selector.p.related.topic")); + colorsById.put("p.relatedtopic", new GColor("color.fg.help.selector.p.related.topic")); colorsById.put("th", new GColor("color.fg.help.selector.th")); colorsById.put("code", new GColor("color.fg.help.selector.code")); colorsById.put("code.path", new GColor("color.fg.help.selector.code.path")); @@ -176,9 +177,9 @@ public class GHelpHTMLEditorKit extends HTMLEditorKit { } } - /** + /** * Tests the URL of the given event. If the URL is invalid, a new event may be created if - * a new, valid URL can be created. Creates a new event with a patched URL if + * a new, valid URL can be created. Creates a new event with a patched URL if * the given event's URL is invalid. */ private HyperlinkEvent validateURL(HyperlinkEvent event) { @@ -235,10 +236,10 @@ public class GHelpHTMLEditorKit extends HTMLEditorKit { } // - // The item was not found by the ResourceManager (i.e., it is not in a 'resources' + // The item was not found by the ResourceManager (i.e., it is not in a 'resources' // directory). See if it may be a relative link to a build's installation root (like // a file in /docs). - // + // newUrl = findApplicationfile(HREF); return newUrl; } @@ -254,7 +255,7 @@ public class GHelpHTMLEditorKit extends HTMLEditorKit { } try { - // put the anchor back into the URL + // put the anchor back into the URL return new URL(anchorlessURL, anchor); } catch (MalformedURLException e) { @@ -438,7 +439,7 @@ public class GHelpHTMLEditorKit extends HTMLEditorKit { //================================================================================================== // Inner Classes -//================================================================================================== +//================================================================================================== private class GHelpHTMLFactory extends HTMLFactory { @Override @@ -465,31 +466,36 @@ public class GHelpHTMLEditorKit extends HTMLEditorKit { } /** - * Overridden to allow us to find images that are defined as constants in places like + * Overridden to allow us to find images that are defined as constants in places like * {@link Icons} */ private class GHelpImageView extends ImageView { + private static final String HELP_SHARED_ARROW = "help/shared/arrow.gif"; + private static final Icon SHARED_ARROW_ICON = new HelpRightArrowIcon(Colors.FOREGROUND); + private static final IconProvider SHARED_ARROW_ICON_PROVIDER = + new IconProvider(SHARED_ARROW_ICON, null); + /* * Unusual Code Alert! * This class exists to enable our help system to find custom icons defined in source * code. The default behavior herein is to supply a URL to the base class to load. This - * works fine. - * + * works fine. + * * There is another use case where we wish to have the base class load an image of our * choosing. Why? Well, we modify, in memory, some icons we use. We do this for things * like overlays and rotations. - * + * * In order to have our base class use the image that we want (and not the one * it loads via a URL), we have to play a small game. We have to allow the base class * to load the image it wants, which is done asynchronously. If we install our custom * image during that process, the loading will throw away the image and not render - * anything. - * - * To get the base class to use our image, we override getImage(). However, we should + * anything. + * + * To get the base class to use our image, we override getImage(). However, we should * only return our image when the base class is finished loading. (See the base class' * paint() method for why we need to do this.) - * + * * Note: if we start seeing unusual behavior, like images not rendering, or any size * issues, then we can revert this code. */ @@ -541,12 +547,22 @@ public class GHelpHTMLEditorKit extends HTMLEditorKit { return null; } - String srcString = src.toString(); + // + // This code is looking for the specific referenced image file and then replacing that + // image file with something that can update its content at runtime, based on theme. + // Alternatively, we could have updated all help files to point to a GIcon, which + // handles updating itself when the theme changes. We chose to replace the icon here + // instead of in the source code to prevent changing many files. + // + String srcString = src.toString().trim(); + if (srcString.equals(HELP_SHARED_ARROW)) { + return installImageFromCustomIcon(SHARED_ARROW_ICON_PROVIDER); + } // check if the srcString is a defined theme icon id if (Gui.hasIcon(srcString)) { - // - // Wrap the GIcon inside of an IconProvider, as that class can handle a null URL + // + // Wrap the GIcon inside of an IconProvider, as that class can handle a null URL // returned from GIcon. (This can happen if the GIcon is based on a modified icon.) // GIcon gIcon = new GIcon(srcString); @@ -562,6 +578,19 @@ public class GHelpHTMLEditorKit extends HTMLEditorKit { return url; } + private URL installImageFromCustomIcon(IconProvider iconProvider) { + + if (iconProvider == null || iconProvider.isInvalid()) { + return null; + } + + this.image = iconProvider.getImage(); + + // note: this icon is not used to load the image; the 'image' we set is used instead + URL url = iconProvider.getOrCreateUrl(); + return url; + } + private URL installImageFromJavaCode(String srcString) { IconProvider iconProvider = getIconFromJavaCode(srcString); @@ -590,7 +619,7 @@ public class GHelpHTMLEditorKit extends HTMLEditorKit { // check below } - // Try the ResourceManager. This will work for images that start with GHelp + // Try the ResourceManager. This will work for images that start with GHelp // relative link syntax such as 'help/', 'help/topics/' and 'images/' URL resource = ResourceManager.getResource(srcString); return resource; diff --git a/Ghidra/Framework/Help/src/main/java/help/HelpRightArrowIcon.java b/Ghidra/Framework/Help/src/main/java/help/HelpRightArrowIcon.java new file mode 100644 index 0000000000..516190a6b1 --- /dev/null +++ b/Ghidra/Framework/Help/src/main/java/help/HelpRightArrowIcon.java @@ -0,0 +1,154 @@ +/* ### + * 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 help; + +import java.awt.*; +import java.awt.geom.*; + +import javax.swing.Icon; + +/** + * A basic arrow that points to the right, with padding on the sides and above. + */ +public class HelpRightArrowIcon implements Icon { + + private static final int ICON_SIZE = 20; + + private Color color; + private Shape shape; + + public HelpRightArrowIcon(Color color) { + this.color = color; + this.shape = buildShape(); + } + + private Shape buildShape() { + + GeneralPath barPath = new GeneralPath(); + + // + // Construct the arrow in 2 parts: the line and the angle bracket. The arrow will not fill + // the full area. This allows space before and after the arrow. This space serves as + // padding between text inside of html content. The arrow is also closer to the bottom, + // to aligned vertically with text. + // + double height = 10; + double width = 12; + double thickness = 2; + double arrowthickness = 3; + + double top = ICON_SIZE - height; + double cy = top + (height / 2); + double p1x = (ICON_SIZE - width) / 2; + double p1y = cy - (thickness / 2); + barPath.moveTo(p1x, p1y); + + double barlength = width - 2; + double p2x = p1x + barlength; + double p2y = p1y; + barPath.lineTo(p2x, p2y); + + double p3x = p2x; + double p3y = p2y + thickness; + barPath.lineTo(p3x, p3y); + + double p4x = p1x; + double p4y = p3y; + barPath.lineTo(p4x, p4y); + + // back to start of arrow line + barPath.lineTo(p1x, p1y); + barPath.closePath(); + + GeneralPath arrowPath = new GeneralPath(); + + // trailing arrow bar center + p1x = p1x + barlength + arrowthickness; + p1y = cy; + arrowPath.moveTo(p1x, p1y); + + // trailing upper arrow bar point + double trianglewidth = 5; + p2x = p1x - trianglewidth; + p2y = top + 1; + arrowPath.lineTo(p2x, p2y); + + // leading upper arrow bar point + p3x = p2x - arrowthickness; + p3y = p2y; + arrowPath.lineTo(p3x, p3y); + + // leading arrow bar center + p4x = p1x - arrowthickness; + p4y = cy; + arrowPath.lineTo(p4x, p4y); + + // leading lower arrow bar point + double p5x = p3x; + double p5y = ICON_SIZE - 1; + arrowPath.lineTo(p5x, p5y); + + // trailing lower arrow bar point + double p6x = p2x; + double p6y = p5y; + arrowPath.lineTo(p6x, p6y); + + // back to start + double p7x = p1x; + double p7y = p1y; + arrowPath.lineTo(p7x, p7y); + arrowPath.closePath(); + + AffineTransform identity = new AffineTransform(); + Shape barShape = barPath.createTransformedShape(identity); + Area barArea = new Area(barShape); + + Shape arrowShape = arrowPath.createTransformedShape(identity); + Area arrowArea = new Area(arrowShape); + + Area fullArea = new Area(); + fullArea.add(barArea); + fullArea.add(arrowArea); + + return fullArea; + } + + @Override + public void paintIcon(Component c, Graphics g, int x, int y) { + + Graphics2D g2d = (Graphics2D) g; + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + + try { + g2d.translate(x, y); + g2d.setColor(color); + g2d.fill(shape); + } + finally { + g2d.translate(-x, -y); + } + } + + @Override + public int getIconWidth() { + return ICON_SIZE; + } + + @Override + public int getIconHeight() { + return ICON_SIZE; + } +} diff --git a/Ghidra/Framework/Help/src/main/resources/help/shared/arrow.gif b/Ghidra/Framework/Help/src/main/resources/help/shared/arrow.gif deleted file mode 100644 index bcb3db7057..0000000000 Binary files a/Ghidra/Framework/Help/src/main/resources/help/shared/arrow.gif and /dev/null differ diff --git a/Ghidra/Framework/Project/src/main/java/ghidra/app/plugin/gui/ThemeManagerPlugin.java b/Ghidra/Framework/Project/src/main/java/ghidra/app/plugin/gui/ThemeManagerPlugin.java index 0e9da322fc..345c82364c 100644 --- a/Ghidra/Framework/Project/src/main/java/ghidra/app/plugin/gui/ThemeManagerPlugin.java +++ b/Ghidra/Framework/Project/src/main/java/ghidra/app/plugin/gui/ThemeManagerPlugin.java @@ -57,7 +57,7 @@ public class ThemeManagerPlugin extends Plugin implements ApplicationLevelOnlyPl .onAction(e -> switchTheme()) .buildAndInstall(tool); - new ActionBuilder("Configure", owner).menuPath("Edit", "Theme", "Configure...") + new ActionBuilder("Configure", owner).menuPath("Edit", "Theme", "Configure") .menuGroup(group, "2") .helpLocation(new HelpLocation("Theming", "Edit_Theme")) .onAction(e -> configure()) diff --git a/Ghidra/Framework/Project/src/main/java/ghidra/framework/plugintool/PluginTool.java b/Ghidra/Framework/Project/src/main/java/ghidra/framework/plugintool/PluginTool.java index e77753c89d..b12bc2c5ba 100644 --- a/Ghidra/Framework/Project/src/main/java/ghidra/framework/plugintool/PluginTool.java +++ b/Ghidra/Framework/Project/src/main/java/ghidra/framework/plugintool/PluginTool.java @@ -993,9 +993,8 @@ public abstract class PluginTool extends AbstractDockingTool { optionsAction.setAddToAllWindows(true); optionsAction.setHelpLocation( new HelpLocation(ToolConstants.FRONT_END_HELP_TOPIC, "Tool Options")); - MenuData menuData = - new MenuData(new String[] { ToolConstants.MENU_EDIT, "&Tool Options..." }, null, - ToolConstants.TOOL_OPTIONS_MENU_GROUP); + MenuData menuData = new MenuData(new String[] { ToolConstants.MENU_EDIT, "&Tool Options" }, + null, ToolConstants.TOOL_OPTIONS_MENU_GROUP); menuData.setMenuSubGroup(ToolConstants.TOOL_OPTIONS_MENU_GROUP); optionsAction.setMenuBarData(menuData); diff --git a/Ghidra/Framework/Project/src/main/java/ghidra/framework/project/tool/GhidraTool.java b/Ghidra/Framework/Project/src/main/java/ghidra/framework/project/tool/GhidraTool.java index 42c0f83605..4c289b57a9 100644 --- a/Ghidra/Framework/Project/src/main/java/ghidra/framework/project/tool/GhidraTool.java +++ b/Ghidra/Framework/Project/src/main/java/ghidra/framework/project/tool/GhidraTool.java @@ -101,7 +101,8 @@ public class GhidraTool extends PluginTool { @Override public PluginClassManager getPluginClassManager() { if (pluginClassManager == null) { - pluginClassManager = new PluginClassManager(Plugin.class, ApplicationLevelOnlyPlugin.class); + pluginClassManager = + new PluginClassManager(Plugin.class, ApplicationLevelOnlyPlugin.class); } return pluginClassManager; } @@ -206,7 +207,7 @@ public class GhidraTool extends PluginTool { }; configureToolAction.setMenuBarData(new MenuData( - new String[] { ToolConstants.MENU_FILE, "Configure..." }, null, "PrintPost_PreTool")); + new String[] { ToolConstants.MENU_FILE, "Configure" }, null, "PrintPost_PreTool")); configureToolAction.setEnabled(true); addAction(configureToolAction);