Ghidra is a software reverse engineering (SRE) framework
docs, restore glob searching
Lee Chagolla-Christensen383d6f45469c
diff --git a/Ghidra/Features/Base/src/main/help/help/topics/GhidraScriptMgrPlugin/GhidraScriptMgrPlugin.htm b/Ghidra/Features/Base/src/main/help/help/topics/GhidraScriptMgrPlugin/GhidraScriptMgrPlugin.htmindex e6a80722e5..2e6e0f3194 100644--- a/Ghidra/Features/Base/src/main/help/help/topics/GhidraScriptMgrPlugin/GhidraScriptMgrPlugin.htm+++ b/Ghidra/Features/Base/src/main/help/help/topics/GhidraScriptMgrPlugin/GhidraScriptMgrPlugin.htm@@ -135,12 +135,24 @@<H3><A name="Script_Quick_Launch"></A>Script Quick Launch</H3><BLOCKQUOTE>- <P align="left">This key binding action will show a dialog to allow you to quickly select a- script to be run. You may type any part of the name of the desired script in the dialog's- text field. An asterisc may be used as a globbing character.</P>-- <P>You may either use the mouse to choose the desired script from the popup list or press- the Enter key to selected the highlighted list element.</P>+ <P align="left">This key binding action shows a dialog to quickly find and run scripts.+ The dialog organizes scripts into two sections:</P>++ <UL>+ <LI>+ <B>Recent Scripts</B> - Shows up to 10 of the most recently executed scripts in+ most-recently-used (MRU) order. This section only appears if you have run scripts+ before.+ </LI>+ <LI><B>All Scripts</B> - Shows all available scripts in alphabetical order.</LI>+ </UL>++ <P>Type any part of a script name in the filter field to narrow down the list. The filter+ supports wildcard matching using * (any characters) and ? (single character). Use the+ up/down arrow keys or mouse to select a script, then press Enter or click OK to run it.</P>++ <P>The detail pane on the right displays information about the currently selected script,+ including its description, author, category, and assigned keybinding (if any).</P><P align="center"><IMG alt="" src="images/ScriptQuickLaunchDialog.png"></P>diff --git a/Ghidra/Features/Base/src/main/help/help/topics/GhidraScriptMgrPlugin/images/ScriptQuickLaunchDialog.png b/Ghidra/Features/Base/src/main/help/help/topics/GhidraScriptMgrPlugin/images/ScriptQuickLaunchDialog.pngindex 4526c21624..d87ba1191a 100644Binary files a/Ghidra/Features/Base/src/main/help/help/topics/GhidraScriptMgrPlugin/images/ScriptQuickLaunchDialog.png and b/Ghidra/Features/Base/src/main/help/help/topics/GhidraScriptMgrPlugin/images/ScriptQuickLaunchDialog.png differdiff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/script/GhidraScriptComponentProvider.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/script/GhidraScriptComponentProvider.javaindex cfe7703272..97af8176e8 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/script/GhidraScriptComponentProvider.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/script/GhidraScriptComponentProvider.java@@ -683,10 +683,9 @@ public class GhidraScriptComponentProvider extends ComponentProviderAdapter {// Update recent scripts listString scriptName = scriptFile.getName();- recentScripts.remove(scriptName); // Remove if already exists+ recentScripts.remove(scriptName);recentScripts.addFirst(scriptName); // Add to front (most recent)- // Trim to max sizewhile (recentScripts.size() > MAX_RECENT_SCRIPTS) {recentScripts.removeLast();}diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/script/ScriptSelectionDialog.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/script/ScriptSelectionDialog.javaindex 8fdd81b4c1..5947f509fc 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/script/ScriptSelectionDialog.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/script/ScriptSelectionDialog.java@@ -18,6 +18,8 @@ package ghidra.app.plugin.core.script;import java.awt.*;import java.util.LinkedList;import java.util.List;+import java.util.function.BiPredicate;+import java.util.regex.Pattern;import javax.swing.*;import javax.swing.event.ListDataEvent;@@ -34,6 +36,7 @@ import ghidra.framework.plugintool.PluginTool;import ghidra.util.HelpLocation;import ghidra.util.HTMLUtilities;import ghidra.util.Swing;+import ghidra.util.UserSearchUtils;/*** A dialog that prompts the user to select a script from a searchable list@@ -66,7 +69,13 @@ public class ScriptSelectionDialog extends DialogComponentProvider {private JComponent buildMainPanel() {ScriptsModel model = new ScriptsModel(scriptInfos, recentScripts);- searchList = new SearchList<>(model, (script, category) -> scriptChosen(script));+ searchList = new SearchList<ScriptInfo>(model, (script, category) -> scriptChosen(script)) {+ @Override+ protected BiPredicate<ScriptInfo, String> createFilter(String text) {+ Pattern pattern = UserSearchUtils.createContainsPattern(text, true, Pattern.CASE_INSENSITIVE);+ return (script, category) -> pattern.matcher(script.getName()).matches();+ }+ };searchList.setItemRenderer(new ScriptRenderer());searchList.setDisplayNameFunction((script, category) -> script.getName());@@ -103,7 +112,6 @@ public class ScriptSelectionDialog extends DialogComponentProvider {});}- // Create detail paneJComponent detailPaneComponent = buildDetailPane();// Create split pane with list on left, detail on right@@ -144,7 +152,6 @@ public class ScriptSelectionDialog extends DialogComponentProvider {private void resetSelectionToFirst() {SwingUtilities.invokeLater(() -> {- // Get the first item from the model if it existsScriptsModel model = (ScriptsModel) searchList.getModel();if (model.getSize() > 0) {ScriptInfo firstScript = model.getElementAt(0).value();@@ -217,13 +224,9 @@ public class ScriptSelectionDialog extends DialogComponentProvider {ScriptInfo script = entry.value();- // Build display textStringBuilder html = new StringBuilder("<html>");-- // Script namehtml.append("<b>").append(HTMLUtilities.escapeHTML(script.getName())).append("</b>");- // Keybinding if availableKeyStroke keyBinding = script.getKeyBinding();if (keyBinding != null) {html.append(" <font color=\"")@@ -233,7 +236,6 @@ public class ScriptSelectionDialog extends DialogComponentProvider {.append(")</i></font>");}- // Description on next lineString description = script.getDescription();if (description != null && !description.isEmpty()) {html.append("<br><font color=\"")