Package ghidra.app.util.viewer.field
Class AddressAnnotatedStringHandler
java.lang.Object
ghidra.app.util.viewer.field.AddressAnnotatedStringHandler
- All Implemented Interfaces:
AnnotatedStringHandler
,ExtensionPoint
An annotated string handler that allows handles annotations that begin with
SUPPORTED_ANNOTATIONS
. This class expects one string following the annotation
text that is an address string and will display that string as its display text.-
Field Summary
Fields inherited from interface ghidra.app.util.viewer.field.AnnotatedStringHandler
DUMMY_MOUSE_HANDLER
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
createAddressAnnotationString
(long addressOffset, String displayText) Constructs a well-formed Address Annotation comment string.static String
createAddressAnnotationString
(Address destinationAddress, String displayText) Constructs a well-formed Address Annotation comment string.createAnnotatedString
(AttributedString prototypeString, String[] text, Program program) Creates anFieldElement
based upon the give array of Strings.Returns the String that represents the GUI presence of this optionReturns an example string of how the annotation is usedgetPrototypeString
(String displayText) Returns an example string of how the annotation is usedString[]
Returns the annotation string names that this AnnotatedStringHandler supports (e.g., "symbol", "address", etc...).boolean
handleMouseClick
(String[] annotationParts, Navigatable sourceNavigatable, ServiceProvider serviceProvider) A method that is notified when an annotation is clicked.
-
Constructor Details
-
AddressAnnotatedStringHandler
public AddressAnnotatedStringHandler()
-
-
Method Details
-
createAddressAnnotationString
Constructs a well-formed Address Annotation comment string.- Parameters:
destinationAddress
- destination of the annotationdisplayText
- text that will be used as the body of the annotation. Problematic characters will be escaped- Returns:
- string
-
createAddressAnnotationString
Constructs a well-formed Address Annotation comment string.- Parameters:
addressOffset
- destination of the annotationdisplayText
- text that will be used as the body of the annotation. Problematic characters will be escaped- Returns:
- string
-
createAnnotatedString
public AttributedString createAnnotatedString(AttributedString prototypeString, String[] text, Program program) throws AnnotationException 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. - Throws:
AnnotationException
- if the given text data does not fit the expected format for the given handler implementation.
-
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.
-
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.
-
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.
-
getPrototypeString
Description copied from interface:AnnotatedStringHandler
Returns an example string of how the annotation is used- Specified by:
getPrototypeString
in interfaceAnnotatedStringHandler
- Parameters:
displayText
- The text that may be wrapped, cannot be null- Returns:
- the example of how this is used.
-