Class ProjectDataTypeManager
- All Implemented Interfaces:
DataTypeManager,DomainFileBasedDataTypeManager,FileBasedDataTypeManager,ProjectArchiveBasedDataTypeManager,Closeable,AutoCloseable
-
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(OpenMode openMode, TaskMonitor monitor) booleancanRedo()Determine if there is a transaction previously undone (seeStandAloneDataTypeManager.undo()) that can be redone (seeStandAloneDataTypeManager.redo()).booleancanUndo()Determine if there is a previous transaction that can be reverted/undone (seeStandAloneDataTypeManager.undo()).protected voidcategoryCreated(Category newCategory) protected voidcategoryMoved(CategoryPath oldPath, Category category) protected voidcategoryRemoved(Category parent, String categoryName, long categoryID) protected voidcategoryRenamed(CategoryPath oldPath, Category category) voidclearProgramArchitecture(TaskMonitor monitor) Clear the program architecture setting and all architecture-specific data from this archive.voidClear undo/redo stack.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 voiddeleteDataTypesUsed(Set<Long> deletedIds) Allow extensions to perform any neccessary fixups for all datatype removals listed.booleanendTransaction(int transactionID, boolean commit) Ends the current transaction.protected voidfavoritesChanged(DataType dataType, boolean isFavorite) voidForce all pending notification events to be flushedGet all transaction names that are available within theStandAloneDataTypeManager.redo()stack.Get all transaction names that are available within theStandAloneDataTypeManager.undo()stack.getName()Returns this data type manager's namegetPath()Get the path name associated with the storage of this stand alone datatype manager.Get the transaction name that is available forStandAloneDataTypeManager.redo()(seeStandAloneDataTypeManager.canRedo()).getType()Returns this manager's archive typeGet the transaction name that is available forStandAloneDataTypeManager.undo()(seeStandAloneDataTypeManager.canUndo()).protected voidopenTransaction(String description) Open new transaction.voidredo()protected voidreplaceDataTypesUsed(Map<Long, Long> dataTypeReplacementMap) Allow extensions to perform any neccessary fixups to address all datatype replacements.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.voidundo()Methods inherited from class ghidra.program.model.data.StandAloneDataTypeManager
finalize, getProgramArchitectureSummary, getTransactionCount, getWarning, getWarningDetail, getWarningMessage, handleDataOrganizationChange, initializeOtherAdapters, isArchitectureChangeAllowed, isProgramArchitectureMissing, isProgramArchitectureUpgradeRequired, logWarning, setImmutable, setProgramArchitectureMethods inherited from class ghidra.program.database.data.DataTypeManagerDB
addDataType, addDataTypeManagerListener, addDataTypes, addDataTypeToDelete, addDataTypeToReplace, addInvalidatedListener, allowsDefaultBuiltInSettings, allowsDefaultComponentSettings, associateDataTypeWithArchive, compilerSpecChanged, contains, containsCategory, createCategory, dataTypeSettingsChanged, dbError, dedupeAllConflicts, dedupeConflicts, disassociate, dispose, doSourceArchiveUpdates, findDataType, findDataTypeForID, findDataTypes, findDataTypes, findEnumValueNames, fixupComposites, getAddressMap, getAllComposites, getAllDataTypes, getAllDataTypes, getAllFunctionDefinitions, getAllStructures, getCallingConvention, getCallingConventionID, getCallingConventionName, getCategory, getCategory, getCategoryCount, getChildIds, 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, hasParent, invalidateCache, isChanged, isCreatingDataType, isFavorite, isTransactionActive, isUpdatable, migrateOldFlexArrayComponentsIfRequired, notifyRestored, readDataOrganization, remove, removeDataTypeManagerListener, removeInvalidatedListener, removeParentChildRecord, 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, withTransaction, withTransaction
-
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
-
replaceDataTypesUsed
Description copied from class:DataTypeManagerDBAllow extensions to perform any neccessary fixups to address all datatype replacements.- Overrides:
replaceDataTypesUsedin classStandAloneDataTypeManager- Parameters:
dataTypeReplacementMap- map of datatype replacements (oldID maps to replacementID).
-
deleteDataTypesUsed
Description copied from class:DataTypeManagerDBAllow extensions to perform any neccessary fixups for all datatype removals listed.- Overrides:
deleteDataTypesUsedin classStandAloneDataTypeManager- Parameters:
deletedIds- list of IDs for all datatypes which are getting removed.
-
initTransactionState
protected void initTransactionState()- Overrides:
initTransactionStatein classStandAloneDataTypeManager
-
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
-
endTransaction
public boolean endTransaction(int transactionID, boolean commit) Description copied from interface:DataTypeManagerEnds the current transaction.NOTE: If multiple transactions are outstanding the full transaction will not be ended until all transactions have been ended. If any of the transactions indicate a false for
committhe transaction will ultimately be rolled-back when the final transaction is ended.NOTE: Use of rollback (
commit=falseshould be avoided unless absolutely neccessary since it will incur overhead to revert changes and may rollback multiple concurrent transactions if they exist.NOTE: If this manager is part of a larger
DomainObjectits transactions may become entangled with other transactions at a higher level. In such cases, use of theDomainObjecttransaction interface is preferred. The return value from this method cannot be relied on in such cases.- 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 should be rolled back.- Returns:
- true if this invocation was the final transaction and all changes were comitted.
-
undo
public void undo()- Overrides:
undoin classStandAloneDataTypeManager
-
redo
public void redo()- Overrides:
redoin classStandAloneDataTypeManager
-
clearUndo
public void clearUndo()Description copied from class:StandAloneDataTypeManagerClear undo/redo stack.
NOTE: It is important that this always be invoked following any save operation that compacts the checkpoints within the databaseBufferMgr.- Overrides:
clearUndoin classStandAloneDataTypeManager
-
canRedo
public boolean canRedo()Description copied from class:StandAloneDataTypeManagerDetermine if there is a transaction previously undone (seeStandAloneDataTypeManager.undo()) that can be redone (seeStandAloneDataTypeManager.redo()).- Overrides:
canRedoin classStandAloneDataTypeManager- Returns:
- true if there is a transaction previously undone that can be redone, else false
-
canUndo
public boolean canUndo()Description copied from class:StandAloneDataTypeManagerDetermine if there is a previous transaction that can be reverted/undone (seeStandAloneDataTypeManager.undo()).- Overrides:
canUndoin classStandAloneDataTypeManager- Returns:
- true if there is a previous transaction that can be reverted/undone, else false.
-
getRedoName
Description copied from class:StandAloneDataTypeManagerGet the transaction name that is available forStandAloneDataTypeManager.redo()(seeStandAloneDataTypeManager.canRedo()).- Overrides:
getRedoNamein classStandAloneDataTypeManager- Returns:
- transaction name that is available for
StandAloneDataTypeManager.redo()or empty String.
-
getUndoName
Description copied from class:StandAloneDataTypeManagerGet the transaction name that is available forStandAloneDataTypeManager.undo()(seeStandAloneDataTypeManager.canUndo()).- Overrides:
getUndoNamein classStandAloneDataTypeManager- Returns:
- transaction name that is available for
StandAloneDataTypeManager.undo()or empty String.
-
getAllUndoNames
Description copied from class:StandAloneDataTypeManagerGet all transaction names that are available within theStandAloneDataTypeManager.undo()stack.- Overrides:
getAllUndoNamesin classStandAloneDataTypeManager- Returns:
- all transaction names that are available within the
StandAloneDataTypeManager.undo()stack.
-
getAllRedoNames
Description copied from class:StandAloneDataTypeManagerGet all transaction names that are available within theStandAloneDataTypeManager.redo()stack.- Overrides:
getAllRedoNamesin classStandAloneDataTypeManager- Returns:
- all transaction names that are available within the
StandAloneDataTypeManager.redo()stack.
-
flushEvents
public void flushEvents()Description copied from interface:DataTypeManagerForce all pending notification events to be flushed- Specified by:
flushEventsin interfaceDataTypeManager- Overrides:
flushEventsin classStandAloneDataTypeManager
-
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
public void archiveReady(OpenMode openMode, TaskMonitor monitor) throws IOException, CancelledException - 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
-