Package ghidra.app.util.viewer.field
Class SymbolAnnotatedStringHandler
- java.lang.Object
-
- ghidra.app.util.viewer.field.SymbolAnnotatedStringHandler
-
- All Implemented Interfaces:
AnnotatedStringHandler
,ExtensionPoint
public class SymbolAnnotatedStringHandler extends java.lang.Object implements AnnotatedStringHandler
An annotated string handler that handles annotations that begin withSUPPORTED_ANNOTATIONS
. This class expects one string following the annotation text that is the address or a symbol name. The display text will be that of the symbol that is referred to by the address or symbol name.
-
-
Field Summary
-
Fields inherited from interface ghidra.app.util.viewer.field.AnnotatedStringHandler
DUMMY_MOUSE_HANDLER
-
-
Constructor Summary
Constructors Constructor Description SymbolAnnotatedStringHandler()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.String
convertAnnotationSymbolToAddress(java.lang.String[] annotationParts, java.lang.String rawText, Program program)
AttributedString
createAnnotatedString(AttributedString prototypeString, java.lang.String[] text, Program program)
Creates anFieldElement
based upon the give array of Strings.java.lang.String
getDisplayString()
Returns the String that represents the GUI presence of this optionjava.lang.String
getPrototypeString()
Returns an example string of how the annotation is usedjava.lang.String[]
getSupportedAnnotations()
Returns the annotation string names that this AnnotatedStringHandler supports (e.g., "symbol", "address", etc...).boolean
handleMouseClick(java.lang.String[] annotationParts, Navigatable sourceNavigatable, ServiceProvider serviceProvider)
A method that is notified when an annotation is clicked.
-
-
-
Method Detail
-
convertAnnotationSymbolToAddress
public static java.lang.String convertAnnotationSymbolToAddress(java.lang.String[] annotationParts, java.lang.String rawText, Program program)
-
createAnnotatedString
public AttributedString createAnnotatedString(AttributedString prototypeString, java.lang.String[] text, Program program)
Description copied from interface:AnnotatedStringHandler
Creates anFieldElement
based upon the give array of Strings. The first String in the list is expected to be the annotation tag used to create the annotation. At the very least the array is expected to be comprised of two elements, the annotation and some data. Extra data may be provided as needed by implementing classes.- Specified by:
createAnnotatedString
in interfaceAnnotatedStringHandler
- Parameters:
prototypeString
- The prototypeFieldElement
that dictates the attributes for the newly created string. Implementations may change attributes as needed.text
- An array of Strings used to create theFieldElement
being returned.program
- The program with which the returned string is associated.- Returns:
- An
AnnotatedTextFieldElement
that will be used to render the given text.
-
getSupportedAnnotations
public java.lang.String[] getSupportedAnnotations()
Description copied from interface:AnnotatedStringHandler
Returns the annotation string names that this AnnotatedStringHandler supports (e.g., "symbol", "address", etc...).- Specified by:
getSupportedAnnotations
in interfaceAnnotatedStringHandler
- Returns:
- the annotation string names that this AnnotatedStringHandler supports.
-
handleMouseClick
public boolean handleMouseClick(java.lang.String[] annotationParts, Navigatable sourceNavigatable, ServiceProvider serviceProvider)
Description copied from interface:AnnotatedStringHandler
A method that is notified when an annotation is clicked. Returns true if this annotation handles the click; return false if this annotation does not do anything with the click.- Specified by:
handleMouseClick
in interfaceAnnotatedStringHandler
- Parameters:
annotationParts
- The constituent parts of the annotationsourceNavigatable
- The location in the program that was clicked.serviceProvider
- A service provider for needed services.- Returns:
- true if this annotation handles the click; return false if this annotation does not do anything with the click.
-
getDisplayString
public java.lang.String getDisplayString()
Description copied from interface:AnnotatedStringHandler
Returns the String that represents the GUI presence of this option- Specified by:
getDisplayString
in interfaceAnnotatedStringHandler
- Returns:
- the String to display in GUI components.
- See Also:
AnnotatedStringHandler.getDisplayString()
-
getPrototypeString
public java.lang.String getPrototypeString()
Description copied from interface:AnnotatedStringHandler
Returns an example string of how the annotation is used- Specified by:
getPrototypeString
in interfaceAnnotatedStringHandler
- Returns:
- the example of how this is used.
- See Also:
AnnotatedStringHandler.getPrototypeString()
-
-