Package ghidra.framework.model
Interface DomainFolder
-
- All Superinterfaces:
java.lang.Comparable<DomainFolder>
- All Known Implementing Classes:
GhidraFolder
,RootGhidraFolder
public interface DomainFolder extends java.lang.Comparable<DomainFolder>
DomainFolder
provides a storage interface for project folders. ADomainFolder
is an immutable reference to a folder contained within a project. The state of aDomainFolder
object does not track name/parent changes made to the referenced project folder.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
COPY_SUFFIX
Name extension to add when attempting to avoid a duplicate name.static java.lang.String
SEPARATOR
Character used to separate folder and item names within a path string.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description DomainFolder
copyTo(DomainFolder newParent, TaskMonitor monitor)
Copy this folder into the newParent folder.DomainFile
createFile(java.lang.String name, DomainObject obj, TaskMonitor monitor)
Add a domain object to this folder.DomainFile
createFile(java.lang.String name, java.io.File packFile, TaskMonitor monitor)
Add a new domain file to this folder.DomainFolder
createFolder(java.lang.String folderName)
Create a subfolder of this folder.void
delete()
Deletes this folder and all of its contentsDomainFile
getFile(java.lang.String name)
Get the domain file in this folder with the given name.DomainFile[]
getFiles()
Get all domain files in this folder.DomainFolder
getFolder(java.lang.String name)
Return the folder for the given name.DomainFolder[]
getFolders()
Get DomainFolders in this folder.java.lang.String
getName()
Return this folder's name.DomainFolder
getParent()
Return parent folder or null if this DomainFolder is the root folder.java.lang.String
getPathname()
Returns the path name to the domain object.ProjectData
getProjectData()
ProjectLocator
getProjectLocator()
Returns the local storage location for the project that this DomainFolder belongs to.boolean
isEmpty()
Determine if this folder contains any sub-folders or domain files.boolean
isInWritableProject()
Returns true if this file is in a writable project.DomainFolder
moveTo(DomainFolder newParent)
Move this folder into the newParent folder.void
setActive()
Allows the framework to react to a request to make this folder the "active" one.DomainFolder
setName(java.lang.String newName)
Set the name on this domain folder.
-
-
-
Field Detail
-
SEPARATOR
static final java.lang.String SEPARATOR
Character used to separate folder and item names within a path string.- See Also:
- Constant Field Values
-
COPY_SUFFIX
static final java.lang.String COPY_SUFFIX
Name extension to add when attempting to avoid a duplicate name.- See Also:
- Constant Field Values
-
-
Method Detail
-
getName
java.lang.String getName()
Return this folder's name.
-
setName
DomainFolder setName(java.lang.String newName) throws InvalidNameException, java.io.IOException
Set the name on this domain folder.- 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 charactersDuplicateFileException
- if a folder named newName already exists in this files domain folder.FileInUseException
- if any file within this folder or its decendents is in-use / checked-out.java.io.IOException
- thrown if an IO or access error occurs.
-
getProjectLocator
ProjectLocator getProjectLocator()
Returns the local storage location for the project that this DomainFolder belongs to.
-
getProjectData
ProjectData getProjectData()
-
getPathname
java.lang.String getPathname()
Returns the path name to the domain object.
-
isInWritableProject
boolean isInWritableProject()
Returns true if this file is in a writable project.
-
getParent
DomainFolder getParent()
Return parent folder or null if this DomainFolder is the root folder.
-
getFolders
DomainFolder[] getFolders()
Get DomainFolders in this folder. This returns cached information and does not force a full refresh.- Returns:
- list of sub-folders
-
getFolder
DomainFolder getFolder(java.lang.String name)
Return the folder for the given name.- Parameters:
name
- of folder to retrieve- Returns:
- folder or null if there is no folder by the given name.
-
getFile
DomainFile getFile(java.lang.String name)
Get the domain file in this folder with the given name.- Parameters:
name
- 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.
-
isEmpty
boolean isEmpty()
Determine if this folder contains any sub-folders or domain files.- Returns:
- true if this folder is empty.
-
getFiles
DomainFile[] getFiles()
Get all domain files in this folder. This returns cached information and does not force a full refresh.- Returns:
- list of domain files
-
createFile
DomainFile createFile(java.lang.String name, DomainObject obj, TaskMonitor monitor) throws InvalidNameException, java.io.IOException, CancelledException
Add a domain object to this folder.- Parameters:
name
- 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:
DuplicateFileException
- thrown if the file name already existsInvalidNameException
- if name is an empty string or if it contains characters other than alphanumerics.java.io.IOException
- if IO or access error occursCancelledException
- if the user cancels the create.
-
createFile
DomainFile createFile(java.lang.String name, java.io.File packFile, TaskMonitor monitor) throws InvalidNameException, java.io.IOException, CancelledException
Add a new domain file to this folder.- Parameters:
name
- 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:
DuplicateFileException
- thrown if the file name already existsInvalidNameException
- if name is an empty string or if it contains characters other than alphanumerics.java.io.IOException
- if IO or access error occursCancelledException
- if the user cancels the create.
-
createFolder
DomainFolder createFolder(java.lang.String folderName) throws InvalidNameException, java.io.IOException
Create a subfolder of this folder.- Parameters:
folderName
- sub-folder name- Throws:
DuplicateFileException
- if a folder by this name already existsInvalidNameException
- if name is an empty string of if it contains characters other than alphanumerics.java.io.IOException
- if IO or access error occurs
-
delete
void delete() throws java.io.IOException
Deletes this folder and all of its contents- Throws:
java.io.IOException
- if IO or access error occursFolderNotEmptyException
- Thrown if the subfolder is not empty.
-
moveTo
DomainFolder moveTo(DomainFolder newParent) throws java.io.IOException
Move this folder into the newParent folder. If connected to an archive this affects both private and repository folders and files. If not connected, only private folders and files are affected.- 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:
DuplicateFileException
- if a folder with the same name already exists in newParent folder.FileInUseException
- if this folder or one of its decendents contains a file which is in-use / checked-out.java.io.IOException
- thrown if an IO or access error occurs.
-
copyTo
DomainFolder copyTo(DomainFolder newParent, TaskMonitor monitor) throws java.io.IOException, CancelledException
Copy this folder into the newParent folder.- Parameters:
newParent
- new parent foldernew
- folder- Throws:
DuplicateFileException
- if a folder or file by this name already exists in the newParent folderjava.io.IOException
- thrown if an IO or access error occurs.CancelledException
- if task monitor cancelled operation.
-
setActive
void setActive()
Allows the framework to react to a request to make this folder the "active" one.
-
-