Package ghidra.app.util.viewer.field
Class FieldFactory
java.lang.Object
ghidra.app.util.viewer.field.FieldFactory
- All Implemented Interfaces:
ExtensionPoint
- Direct Known Subclasses:
AbstractOffsetFieldFactory
,AbstractVariableFieldFactory
,AddressFieldFactory
,ArrayValuesFieldFactory
,AssignedVariableFieldFactory
,BytesFieldFactory
,DummyFieldFactory
,EolCommentFieldFactory
,FieldNameFieldFactory
,FunctionCallFixupFieldFactory
,FunctionPurgeFieldFactory
,FunctionRepeatableCommentFieldFactory
,FunctionSignatureFieldFactory
,FunctionSignatureSourceFieldFactory
,FunctionTagFieldFactory
,InstructionMaskValueFieldFactory
,LabelFieldFactory
,MemoryBlockStartFieldFactory
,MnemonicFieldFactory
,OpenCloseFieldFactory
,OperandFieldFactory
,ParallelInstructionFieldFactory
,PcodeFieldFactory
,PlateFieldFactory
,PostCommentFieldFactory
,PreCommentFieldFactory
,RegisterFieldFactory
,RegisterTransitionFieldFactory
,SeparatorFieldFactory
,SpaceFieldFactory
,SpacerFieldFactory
,ThunkedFunctionFieldFactory
,XRefFieldFactory
NOTE: ALL FIELDFACTORY CLASSES MUST END IN "FieldFactory". If not,
the ClassSearcher will not find them.
Base class for Field Factories.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
protected Font
protected String
protected boolean
static final String
protected ListingHighlightProvider
protected FieldFormatModel
protected String
protected int
protected int
protected String
protected int
-
Constructor Summary
ModifierConstructorDescriptionFieldFactory
(String name) Constructs a FieldFactory with given name.protected
FieldFactory
(String name, FieldFormatModel model, ListingHighlightProvider highlightProvider, Options displayOptions, Options fieldOptions) Base constructor -
Method Summary
Modifier and TypeMethodDescriptionabstract boolean
acceptsType
(int category, Class<?> proxyObjectClass) Used to specify which format models this field can belong to.void
displayOptionsChanged
(Options options, String optionName, Object oldValue, Object newValue) Notifications that the display options changed.void
fieldOptionsChanged
(Options options, String optionName, Object oldValue, Object newValue) Notifications that the field options changed.abstract ListingField
Generates a Field based on the given information.abstract FieldLocation
getFieldLocation
(ListingField bf, 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'sgetFieldLocation(ListingField, BigInteger, int, ProgramLocation)
.Returns the FieldModel that this factory belongs to.Returns the Field name.Returns a description of the fields generated by this factory.Returns the font metrics used by this field factoryprotected FontMetrics
getMetrics
(int fontStyle) abstract ProgramLocation
getProgramLocation
(int row, int col, ListingField bf) Returns the Program location for the given object, row, col, and groupPathint
Returns the starting x position for the fields generated by this factory.int
getWidth()
Returns the width of the fields generated by this factory.protected boolean
hasSamePath
(ListingField bf, ProgramLocation loc) protected void
initDisplayOptions
(Options displayOptions) protected void
initFieldOptions
(Options fieldOptions) boolean
Returns true if this FieldFactory is currently enabled to generate Fields.abstract FieldFactory
newInstance
(FieldFormatModel formatModel, ListingHighlightProvider highlightProvider, ToolOptions options, ToolOptions fieldOptions) Returns a new instance of this FieldFactory that can be used to generate fields instead of being used as a prototype.void
Notification the services changed.void
setEnabled
(boolean state) Turns on or off the generating of Fields by this FieldFactory.void
setStartX
(int x) Sets the starting x position for the fields generated by this factory.void
setWidth
(int w) Sets the width of the fields generated by this factory.protected String
simplifyTemplates
(String input) boolean
supportsLocation
(ListingField listingField, ProgramLocation location) Returns true if this given field represents the given location
-
Field Details
-
FONT_OPTION_NAME
- See Also:
-
BASE_LISTING_FONT_ID
- See Also:
-
model
-
name
-
startX
protected int startX -
width
protected int width -
baseFont
-
style
protected int style -
enabled
protected boolean enabled -
hlProvider
-
colorOptionName
-
styleOptionName
-
-
Constructor Details
-
FieldFactory
protected FieldFactory(String name, FieldFormatModel model, ListingHighlightProvider highlightProvider, Options displayOptions, Options fieldOptions) Base constructor- Parameters:
name
- the name of the fieldmodel
- the model that the field belongs to.highlightProvider
- the HightLightStringProvider.displayOptions
- the Options for display properties.fieldOptions
- the Options for field specific properties.
-
FieldFactory
Constructs a FieldFactory with given name. Used only as potential field.- Parameters:
name
- the name of the field.
-
-
Method Details
-
initFieldOptions
-
initDisplayOptions
-
servicesChanged
public void servicesChanged()Notification the services changed. Subclasses should override this method if they care about service changes. -
newInstance
public abstract FieldFactory newInstance(FieldFormatModel formatModel, ListingHighlightProvider highlightProvider, ToolOptions options, ToolOptions fieldOptions) Returns a new instance of this FieldFactory that can be used to generate fields instead of being used as a prototype.- Parameters:
formatModel
- the model that the field belongs to.highlightProvider
- the HightLightProvider.options
- the Options for display properties.fieldOptions
- the Options for field specific properties.- Returns:
- the factory
-
displayOptionsChanged
public void displayOptionsChanged(Options options, String optionName, Object oldValue, Object newValue) Notifications that the display options changed.- 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, String optionName, Object oldValue, Object newValue) Notifications that the field options changed.- 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.
-
getFieldName
Returns the Field name.- Returns:
- the name.
-
getStartX
public int getStartX()Returns the starting x position for the fields generated by this factory.- Returns:
- the start x.
-
setStartX
public void setStartX(int x) Sets the starting x position for the fields generated by this factory.- Parameters:
x
- the x position.
-
getWidth
public int getWidth()Returns the width of the fields generated by this factory.- Returns:
- the width.
-
setWidth
public void setWidth(int w) Sets the width of the fields generated by this factory.- Parameters:
w
- the width.
-
getFieldModel
Returns the FieldModel that this factory belongs to.- Returns:
- the model.
-
isEnabled
public boolean isEnabled()Returns true if this FieldFactory is currently enabled to generate Fields.- Returns:
- true if enabled.
-
setEnabled
public void setEnabled(boolean state) Turns on or off the generating of Fields by this FieldFactory.- Parameters:
state
- if true, this factory will generate fields.
-
supportsLocation
Returns true if this given field represents the given location- Parameters:
listingField
- the fieldlocation
- the location- Returns:
- true if this given field represents the given location
-
getField
Generates a Field based on the given information.- Parameters:
obj
- 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.
-
getFieldLocation
public abstract FieldLocation getFieldLocation(ListingField bf, 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'sgetFieldLocation(ListingField, BigInteger, int, ProgramLocation)
. Each FieldFactory should generate and process a unique ProgramLocation class.- 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.- Returns:
- the location.
-
getProgramLocation
Returns the Program location for the given object, row, col, and groupPath- Parameters:
row
- the row within this fieldcol
- the col on the given row within this field.bf
- the ListingField containing the cursor.- Returns:
- the location.
-
acceptsType
Used to specify which format models this field can belong to.- 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.
-
hasSamePath
-
getFieldText
Returns a description of the fields generated by this factory.- Returns:
- the text.
-
getMetrics
Returns the font metrics used by this field factory- Returns:
- the metrics.
-
getMetrics
-
simplifyTemplates
-