Package ghidra.program.database.data
Class ProjectDataTypeManager
- java.lang.Object
-
- ghidra.program.database.data.DataTypeManagerDB
-
- ghidra.program.database.data.ProjectDataTypeManager
-
- All Implemented Interfaces:
DataTypeManager
,DomainFileBasedDataTypeManager
,FileBasedDataTypeManager
,ProjectArchiveBasedDataTypeManager
public class ProjectDataTypeManager extends DataTypeManagerDB implements ProjectArchiveBasedDataTypeManager
Class for managing data types in a project archive NOTE: default data organization is used.
-
-
Field Summary
-
Fields inherited from class ghidra.program.database.data.DataTypeManagerDB
dataOrganization, dbHandle, defaultListener, sourceArchiveAdapter, universalID
-
Fields inherited from interface ghidra.program.model.data.DataTypeManager
BAD_DATATYPE_ID, BUILT_IN_ARCHIVE_KEY, BUILT_IN_ARCHIVE_UNIVERSAL_ID, BUILT_IN_DATA_TYPES_NAME, DEFAULT_DATATYPE_ID, LOCAL_ARCHIVE_KEY, LOCAL_ARCHIVE_UNIVERSAL_ID, NULL_DATATYPE_ID
-
-
Constructor Summary
Constructors Constructor Description ProjectDataTypeManager(DBHandle handle, int openMode, ErrorHandler errHandler, Lock lock, TaskMonitor monitor)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
archiveReady(int openMode, TaskMonitor monitor)
protected void
categoryCreated(Category newCategory)
protected void
categoryMoved(CategoryPath oldPath, Category category)
protected void
categoryRemoved(Category parent, java.lang.String name, long categoryID)
protected void
categoryRenamed(CategoryPath oldPath, Category category)
void
close()
Closes this dataType managerprotected void
dataTypeAdded(DataType newDt, DataType originalDataType)
void
dataTypeChanged(DataType dt, boolean isAutoChange)
Notification when data type is changed.protected void
dataTypeDeleted(long deletedID, DataTypePath deletedDataTypePath)
protected void
dataTypeMoved(DataType dt, DataTypePath oldPath, DataTypePath newPath)
protected void
dataTypeNameChanged(DataType dt, java.lang.String oldName)
protected void
dataTypeReplaced(long existingDtID, DataTypePath existingPath, DataType replacementDt)
protected void
deleteDataTypeIDs(java.util.LinkedList<java.lang.Long> deletedIds, TaskMonitor monitor)
void
endTransaction(int transactionID, boolean commit)
Ends the current transactionprotected void
favoritesChanged(DataType dataType, boolean isFavorite)
void
flushEvents()
Force all pending notification events to be flushedDomainFile
getDomainFile()
java.lang.String
getDomainFileID()
java.lang.String
getName()
Returns this data type manager's namejava.lang.String
getPath()
Pointer
getPointer(DataType dt)
Returns a default sized pointer to the given datatype.ArchiveType
getType()
Returns this manager's archive typeprotected void
replaceDataTypeIDs(long oldDataTypeID, long newDataTypeID)
void
setDataTypeArchive(DataTypeArchiveDB dtArchive)
Set the associated Archivevoid
setName(java.lang.String name)
Sets this data type manager's nameint
startTransaction(java.lang.String description)
Starts a transaction for making changes in this data type manager.-
Methods inherited from class ghidra.program.database.data.DataTypeManagerDB
addDataType, addDataTypeManagerListener, addDataTypes, addDataTypeToDelete, addInvalidatedListener, associateDataTypeWithArchive, clearAllSettings, clearSetting, clearSettings, contains, containsCategory, createCategory, dbError, deleteAddressRange, disassociate, dispose, doSourceArchiveUpdates, findDataType, findDataTypeForID, findDataTypes, findDataTypes, findEnumValueNames, fixupComposites, getAllComposites, getAllDataTypes, getAllDataTypes, getAllStructures, getByteSettingsValue, getCategory, getCategory, getCategoryCount, getDataOrganization, getDataType, getDataType, getDataType, getDataType, getDataType, getDataTypeCount, getDataTypes, getDataTypes, getDataTypesContaining, getFavorites, getID, getLastChangeTimeForMyManager, getLocalSourceArchive, getLongSettingsValue, getNames, getPointer, getResolvedID, getRootCategory, getSettings, getSourceArchive, getSourceArchive, getSourceArchives, getStringSettingsValue, getUniqueName, getUniqueName, getUniversalID, getUnusedConflictName, invalidateCache, isChanged, isCreatingDataType, isEmptySetting, isFavorite, isTransactionActive, isUpdatable, migrateOldFlexArrayComponentsIfRequired, moveAddressRange, remove, removeDataTypeManagerListener, removeInvalidatedListener, removeSourceArchive, replaceDataType, replaceSourceArchive, resolve, resolveSourceArchive, setByteSettingsValue, setFavorite, setLongSettingsValue, setSettings, setStringSettingsValue, sourceArchiveAdded, sourceArchiveChanged, updateID, updateSourceArchiveName, updateSourceArchiveName
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface ghidra.program.model.data.DataTypeManager
addDataType, addDataTypeManagerListener, addDataTypes, addInvalidatedListener, associateDataTypeWithArchive, contains, containsCategory, createCategory, disassociate, findDataType, findDataTypeForID, findDataTypes, findDataTypes, findEnumValueNames, getAllComposites, getAllDataTypes, getAllDataTypes, getAllStructures, getCategory, getCategory, getCategoryCount, getDataOrganization, getDataType, getDataType, getDataType, getDataType, getDataType, getDataTypeCount, getDataTypes, getDataTypesContaining, getFavorites, getID, getLastChangeTimeForMyManager, getLocalSourceArchive, getPointer, getResolvedID, getRootCategory, getSourceArchive, getSourceArchives, getUniqueName, getUniversalID, isFavorite, isUpdatable, remove, removeDataTypeManagerListener, removeInvalidatedListener, removeSourceArchive, replaceDataType, resolve, resolveSourceArchive, setFavorite, updateSourceArchiveName, updateSourceArchiveName
-
-
-
-
Constructor Detail
-
ProjectDataTypeManager
public ProjectDataTypeManager(DBHandle handle, int openMode, ErrorHandler errHandler, Lock lock, TaskMonitor monitor) throws CancelledException, VersionException, java.io.IOException
Constructor- Parameters:
handle
- open database handleopenMode
- the program open modeerrHandler
- the database I/O error handlerlock
- the program synchronization lockmonitor
- the progress monitor- Throws:
CancelledException
- if the user cancels an upgradeVersionException
- if the database does not match the expected version.java.io.IOException
- if a database I/O error occurs.
-
-
Method Detail
-
setDataTypeArchive
public void setDataTypeArchive(DataTypeArchiveDB dtArchive)
Set the associated Archive- Parameters:
dtArchive
- associated archive
-
getName
public java.lang.String getName()
Description copied from interface:DataTypeManager
Returns this data type manager's name- Specified by:
getName
in interfaceDataTypeManager
- Returns:
- the name
-
getPointer
public Pointer getPointer(DataType dt)
Description copied from interface:DataTypeManager
Returns a default sized pointer to the given datatype. The pointer size is established dynamically based upon the data organization established by the compiler specification.- Specified by:
getPointer
in interfaceDataTypeManager
- Overrides:
getPointer
in classDataTypeManagerDB
- Parameters:
dt
- the pointed to data type- Returns:
- the pointer
-
setName
public void setName(java.lang.String name) throws InvalidNameException
Description copied from interface:DataTypeManager
Sets this data type manager's name- Specified by:
setName
in interfaceDataTypeManager
- Parameters:
name
- the new name- Throws:
InvalidNameException
- if the given name is invalid (such as when null or empty)
-
dataTypeChanged
public void dataTypeChanged(DataType dt, boolean isAutoChange)
Description copied from interface:DataTypeManager
Notification when data type is changed.- Specified by:
dataTypeChanged
in interfaceDataTypeManager
- Overrides:
dataTypeChanged
in classDataTypeManagerDB
- Parameters:
dt
- data type that is changedisAutoChange
- true if change was an automatic change in response to another datatype's change (e.g., size, alignment).
-
dataTypeAdded
protected void dataTypeAdded(DataType newDt, DataType originalDataType)
- Overrides:
dataTypeAdded
in classDataTypeManagerDB
-
dataTypeReplaced
protected void dataTypeReplaced(long existingDtID, DataTypePath existingPath, DataType replacementDt)
- Overrides:
dataTypeReplaced
in classDataTypeManagerDB
-
dataTypeDeleted
protected void dataTypeDeleted(long deletedID, DataTypePath deletedDataTypePath)
- Overrides:
dataTypeDeleted
in classDataTypeManagerDB
-
dataTypeMoved
protected void dataTypeMoved(DataType dt, DataTypePath oldPath, DataTypePath newPath)
- Overrides:
dataTypeMoved
in classDataTypeManagerDB
-
dataTypeNameChanged
protected void dataTypeNameChanged(DataType dt, java.lang.String oldName)
- Overrides:
dataTypeNameChanged
in classDataTypeManagerDB
-
categoryCreated
protected void categoryCreated(Category newCategory)
- Overrides:
categoryCreated
in classDataTypeManagerDB
-
categoryRenamed
protected void categoryRenamed(CategoryPath oldPath, Category category)
- Overrides:
categoryRenamed
in classDataTypeManagerDB
-
categoryRemoved
protected void categoryRemoved(Category parent, java.lang.String name, long categoryID)
- Overrides:
categoryRemoved
in classDataTypeManagerDB
-
categoryMoved
protected void categoryMoved(CategoryPath oldPath, Category category)
- Overrides:
categoryMoved
in classDataTypeManagerDB
-
favoritesChanged
protected void favoritesChanged(DataType dataType, boolean isFavorite)
- Overrides:
favoritesChanged
in classDataTypeManagerDB
-
replaceDataTypeIDs
protected void replaceDataTypeIDs(long oldDataTypeID, long newDataTypeID)
- Specified by:
replaceDataTypeIDs
in classDataTypeManagerDB
-
deleteDataTypeIDs
protected void deleteDataTypeIDs(java.util.LinkedList<java.lang.Long> deletedIds, TaskMonitor monitor) throws CancelledException
- Specified by:
deleteDataTypeIDs
in classDataTypeManagerDB
- Throws:
CancelledException
-
startTransaction
public int startTransaction(java.lang.String description)
Description copied from interface:DataTypeManager
Starts a transaction for making changes in this data type manager.- Specified by:
startTransaction
in interfaceDataTypeManager
- Parameters:
description
- a short description of the changes to be made.- Returns:
- the transaction ID
-
flushEvents
public void flushEvents()
Description copied from interface:DataTypeManager
Force all pending notification events to be flushed- Specified by:
flushEvents
in interfaceDataTypeManager
-
endTransaction
public void endTransaction(int transactionID, boolean commit)
Description copied from interface:DataTypeManager
Ends the current transaction- Specified by:
endTransaction
in interfaceDataTypeManager
- Parameters:
transactionID
- id of the transaction to endcommit
- true if changes are committed, false if changes in transaction are revoked
-
getDomainFile
public DomainFile getDomainFile()
- Specified by:
getDomainFile
in interfaceDomainFileBasedDataTypeManager
-
getDomainFileID
public java.lang.String getDomainFileID()
- Specified by:
getDomainFileID
in classDataTypeManagerDB
-
getPath
public java.lang.String getPath()
- Specified by:
getPath
in interfaceFileBasedDataTypeManager
- Specified by:
getPath
in classDataTypeManagerDB
-
getType
public ArchiveType getType()
Description copied from interface:DataTypeManager
Returns this manager's archive type- Specified by:
getType
in interfaceDataTypeManager
- Returns:
- the type
-
archiveReady
public void archiveReady(int openMode, TaskMonitor monitor) throws java.io.IOException, CancelledException
- Throws:
java.io.IOException
CancelledException
-
close
public void close()
Description copied from interface:DataTypeManager
Closes this dataType manager- Specified by:
close
in interfaceDataTypeManager
- Overrides:
close
in classDataTypeManagerDB
-
-