Package ghidra.program.database
Class ProjectDataTypeManager
java.lang.Object
ghidra.program.database.data.DataTypeManagerDB
ghidra.program.model.data.StandAloneDataTypeManager
ghidra.program.database.ProjectDataTypeManager
- All Implemented Interfaces:
DataTypeManager,DomainFileBasedDataTypeManager,FileBasedDataTypeManager,ProjectArchiveBasedDataTypeManager,Closeable,AutoCloseable
public class ProjectDataTypeManager
extends StandAloneDataTypeManager
implements ProjectArchiveBasedDataTypeManager
Class for managing data types in a project archive
NOTE: default data organization is used.
-
Nested Class Summary
Nested classes/interfaces inherited from class ghidra.program.model.data.StandAloneDataTypeManager
StandAloneDataTypeManager.ArchiveWarning, StandAloneDataTypeManager.ArchiveWarningLevel, StandAloneDataTypeManager.LanguageUpdateOption -
Field Summary
Fields inherited from class ghidra.program.model.data.StandAloneDataTypeManager
nameFields inherited from class ghidra.program.database.data.DataTypeManagerDB
addrMap, dbHandle, DEFAULT_CALLING_CONVENTION_ID, defaultListener, errHandler, lock, readOnlyMode, sourceArchiveAdapter, tablePrefix, universalID, UNKNOWN_CALLING_CONVENTION_IDFields 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 -
Method Summary
Modifier and TypeMethodDescriptionvoidarchiveReady(int openMode, TaskMonitor monitor) protected voidcategoryCreated(Category newCategory) protected voidcategoryMoved(CategoryPath oldPath, Category category) protected voidcategoryRemoved(Category parent, String name, long categoryID) protected voidcategoryRenamed(CategoryPath oldPath, Category category) voidclearProgramArchitecture(TaskMonitor monitor) Clear the program architecture setting and all architecture-specific data from this archive.voidclose()Closes this dataType managerprotected voiddataTypeAdded(DataType newDt, DataType originalDataType) voiddataTypeChanged(DataType dt, boolean isAutoChange) Notification when data type is changed.protected voiddataTypeDeleted(long deletedID, DataTypePath deletedDataTypePath) protected voiddataTypeMoved(DataType dt, DataTypePath oldPath, DataTypePath newPath) protected voiddataTypeNameChanged(DataType dt, String oldName) protected voiddataTypeReplaced(long existingDtID, DataTypePath existingPath, DataType replacementDt) protected voiddeleteDataTypeIDs(LinkedList<Long> deletedIds, TaskMonitor monitor) Delete all datatype uses external to the datatype manager if applicable.voidendTransaction(int transactionID, boolean commit) Ends the current transactionprotected voidfavoritesChanged(DataType dataType, boolean isFavorite) voidForce all pending notification events to be flushedgetName()Returns this data type manager's namegetPath()Get the path name associated with the storage of this stand alone datatype manager.getType()Returns this manager's archive typeopenTransaction(String description) Open new transaction.protected voidreplaceDataTypeIDs(long oldDataTypeID, long newDataTypeID) Replace all datatype uses external to the datatype manager if applicable.voidSets this data type manager's namevoidsetProgramArchitecture(Language language, CompilerSpecID compilerSpecId, StandAloneDataTypeManager.LanguageUpdateOption updateOption, TaskMonitor monitor) Establish the program architecture for this datatype manager.intstartTransaction(String description) Starts a transaction for making changes in this data type manager.Methods inherited from class ghidra.program.model.data.StandAloneDataTypeManager
finalize, getProgramArchitectureSummary, getWarning, getWarningDetail, getWarningMessage, handleDataOrganizationChange, initializeOtherAdapters, isArchitectureChangeAllowed, isProgramArchitectureMissing, isProgramArchitectureUpgradeRequired, logWarning, setProgramArchitectureMethods inherited from class ghidra.program.database.data.DataTypeManagerDB
addDataType, addDataTypeManagerListener, addDataTypes, addDataTypeToDelete, addInvalidatedListener, allowsDefaultBuiltInSettings, allowsDefaultComponentSettings, associateDataTypeWithArchive, compilerSpecChanged, contains, containsCategory, createCategory, dataTypeSettingsChanged, dbError, disassociate, dispose, doSourceArchiveUpdates, findDataType, findDataTypeForID, findDataTypes, findDataTypes, findEnumValueNames, fixupComposites, getAddressMap, getAllComposites, getAllDataTypes, getAllDataTypes, getAllFunctionDefinitions, getAllStructures, getCallingConvention, getCallingConventionID, getCallingConventionName, getCategory, getCategory, getCategoryCount, getDataMap, getDataOrganization, getDataType, getDataType, getDataType, getDataType, getDataType, getDataTypeCount, getDataTypes, getDataTypes, getDataTypesContaining, getDefaultCallingConvention, getDefinedCallingConventionNames, getFavorites, getID, getKnownCallingConventionNames, getLastChangeTimeForMyManager, getLocalSourceArchive, getPointer, getPointer, getProgramArchitecture, getProgramArchitectureSummary, getResolvedID, getRootCategory, getSourceArchive, getSourceArchive, getSourceArchives, getUniqueName, getUniversalID, getUnusedConflictName, getUnusedConflictName, getVariableStorageManager, hasDataOrganizationChange, invalidateCache, isChanged, isCreatingDataType, isFavorite, isTransactionActive, isUpdatable, migrateOldFlexArrayComponentsIfRequired, readDataOrganization, remove, removeDataTypeManagerListener, removeInvalidatedListener, removeSourceArchive, replaceDataType, replaceSourceArchive, resolve, resolveSourceArchive, saveDataOrganization, setFavorite, sourceArchiveAdded, sourceArchiveChanged, updateID, updateLastChangeTime, updateSourceArchiveName, updateSourceArchiveNameMethods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ghidra.program.model.data.DataTypeManager
addDataType, addDataTypeManagerListener, addDataTypes, addInvalidatedListener, allowsDefaultBuiltInSettings, allowsDefaultComponentSettings, associateDataTypeWithArchive, contains, containsCategory, createCategory, disassociate, findDataType, findDataTypeForID, findDataTypes, findDataTypes, findEnumValueNames, getAddressMap, getAllComposites, getAllDataTypes, getAllDataTypes, getAllFunctionDefinitions, getAllStructures, getCallingConvention, getCategory, getCategory, getCategoryCount, getDataOrganization, getDataType, getDataType, getDataType, getDataType, getDataType, getDataTypeCount, getDataTypes, getDataTypesContaining, getDefaultCallingConvention, getDefinedCallingConventionNames, getFavorites, getID, getKnownCallingConventionNames, getLastChangeTimeForMyManager, getLocalSourceArchive, getPointer, getPointer, getProgramArchitecture, getProgramArchitectureSummary, getResolvedID, getRootCategory, getSourceArchive, getSourceArchives, getUniqueName, getUniversalID, isFavorite, isUpdatable, remove, removeDataTypeManagerListener, removeInvalidatedListener, removeSourceArchive, replaceDataType, resolve, resolveSourceArchive, setFavorite, updateSourceArchiveName, updateSourceArchiveName
-
Method Details
-
getName
Description copied from interface:DataTypeManagerReturns this data type manager's name- Specified by:
getNamein interfaceDataTypeManager- Overrides:
getNamein classStandAloneDataTypeManager- Returns:
- the name
-
setName
Description copied from interface:DataTypeManagerSets this data type manager's name- Specified by:
setNamein interfaceDataTypeManager- Overrides:
setNamein classStandAloneDataTypeManager- Parameters:
name- the new name- Throws:
InvalidNameException- if the given name is invalid (such as when null or empty)
-
clearProgramArchitecture
public void clearProgramArchitecture(TaskMonitor monitor) throws CancelledException, IOException, LockException Description copied from class:StandAloneDataTypeManagerClear the program architecture setting and all architecture-specific data from this archive. Archive will revert to using the defaultDataOrganization. Archive must be open for update for this method to be used.- Overrides:
clearProgramArchitecturein classStandAloneDataTypeManager- Parameters:
monitor- task monitor- Throws:
CancelledException- if task cancelled. If thrown, this data type manager is no longer stable and should be closed without saving.IOException- if IO error occursLockException- failure if exclusive access is required
-
setProgramArchitecture
public void setProgramArchitecture(Language language, CompilerSpecID compilerSpecId, StandAloneDataTypeManager.LanguageUpdateOption updateOption, TaskMonitor monitor) throws CompilerSpecNotFoundException, LanguageNotFoundException, IOException, LockException, javax.help.UnsupportedOperationException, IncompatibleLanguageException, CancelledException Description copied from class:StandAloneDataTypeManagerEstablish the program architecture for this datatype manager. The current setting can be determined fromDataTypeManagerDB.getProgramArchitecture(). Archive must be open for update for this method to be used.- Overrides:
setProgramArchitecturein classStandAloneDataTypeManager- Parameters:
language- languagecompilerSpecId- compiler specification ID defined by the language.updateOption- indicates how variable storage data should be transitioned. IfStandAloneDataTypeManager.isProgramArchitectureMissing()is true andStandAloneDataTypeManager.LanguageUpdateOption.TRANSLATEspecified, the translator will be based on whatever language version can be found. In this situation it may be best to force aStandAloneDataTypeManager.LanguageUpdateOption.CLEAR.monitor- task monitor (cancel not permitted to avoid corrupt state)- Throws:
CompilerSpecNotFoundException- if invalid compilerSpecId specified for languageLanguageNotFoundException- if current language is not found (if required for data transition)IOException- if IO error occursLockException- failure if exclusive access is requiredjavax.help.UnsupportedOperationException- if architecture change is not permittedIncompatibleLanguageException- if translation requested but not possible due to incompatible language architecturesCancelledException- if task cancelled. If thrown, this data type manager is no longer stable and should be closed without saving.
-
dataTypeChanged
Description copied from class:DataTypeManagerDBNotification when data type is changed.- Overrides:
dataTypeChangedin 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
- Overrides:
dataTypeAddedin classDataTypeManagerDB
-
dataTypeReplaced
protected void dataTypeReplaced(long existingDtID, DataTypePath existingPath, DataType replacementDt) - Overrides:
dataTypeReplacedin classDataTypeManagerDB
-
dataTypeDeleted
- Overrides:
dataTypeDeletedin classDataTypeManagerDB
-
dataTypeMoved
- Overrides:
dataTypeMovedin classDataTypeManagerDB
-
dataTypeNameChanged
- Overrides:
dataTypeNameChangedin classDataTypeManagerDB
-
categoryCreated
- Overrides:
categoryCreatedin classDataTypeManagerDB
-
categoryRenamed
- Overrides:
categoryRenamedin classDataTypeManagerDB
-
categoryRemoved
- Overrides:
categoryRemovedin classDataTypeManagerDB
-
categoryMoved
- Overrides:
categoryMovedin classDataTypeManagerDB
-
favoritesChanged
- Overrides:
favoritesChangedin classDataTypeManagerDB
-
replaceDataTypeIDs
protected void replaceDataTypeIDs(long oldDataTypeID, long newDataTypeID) Description copied from class:DataTypeManagerDBReplace all datatype uses external to the datatype manager if applicable.- Overrides:
replaceDataTypeIDsin classStandAloneDataTypeManager- Parameters:
oldDataTypeID- old datatype IDnewDataTypeID- new datatype ID
-
deleteDataTypeIDs
Description copied from class:DataTypeManagerDBDelete all datatype uses external to the datatype manager if applicable.- Overrides:
deleteDataTypeIDsin classStandAloneDataTypeManager- Parameters:
deletedIds- old datatype IDs which were deletedmonitor- task monitor
-
openTransaction
Description copied from interface:DataTypeManagerOpen new transaction. This should generally be done with a try-with-resources block:try (Transaction tx = dtm.openTransaction(description)) { // ... Do something }- Specified by:
openTransactionin interfaceDataTypeManager- Overrides:
openTransactionin classStandAloneDataTypeManager- Parameters:
description- a short description of the changes to be made.- Returns:
- transaction object
- Throws:
IllegalStateException- if thisDataTypeManagerhas already been closed.
-
startTransaction
Description copied from interface:DataTypeManagerStarts a transaction for making changes in this data type manager.- Specified by:
startTransactionin interfaceDataTypeManager- Overrides:
startTransactionin classStandAloneDataTypeManager- Parameters:
description- a short description of the changes to be made.- Returns:
- the transaction ID
-
flushEvents
public void flushEvents()Description copied from interface:DataTypeManagerForce all pending notification events to be flushed- Specified by:
flushEventsin interfaceDataTypeManager- Overrides:
flushEventsin classStandAloneDataTypeManager
-
endTransaction
public void endTransaction(int transactionID, boolean commit) Description copied from interface:DataTypeManagerEnds the current transaction- Specified by:
endTransactionin interfaceDataTypeManager- Overrides:
endTransactionin classStandAloneDataTypeManager- Parameters:
transactionID- id of the transaction to endcommit- true if changes are committed, false if changes in transaction are revoked
-
getDomainFile
- Specified by:
getDomainFilein interfaceDomainFileBasedDataTypeManager
-
getDomainFileID
- Overrides:
getDomainFileIDin classStandAloneDataTypeManager
-
getPath
Description copied from class:StandAloneDataTypeManagerGet the path name associated with the storage of this stand alone datatype manager.- Specified by:
getPathin interfaceFileBasedDataTypeManager- Overrides:
getPathin classStandAloneDataTypeManager- Returns:
- path name or null if not applicable
-
getType
Description copied from interface:DataTypeManagerReturns this manager's archive type- Specified by:
getTypein interfaceDataTypeManager- Overrides:
getTypein classStandAloneDataTypeManager- Returns:
- the type
-
archiveReady
- Throws:
IOExceptionCancelledException
-
close
public void close()Description copied from interface:DataTypeManagerCloses this dataType manager- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceDataTypeManager- Overrides:
closein classStandAloneDataTypeManager
-