Package com.goatshriek.rubydragon
Class DragonPlugin
java.lang.Object
ghidra.framework.plugintool.Plugin
ghidra.app.plugin.ProgramPlugin
com.goatshriek.rubydragon.DragonPlugin
- All Implemented Interfaces:
ghidra.app.plugin.core.interpreter.InterpreterConnection,ghidra.framework.plugintool.util.PluginEventListener,ghidra.framework.plugintool.util.ServiceListener,ghidra.util.classfinder.ExtensionPoint
- Direct Known Subclasses:
ClojureDragonPlugin,GroovyDragonPlugin,JShellDragonPlugin,KotlinDragonPlugin,RubyDragonPlugin
public abstract class DragonPlugin
extends ghidra.app.plugin.ProgramPlugin
implements ghidra.app.plugin.core.interpreter.InterpreterConnection
A plugin for RubyDragon that provides an interactive interpreter for a chosen
language.
This abstract class takes care of a number of boilerplate tasks that should
be common across all plugins.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDragonPlugin(ghidra.framework.plugintool.PluginTool tool, String name) Creates a new DragonPlugin. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidforEachAutoImport(BiConsumer<String, String> action) Runs the provided action for each import in the preload manifest.static voidforEachAutoImport(Consumer<String> action) Runs the provided action for each import in the preload manifest.Gets the description of the automatic import option, customized with this instance's name.ghidra.util.HelpLocationGets the help location of the automatic import option for this instance.Gets the name of the automatic import option, customized with this instance's name.List<ghidra.app.plugin.core.console.CodeCompletion> getCompletions(String cmd) Deprecated.List<ghidra.app.plugin.core.console.CodeCompletion> getCompletions(String cmd, int caretPos) Gets aListofcode completionsfor the given command relative to the given caret position.getIcon()The icon for this plugin.abstract GhidraInterpreterGives the interpreter currently in use by the plugin.getTitle()The title of the plugin.voidhighlightChanged(ghidra.program.util.ProgramSelection sel) Called whenever the highlight is changed within the CodeBrowser tool.booleanWhether or not automatic imports are currently enabled in this plugin.voidlocationChanged(ghidra.program.util.ProgramLocation loc) Called whenever the location is changed within the CodeBrowser tool.voidprogramActivated(ghidra.program.model.listing.Program program) Called whenever a program is activate within the CodeBrowser tool.voidselectionChanged(ghidra.program.util.ProgramSelection sel) Called whenever the selection is changed within the CodeBrowser tool.abstract voidShows the interpreter console.Methods inherited from class ghidra.app.plugin.ProgramPlugin
getCurrentProgram, getProgramHighlight, getProgramLocation, getProgramSelection, processEventMethods inherited from class ghidra.framework.plugintool.Plugin
accept, acceptData, dataStateRestoreCompleted, dependsUpon, equals, eventSent, firePluginEvent, getData, getMissingRequiredServices, getName, getPluginDescription, getSupportedDataTypes, getTool, getTransientState, getUndoRedoState, hashCode, hasMissingRequiredService, isDisposed, readConfigState, readDataState, restoreTransientState, restoreUndoRedoState, serviceAdded, serviceRemoved, writeConfigState, writeDataState
-
Field Details
-
AUTO_IMPORT_FILENAME
The name of the auto import manifest data file.- Since:
- 2.2.0
-
OPTION_CATEGORY_NAME
The name of the options category used by DragonPlugins.- Since:
- 2.2.0
- See Also:
-
PLUGIN_CATEGORY_NAME
The name of the plugin category used by DragonPlugins.- Since:
- 4.0.0
- See Also:
-
-
Constructor Details
-
DragonPlugin
Creates a new DragonPlugin.- Parameters:
tool- The plugin tool that this plugin is added to.name- The name of the language provided by the instance.
-
-
Method Details
-
forEachAutoImport
public static void forEachAutoImport(Consumer<String> action) throws org.jdom.JDOMException, IOException Runs the provided action for each import in the preload manifest.- Parameters:
action- The action called for each import listed in the preload manifest, with the argument being the fully qualified class name: the package and class name joined with a '.' character.- Throws:
IOException- if the preload manifest file couldn't be opened.org.jdom.JDOMException- if the preload manifest xml was malformed.- Since:
- 2.2.0
-
forEachAutoImport
public static void forEachAutoImport(BiConsumer<String, String> action) throws org.jdom.JDOMException, IOExceptionRuns the provided action for each import in the preload manifest.- Parameters:
action- The action called for each import listed in the preload manifest, with the arguments being the package name and class name, respectively.- Throws:
IOException- if the preload manifest file couldn't be opened.org.jdom.JDOMException- if the preload manifest xml was malformed.- Since:
- 2.2.0
-
getAutoImportOptionDescription
Gets the description of the automatic import option, customized with this instance's name.- Returns:
- The option description.
- Since:
- 2.2.0
-
getAutoImportOptionHelpLocation
public ghidra.util.HelpLocation getAutoImportOptionHelpLocation()Gets the help location of the automatic import option for this instance.- Returns:
- The option help location.
- Since:
- 2.2.0
-
getAutoImportOptionName
Gets the name of the automatic import option, customized with this instance's name.- Returns:
- The option name.
- Since:
- 2.2.0
-
getCompletions
Deprecated.Move to usinggetCompletions(String, int).Get a list of completions for the given command prefix.- Specified by:
getCompletionsin interfaceghidra.app.plugin.core.interpreter.InterpreterConnection- Parameters:
cmd- The command to try to complete.- Returns:
- A list of possible code completions.
-
getCompletions
Gets aListofcode completionsfor the given command relative to the given caret position.- Specified by:
getCompletionsin interfaceghidra.app.plugin.core.interpreter.InterpreterConnection- Parameters:
cmd- The command to get code completions for.caretPos- The position of the caret in cmd. It must satisfy the constraint0 <= caretPos <= cmd.length().- Returns:
- A
Listof code completions for the given command.
-
getIcon
The icon for this plugin.- Specified by:
getIconin interfaceghidra.app.plugin.core.interpreter.InterpreterConnection
-
getInterpreter
Gives the interpreter currently in use by the plugin.- Returns:
- The interpreter for this plugin.
-
getTitle
The title of the plugin.- Specified by:
getTitlein interfaceghidra.app.plugin.core.interpreter.InterpreterConnection
-
highlightChanged
public void highlightChanged(ghidra.program.util.ProgramSelection sel) Called whenever the highlight is changed within the CodeBrowser tool. -
isAutoImportEnabled
public boolean isAutoImportEnabled()Whether or not automatic imports are currently enabled in this plugin.- Returns:
- Whether or not automatic imports are enabled in this plugin.
- Since:
- 2.2.0
-
locationChanged
public void locationChanged(ghidra.program.util.ProgramLocation loc) Called whenever the location is changed within the CodeBrowser tool. -
programActivated
public void programActivated(ghidra.program.model.listing.Program program) Called whenever a program is activate within the CodeBrowser tool. -
selectionChanged
public void selectionChanged(ghidra.program.util.ProgramSelection sel) Called whenever the selection is changed within the CodeBrowser tool. -
showConsole
public abstract void showConsole()Shows the interpreter console.
-
getCompletions(String, int).