Package ghidra.framework.data
Class GhidraFolder
java.lang.Object
ghidra.framework.data.GhidraFolder
- All Implemented Interfaces:
DomainFolder,Comparable<DomainFolder>
- Direct Known Subclasses:
RootGhidraFolder
-
Field Summary
Fields inherited from interface ghidra.framework.model.DomainFolder
CLOSED_FOLDER_ICON, COPY_SUFFIX, OPEN_FOLDER_ICON, SEPARATOR -
Method Summary
Modifier and TypeMethodDescriptionintcopyTo(DomainFolder newParent, TaskMonitor monitor) Copy this folder into the newParent folder.copyToAsLink(DomainFolder newParent) Create a new link-file in the specified newParent which will reference this folder (i.e., linked-folder).createFile(String fileName, DomainObject obj, TaskMonitor monitor) Add a domain object to this folder.createFile(String fileName, File packFile, TaskMonitor monitor) Add a new domain file to this folder.createFolder(String folderName) Create a subfolder within this folder.voiddelete()Deletes this folder, if empty, from the local filesystembooleanGet the domain file in this folder with the given name.getFiles()Get all domain files in this folder.Return the folder for the given name.Get DomainFolders in this folder.Get a local Ghidra URL for this domain file if available within the associated non-transient local project.getName()Return this folder's name.Return parent folder or null if this DomainFolder is the root folder.Returns the full path name to this folderReturns the project dataReturns the local storage location for the project that this DomainFolder belongs to.Get a remote Ghidra URL for this domain folder if available within an associated shared project repository.inthashCode()booleanisEmpty()Determine if this folder contains any sub-folders or domain files.booleanReturns true if this file is in a writable project.moveTo(DomainFolder newParent) Move this folder into the newParent folder.voidAllows the framework to react to a request to make this folder the "active" one.Set the name on this domain folder.toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface ghidra.framework.model.DomainFolder
isLinked
-
Method Details
-
compareTo
- Specified by:
compareToin interfaceComparable<DomainFolder>
-
getName
Description copied from interface:DomainFolderReturn this folder's name.- Specified by:
getNamein interfaceDomainFolder- Returns:
- the name
-
setName
Description copied from interface:DomainFolderSet the name on this domain folder.- Specified by:
setNamein interfaceDomainFolder- Parameters:
newName- domain folder name- Returns:
- renamed domain file (the original DomainFolder object becomes invalid since it is immutable)
- Throws:
InvalidNameException- if newName contains illegal charactersIOException- thrown if an IO or access error occurs.
-
getProjectLocator
Description copied from interface:DomainFolderReturns the local storage location for the project that this DomainFolder belongs to.- Specified by:
getProjectLocatorin interfaceDomainFolder- Returns:
- the locator
-
getProjectData
Description copied from interface:DomainFolderReturns the project data- Specified by:
getProjectDatain interfaceDomainFolder- Returns:
- the project data
-
getPathname
Description copied from interface:DomainFolderReturns the full path name to this folder- Specified by:
getPathnamein interfaceDomainFolder- Returns:
- the path name
-
getLocalProjectURL
Description copied from interface:DomainFolderGet a local Ghidra URL for this domain file if available within the associated non-transient local project. A null value will be returned if project is transient.- Specified by:
getLocalProjectURLin interfaceDomainFolder- Returns:
- local Ghidra URL for this folder or null if transient or not applicable
-
isInWritableProject
public boolean isInWritableProject()Description copied from interface:DomainFolderReturns true if this file is in a writable project.- Specified by:
isInWritableProjectin interfaceDomainFolder- Returns:
- true if writable
-
getParent
Description copied from interface:DomainFolderReturn parent folder or null if this DomainFolder is the root folder.- Specified by:
getParentin interfaceDomainFolder- Returns:
- the parent
-
getFolders
Description copied from interface:DomainFolderGet DomainFolders in this folder. This may return cached information and does not force a full refresh.- Specified by:
getFoldersin interfaceDomainFolder- Returns:
- list of sub-folders
-
getFolder
Description copied from interface:DomainFolderReturn the folder for the given name.- Specified by:
getFolderin interfaceDomainFolder- Parameters:
folderName- of folder to retrieve- Returns:
- folder or null if there is no folder by the given name.
-
isEmpty
public boolean isEmpty()Description copied from interface:DomainFolderDetermine if this folder contains any sub-folders or domain files.- Specified by:
isEmptyin interfaceDomainFolder- Returns:
- true if this folder is empty.
-
getFiles
Description copied from interface:DomainFolderGet all domain files in this folder. This may return cached information and does not force a full refresh.- Specified by:
getFilesin interfaceDomainFolder- Returns:
- list of domain files
-
getFile
Description copied from interface:DomainFolderGet the domain file in this folder with the given name.- Specified by:
getFilein interfaceDomainFolder- Parameters:
fileName- name of file in this folder to retrieve- Returns:
- domain file or null if there is no domain file in this folder with the given name.
-
createFile
public DomainFile createFile(String fileName, DomainObject obj, TaskMonitor monitor) throws InvalidNameException, IOException, CancelledException Description copied from interface:DomainFolderAdd a domain object to this folder.- Specified by:
createFilein interfaceDomainFolder- Parameters:
fileName- domain file nameobj- domain object to be storedmonitor- progress monitor- Returns:
- domain file created as a result of adding the domain object to this folder
- Throws:
InvalidNameException- if name is an empty string or if it contains characters other than alphanumerics.IOException- if IO or access error occursCancelledException- if the user cancels the create.
-
createFile
public DomainFile createFile(String fileName, File packFile, TaskMonitor monitor) throws InvalidNameException, IOException, CancelledException Description copied from interface:DomainFolderAdd a new domain file to this folder.- Specified by:
createFilein interfaceDomainFolder- Parameters:
fileName- domain file namepackFile- packed file containing domain file datamonitor- progress monitor- Returns:
- domain file created as a result of adding the domain object to this folder
- Throws:
InvalidNameException- if name is an empty string or if it contains characters other than alphanumerics.IOException- if IO or access error occursCancelledException- if the user cancels the create.
-
createFolder
Description copied from interface:DomainFolderCreate a subfolder within this folder.- Specified by:
createFolderin interfaceDomainFolder- Parameters:
folderName- sub-folder name- Returns:
- the new folder
- Throws:
InvalidNameException- if name is an empty string of if it contains characters other than alphanumerics.IOException- if IO or access error occurs
-
delete
Description copied from interface:DomainFolderDeletes this folder, if empty, from the local filesystem- Specified by:
deletein interfaceDomainFolder- Throws:
IOException- if IO or access error occurs
-
moveTo
Description copied from interface:DomainFolderMove this folder into the newParent folder. If connected to a repository this moves both private and repository folders/files. If not connected, only private folders/files are moved.- Specified by:
moveToin interfaceDomainFolder- Parameters:
newParent- new parent folder within the same project- Returns:
- the newly relocated folder (the original DomainFolder object becomes invalid since it is immutable)
- Throws:
IOException- thrown if an IO or access error occurs.
-
copyTo
public GhidraFolder copyTo(DomainFolder newParent, TaskMonitor monitor) throws IOException, CancelledException Description copied from interface:DomainFolderCopy this folder into the newParent folder.- Specified by:
copyToin interfaceDomainFolder- Parameters:
newParent- new parent foldermonitor- the task monitor- Returns:
- the new copied folder
- Throws:
IOException- thrown if an IO or access error occurs.CancelledException- if task monitor cancelled operation.
-
copyToAsLink
Description copied from interface:DomainFolderCreate a new link-file in the specified newParent which will reference this folder (i.e., linked-folder). Restrictions:- Specified newParent must reside within a different project since internal linking is not currently supported.
- Specified by:
copyToAsLinkin interfaceDomainFolder- Parameters:
newParent- new parent folder where link-file is to be created- Returns:
- newly created domain file (i.e., link-file) or null if link use not supported.
- Throws:
IOException- if an IO or access error occurs.
-
setActive
public void setActive()Description copied from interface:DomainFolderAllows the framework to react to a request to make this folder the "active" one.- Specified by:
setActivein interfaceDomainFolder
-
equals
-
hashCode
public int hashCode() -
toString
-