Package ghidra.app.util.viewer.field
Class XRefFieldFactory
- java.lang.Object
-
- ghidra.app.util.viewer.field.FieldFactory
-
- ghidra.app.util.viewer.field.XRefFieldFactory
-
- All Implemented Interfaces:
ExtensionPoint
- Direct Known Subclasses:
VariableXRefFieldFactory
,XRefHeaderFieldFactory
public class XRefFieldFactory extends FieldFactory
Cross-reference Field Factory
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
XRefFieldFactory.SORT_CHOICE
-
Nested classes/interfaces inherited from interface ghidra.util.classfinder.ExtensionPoint
ExtensionPoint.Exclude, ExtensionPoint.Util
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
delim
protected boolean
displayBlockName
protected boolean
displayLocalNamespace
protected boolean
displayNonLocalNamespace
protected boolean
displayRefType
static java.lang.String
FIELD_NAME
protected java.lang.String
localPrefixText
protected int
maxXRefs
protected java.awt.Color
offcutColor
protected java.awt.Color
otherColor
protected java.awt.Color
readColor
protected XRefFieldFactory.SORT_CHOICE
sortChoice
protected java.util.Comparator<Reference>
typeComparator
protected boolean
useLocalPrefixOverride
protected java.awt.Color
writeColor
-
Fields inherited from class ghidra.app.util.viewer.field.FieldFactory
baseFont, color, colorOptionName, DEFAULT_FIELD_FONT, displayOptions, enabled, FONT_OPTION_NAME, hlProvider, model, name, startX, style, styleOptionName, underlineColor, width
-
-
Constructor Summary
Constructors Modifier Constructor Description XRefFieldFactory()
ConstructorXRefFieldFactory(FieldFormatModel model, HighlightProvider hlProvider, Options displayOptions, ToolOptions fieldOptions)
Constructorprotected
XRefFieldFactory(java.lang.String name)
protected
XRefFieldFactory(java.lang.String name, FieldFormatModel model, HighlightProvider hlProvider, Options displayOptions, ToolOptions fieldOptions)
Constructs a new XRefFieldFactory based on the provider and model.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
acceptsType(int category, java.lang.Class<?> proxyObjectClass)
Used to specify which format models this field can belong to.protected FieldLocation
createFieldLocation(int xrefPos, int xrefIndex, ListingTextField field, java.math.BigInteger index, int fieldNum)
protected AttributedString
createRefTypeAttributedString(Reference reference, AttributedString referenceString)
void
displayOptionsChanged(Options options, java.lang.String optionName, java.lang.Object oldValue, java.lang.Object newValue)
Notifications that the display options changed.void
fieldOptionsChanged(Options options, java.lang.String optionName, java.lang.Object oldValue, java.lang.Object newValue)
Notifications that the field options changed.protected java.lang.String
getBlockName(Program pgm, Address addr)
java.awt.Color
getDefaultColor()
Returns the default field color.ListingField
getField(ProxyObj<?> proxy, int varWidth)
Generates a Field based on the given information.FieldLocation
getFieldLocation(ListingField bf, java.math.BigInteger index, int fieldNum, ProgramLocation loc)
Return a FieldLocation that corresponds to the given index, fieldNum, and ProgramLocation IF and ONLY IF the given programLocation is the type generated by this class'sFieldFactory.getFieldLocation(ListingField, BigInteger, int, ProgramLocation)
.protected java.lang.String
getPrefix(Program program, Reference reference, Function currentFunction)
protected Program
getProgram(java.lang.Object obj)
ProgramLocation
getProgramLocation(int row, int col, ListingField bf)
Returns the Program location for the given object, row, col, and groupPathprotected Address
getXRefLocation(java.lang.Object obj)
Get an address location for this object.FieldFactory
newInstance(FieldFormatModel formatModel, HighlightProvider provider, ToolOptions displayOptions, ToolOptions fieldOptions)
Returns a new instance of this FieldFactory that can be used to generate fields instead of being used as a prototype.-
Methods inherited from class ghidra.app.util.viewer.field.FieldFactory
getFieldModel, getFieldName, getFieldText, getMetrics, getMetrics, getStartX, getWidth, hasSamePath, initDisplayOptions, isEnabled, optionsChanged, servicesChanged, setEnabled, setStartX, setWidth
-
-
-
-
Field Detail
-
FIELD_NAME
public static final java.lang.String FIELD_NAME
- See Also:
- Constant Field Values
-
sortChoice
protected XRefFieldFactory.SORT_CHOICE sortChoice
-
offcutColor
protected java.awt.Color offcutColor
-
readColor
protected java.awt.Color readColor
-
writeColor
protected java.awt.Color writeColor
-
otherColor
protected java.awt.Color otherColor
-
delim
protected java.lang.String delim
-
displayBlockName
protected boolean displayBlockName
-
maxXRefs
protected int maxXRefs
-
displayRefType
protected boolean displayRefType
-
typeComparator
protected java.util.Comparator<Reference> typeComparator
-
displayLocalNamespace
protected boolean displayLocalNamespace
-
displayNonLocalNamespace
protected boolean displayNonLocalNamespace
-
useLocalPrefixOverride
protected boolean useLocalPrefixOverride
-
localPrefixText
protected java.lang.String localPrefixText
-
-
Constructor Detail
-
XRefFieldFactory
public XRefFieldFactory()
Constructor
-
XRefFieldFactory
protected XRefFieldFactory(java.lang.String name)
-
XRefFieldFactory
public XRefFieldFactory(FieldFormatModel model, HighlightProvider hlProvider, Options displayOptions, ToolOptions fieldOptions)
Constructor- Parameters:
model
- the model that the field belongs to.hlProvider
- the HightLightProvider.displayOptions
- the Options for display properties.fieldOptions
- the Options for field specific properties.
-
XRefFieldFactory
protected XRefFieldFactory(java.lang.String name, FieldFormatModel model, HighlightProvider hlProvider, Options displayOptions, ToolOptions fieldOptions)
Constructs a new XRefFieldFactory based on the provider and model.- Parameters:
name
- the owner of this field factorymodel
- the model that the field belongs to.hlProvider
- the HightLightProvider.displayOptions
- the Options for display properties.fieldOptions
- the Options for field specific properties.
-
-
Method Detail
-
displayOptionsChanged
public void displayOptionsChanged(Options options, java.lang.String optionName, java.lang.Object oldValue, java.lang.Object newValue)
Description copied from class:FieldFactory
Notifications that the display options changed.- Overrides:
displayOptionsChanged
in classFieldFactory
- Parameters:
options
- the Display Options object that changed.optionName
- the name of the property that changed.oldValue
- the old value of the property.newValue
- the new value of the property.
-
fieldOptionsChanged
public void fieldOptionsChanged(Options options, java.lang.String optionName, java.lang.Object oldValue, java.lang.Object newValue)
Description copied from class:FieldFactory
Notifications that the field options changed.- Overrides:
fieldOptionsChanged
in classFieldFactory
- Parameters:
options
- the Field Options object that changed.optionName
- the name of the property that changed.oldValue
- the old value of the property.newValue
- the new value of the property.
-
getDefaultColor
public java.awt.Color getDefaultColor()
Description copied from class:FieldFactory
Returns the default field color.- Overrides:
getDefaultColor
in classFieldFactory
-
getField
public ListingField getField(ProxyObj<?> proxy, int varWidth)
Description copied from class:FieldFactory
Generates a Field based on the given information.- Specified by:
getField
in classFieldFactory
- Parameters:
proxy
- The object that the generated field will report some information about.varWidth
- the additional distance along the x axis to place the generated field.- Returns:
- the newly generated FactoryField that shows some property or information about the given object.
-
createRefTypeAttributedString
protected AttributedString createRefTypeAttributedString(Reference reference, AttributedString referenceString)
-
getPrefix
protected java.lang.String getPrefix(Program program, Reference reference, Function currentFunction)
-
getFieldLocation
public FieldLocation getFieldLocation(ListingField bf, java.math.BigInteger index, int fieldNum, ProgramLocation loc)
Description copied from class:FieldFactory
Return a FieldLocation that corresponds to the given index, fieldNum, and ProgramLocation IF and ONLY IF the given programLocation is the type generated by this class'sFieldFactory.getFieldLocation(ListingField, BigInteger, int, ProgramLocation)
. Each FieldFactory should generate and process a unique ProgramLocation class.- Specified by:
getFieldLocation
in classFieldFactory
- Parameters:
bf
- the ListingField at the current cursor.index
- the line index (corresponds to an address)fieldNum
- the index of field within the layout to try and get a FieldLocation.loc
- the ProgramLocation to be converted into a FieldLocation.
-
createFieldLocation
protected FieldLocation createFieldLocation(int xrefPos, int xrefIndex, ListingTextField field, java.math.BigInteger index, int fieldNum)
-
getProgramLocation
public ProgramLocation getProgramLocation(int row, int col, ListingField bf)
Description copied from class:FieldFactory
Returns the Program location for the given object, row, col, and groupPath- Specified by:
getProgramLocation
in classFieldFactory
- Parameters:
row
- the row within this fieldcol
- the col on the given row within this field.bf
- the ListingField containing the cursor.
-
getXRefLocation
protected Address getXRefLocation(java.lang.Object obj)
Get an address location for this object.- Parameters:
obj
- object to get location from
-
getProgram
protected Program getProgram(java.lang.Object obj)
-
acceptsType
public boolean acceptsType(int category, java.lang.Class<?> proxyObjectClass)
Description copied from class:FieldFactory
Used to specify which format models this field can belong to.- Specified by:
acceptsType
in classFieldFactory
- Parameters:
category
- the category for this fieldproxyObjectClass
- the type of proxy object used by this field- Returns:
- true if this class accepts the given category.
-
newInstance
public FieldFactory newInstance(FieldFormatModel formatModel, HighlightProvider provider, ToolOptions displayOptions, ToolOptions fieldOptions)
Description copied from class:FieldFactory
Returns a new instance of this FieldFactory that can be used to generate fields instead of being used as a prototype.- Specified by:
newInstance
in classFieldFactory
- Parameters:
formatModel
- the model that the field belongs to.provider
- the HightLightProvider.displayOptions
- the Options for display properties.fieldOptions
- the Options for field specific properties.
-
-