Ghidra is a software reverse engineering (SRE) framework
Updated 'Apply Enum...' action to only work when there is a program selection in order to reduce confusion about the correct context for this action.
dragonmacherdbbc2d91e517
diff --git a/Ghidra/Features/Base/certification.manifest b/Ghidra/Features/Base/certification.manifestindex 8e3b8a2462..c7b52bb143 100644--- a/Ghidra/Features/Base/certification.manifest+++ b/Ghidra/Features/Base/certification.manifest@@ -842,7 +842,6 @@ src/main/java/ghidra/app/cmd/package.html||GHIDRA||reviewed||END|src/main/java/ghidra/app/cmd/refs/package.html||GHIDRA||||END|src/main/java/ghidra/app/cmd/register/package.html||GHIDRA||||END|src/main/java/ghidra/app/events/package.html||GHIDRA||reviewed||END|-src/main/java/ghidra/app/plugin/core/compositeeditor/BITFIELDS_HELP_NOTES.txt||GHIDRA||||END|src/main/java/ghidra/app/plugin/core/disassembler/package.html||GHIDRA||reviewed||END|src/main/java/ghidra/app/services/package.html||GHIDRA||reviewed||END|src/main/java/ghidra/app/util/bin/format/elf/package.html||GHIDRA||||END|diff --git a/Ghidra/Features/Base/src/main/help/help/topics/EquatePlugin/Equates.htm b/Ghidra/Features/Base/src/main/help/help/topics/EquatePlugin/Equates.htmindex 08205a6e5d..a3dbeb780d 100644--- a/Ghidra/Features/Base/src/main/help/help/topics/EquatePlugin/Equates.htm+++ b/Ghidra/Features/Base/src/main/help/help/topics/EquatePlugin/Equates.htm@@ -279,8 +279,9 @@<H2><A name="Apply_Enum"></A> Apply Enum</H2><BLOCKQUOTE>- <P>The <I>Apply Enum</I> action will apply enum member names to scalars in the current- selection if any of the enum values match scalars in the current selection.</P>+ <P>The <I>Apply Enum</I> action (only available when there is a selection), will apply+ enum member names to scalars in the current selection if any of the enum values match+ those scalars.</P><P>To apply an enum to the selection:</P></BLOCKQUOTE>@@ -288,8 +289,6 @@<DIV style="margin-left: 2em" type=""><OL><LI> Make a selection and then Right-mouse-click, then choose <B>Apply Enum</B>.- Note that the <B>Apply Enum</B> action will only appear in the Right-mouse menu- if there is a selection and if there are scalars within the selection.<P align="center"><BR><IMG src="images/BeforeApplyEnum.png" alt="Apply Enum Popup"></P>diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/equate/EquatePlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/equate/EquatePlugin.javaindex d6cecc4b51..2c1e0cf16b 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/equate/EquatePlugin.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/equate/EquatePlugin.java@@ -802,7 +802,7 @@ public class EquatePlugin extends Plugin {@Overrideprotected boolean isEnabledForContext(ListingActionContext context) {- return context.hasSelection() || isEquatePermitted(context);+ return context.hasSelection();}};applyEnumAction.setHelpLocation(new HelpLocation("EquatePlugin", "Apply_Enum"));diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/equate/EquatePlugin2Test.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/equate/EquatePlugin2Test.javadeleted file mode 100644index aab2cc24d9..0000000000--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/equate/EquatePlugin2Test.java+++ /dev/null@@ -1,45 +0,0 @@-/* ###- * 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 ghidra.app.plugin.core.equate;--import static org.junit.Assert.assertFalse;-import static org.junit.Assert.assertTrue;--import org.junit.Test;--/**- * Tests the Equate Plugin functionality.- */-public class EquatePlugin2Test extends AbstractEquatePluginTest {-- @Test- public void testApplyEnumActionEnabled() {-- assertFalse(applyEnumAction.isEnabledForContext(getListingContext()));-- putCursorOnOperand(0x010064c5, 1);- assertFalse(applyEnumAction.isEnabledForContext(getListingContext())); // existing equate exists-- removeAction.actionPerformed(getListingContext()); // remove existing equate- waitForBusyTool(tool);-- assertTrue(applyEnumAction.isEnabledForContext(getListingContext()));-- selectRange(addr(0x0100644c), addr(0x01006458));- assertTrue(applyEnumAction.isEnabledForContext(getListingContext()));- }--}