docs, restore glob searching

This commit is contained in:
Lee Chagolla-Christensen
2025-12-10 23:16:04 -08:00
committed by dragonmacher
parent 8e23214979
commit 383d6f4546
4 changed files with 28 additions and 15 deletions
@@ -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 align="left">This key binding action shows a dialog to quickly find and run scripts.
The dialog organizes scripts into two sections:</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>
<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>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 217 KiB

@@ -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();
}
@@ -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 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("<html>");
// Script name
html.append("<b>").append(HTMLUtilities.escapeHTML(script.getName())).append("</b>");
// Keybinding if available
KeyStroke 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 line
String description = script.getDescription();
if (description != null && !description.isEmpty()) {
html.append("<br><font color=\"")