mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 09:49:23 +02:00
Merge remote-tracking branch
'origin/GP-1-dragonmacher-escape-selection-fix' (#7241)
This commit is contained in:
commit
8d95e97521
1 changed files with 12 additions and 1 deletions
|
@ -17,6 +17,8 @@ package ghidra.app.plugin.core.codebrowser;
|
||||||
|
|
||||||
import javax.swing.Icon;
|
import javax.swing.Icon;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import docking.action.builder.ActionBuilder;
|
import docking.action.builder.ActionBuilder;
|
||||||
import docking.tool.ToolConstants;
|
import docking.tool.ToolConstants;
|
||||||
import generic.theme.GIcon;
|
import generic.theme.GIcon;
|
||||||
|
@ -93,7 +95,7 @@ public class CodeBrowserSelectionPlugin extends Plugin {
|
||||||
.helpLocation(new HelpLocation(HelpTopics.SELECTION, "Clear Selection"))
|
.helpLocation(new HelpLocation(HelpTopics.SELECTION, "Clear Selection"))
|
||||||
.withContext(ListingActionContext.class, true)
|
.withContext(ListingActionContext.class, true)
|
||||||
.inWindow(ActionBuilder.When.CONTEXT_MATCHES)
|
.inWindow(ActionBuilder.When.CONTEXT_MATCHES)
|
||||||
.enabledWhen(c -> c.hasSelection())
|
.enabledWhen(c -> hasSelection(c))
|
||||||
.onAction(c -> ((CodeViewerProvider) c.getComponentProvider())
|
.onAction(c -> ((CodeViewerProvider) c.getComponentProvider())
|
||||||
.setSelection(new ProgramSelection()))
|
.setSelection(new ProgramSelection()))
|
||||||
.buildAndInstall(tool);
|
.buildAndInstall(tool);
|
||||||
|
@ -191,6 +193,15 @@ public class CodeBrowserSelectionPlugin extends Plugin {
|
||||||
tableProvider.installRemoveItemsAction();
|
tableProvider.installRemoveItemsAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean hasSelection(ListingActionContext c) {
|
||||||
|
if (c.hasSelection()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
String textSelection = ((CodeViewerProvider) c.getComponentProvider()).getTextSelection();
|
||||||
|
return !StringUtils.isBlank(textSelection);
|
||||||
|
}
|
||||||
|
|
||||||
private GhidraProgramTableModel<Address> createTableModel(Program program,
|
private GhidraProgramTableModel<Address> createTableModel(Program program,
|
||||||
CodeUnitIterator iterator, ProgramSelection selection) {
|
CodeUnitIterator iterator, ProgramSelection selection) {
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue