mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-22 06:22:17 +08:00
Merge remote-tracking branch
'origin/GP-1-dragonmacher-escape-selection-fix' (#7241)
This commit is contained in:
+12
-1
@@ -17,6 +17,8 @@ package ghidra.app.plugin.core.codebrowser;
|
||||
|
||||
import javax.swing.Icon;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import docking.action.builder.ActionBuilder;
|
||||
import docking.tool.ToolConstants;
|
||||
import generic.theme.GIcon;
|
||||
@@ -93,7 +95,7 @@ public class CodeBrowserSelectionPlugin extends Plugin {
|
||||
.helpLocation(new HelpLocation(HelpTopics.SELECTION, "Clear Selection"))
|
||||
.withContext(ListingActionContext.class, true)
|
||||
.inWindow(ActionBuilder.When.CONTEXT_MATCHES)
|
||||
.enabledWhen(c -> c.hasSelection())
|
||||
.enabledWhen(c -> hasSelection(c))
|
||||
.onAction(c -> ((CodeViewerProvider) c.getComponentProvider())
|
||||
.setSelection(new ProgramSelection()))
|
||||
.buildAndInstall(tool);
|
||||
@@ -191,6 +193,15 @@ public class CodeBrowserSelectionPlugin extends Plugin {
|
||||
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,
|
||||
CodeUnitIterator iterator, ProgramSelection selection) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user