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.htm index 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 @@
-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.
+This key binding action shows a dialog to quickly find and run scripts. + The dialog organizes scripts into two sections:
-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.
++
+ +- + Recent Scripts - 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. +
+- All Scripts - Shows all available scripts in alphabetical order.
+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.
+ +The detail pane on the right displays information about the currently selected script, + including its description, author, category, and assigned keybinding (if any).
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.png index 4526c21624..d87ba1191a 100644 Binary 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 differ diff --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.java index 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 list String scriptName = scriptFile.getName(); - recentScripts.remove(scriptName); // Remove if already exists + recentScripts.remove(scriptName); recentScripts.addFirst(scriptName); // Add to front (most recent) - // Trim to max size while (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.java index 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
![]()
(model, (script, category) -> scriptChosen(script)) { + @Override + protected BiPredicate 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 pane JComponent 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 exists ScriptsModel 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 text StringBuilder html = new StringBuilder(""); - - // Script name html.append("").append(HTMLUtilities.escapeHTML(script.getName())).append(""); - // Keybinding if available KeyStroke keyBinding = script.getKeyBinding(); if (keyBinding != null) { html.append(" "); } - // Description on next line String description = script.getDescription(); if (description != null && !description.isEmpty()) { html.append("