mirror of
https://github.com/NationalSecurityAgency/ghidra
synced 2024-08-27 21:10:26 +00:00
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.
This commit is contained in:
parent
1fa2bd7979
commit
dbbc2d91e5
|
@ -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|
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -802,7 +802,7 @@ public class EquatePlugin extends Plugin {
|
|||
|
||||
@Override
|
||||
protected boolean isEnabledForContext(ListingActionContext context) {
|
||||
return context.hasSelection() || isEquatePermitted(context);
|
||||
return context.hasSelection();
|
||||
}
|
||||
};
|
||||
applyEnumAction.setHelpLocation(new HelpLocation("EquatePlugin", "Apply_Enum"));
|
||||
|
|
|
@ -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()));
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue