Package ghidra.framework.data
Class LinkedGhidraFolder
java.lang.Object
ghidra.framework.data.LinkedGhidraFolder
- All Implemented Interfaces:
DomainFolder
,LinkedDomainFolder
,Comparable<DomainFolder>
LinkedGhidraFolder
provides the base LinkedDomainFolder
implementation which
corresponds to a project folder-link (see FolderLinkContentHandler
).-
Field Summary
Fields inherited from interface ghidra.framework.model.DomainFolder
CLOSED_FOLDER_ICON, COPY_SUFFIX, OPEN_FOLDER_ICON, SEPARATOR
-
Method Summary
Modifier and TypeMethodDescriptionint
copyTo
(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 name, DomainObject obj, TaskMonitor monitor) Add a domain object to this folder.createFile
(String name, File packFile, TaskMonitor monitor) Add a new domain file to this folder.createFolder
(String name) Create a subfolder within this folder.void
delete()
Deletes this folder, if empty, from the local filesystemGet the domain file in this folder with the given name.getFiles()
Get all domain files in this folder.ghidra.framework.data.LinkedGhidraSubFolder
Return the folder for the given name.ghidra.framework.data.LinkedGhidraSubFolder[]
Get DomainFolders in this folder.getIcon
(boolean isOpen) Get the appropriate icon for this foldergetLinkedFileNoError
(String name) Get the true file within this linked folder.Get the real domain folder which corresponds to this linked-folder.Get the pathname of this folder within the linked-project/repositoryGet 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 the Ghidra URL of the project/repository folder referenced by this objectGet a remote Ghidra URL for this domain folder if available within an associated shared project repository.boolean
isEmpty()
Determine if this folder contains any sub-folders or domain files.boolean
Returns true if this file is in a writable project.boolean
isLinked()
Determine if this folder corresponds to a linked-folder.moveTo
(DomainFolder newParent) Move this folder into the newParent folder.void
Allows the framework to react to a request to make this folder the "active" one.Set the name on this domain folder.toString()
-
Field Details
-
FOLDER_LINK_CLOSED_ICON
-
FOLDER_LINK_OPEN_ICON
-
-
Method Details
-
getProjectURL
Get the Ghidra URL of the project/repository folder referenced by this object- Returns:
- Ghidra URL of the project/repository folder referenced by this object
-
getLinkedPathname
Get the pathname of this folder within the linked-project/repository- Returns:
- absolute linked folder path within the linked-project/repository
-
getProjectLocator
Description copied from interface:DomainFolder
Returns the local storage location for the project that this DomainFolder belongs to.- Specified by:
getProjectLocator
in interfaceDomainFolder
- Returns:
- the locator
-
getProjectData
Description copied from interface:DomainFolder
Returns the project data- Specified by:
getProjectData
in interfaceDomainFolder
- Returns:
- the project data
-
getParent
Description copied from interface:DomainFolder
Return parent folder or null if this DomainFolder is the root folder.- Specified by:
getParent
in interfaceDomainFolder
- Returns:
- the parent
-
toString
-
getIcon
Description copied from interface:LinkedDomainFolder
Get the appropriate icon for this folder- Specified by:
getIcon
in interfaceLinkedDomainFolder
- Parameters:
isOpen
- true if open icon, false for closed- Returns:
- folder icon
-
isLinked
public boolean isLinked()Description copied from interface:DomainFolder
Determine if this folder corresponds to a linked-folder.- Returns:
- true if folder corresponds to a linked-folder, else false.
-
isInWritableProject
public boolean isInWritableProject()Description copied from interface:DomainFolder
Returns true if this file is in a writable project.- Specified by:
isInWritableProject
in interfaceDomainFolder
- Returns:
- true if writable
-
getName
Description copied from interface:DomainFolder
Return this folder's name.- Specified by:
getName
in interfaceDomainFolder
- Returns:
- the name
-
getLinkedFolder
Description copied from interface:LinkedDomainFolder
Get the real domain folder which corresponds to this linked-folder.- Specified by:
getLinkedFolder
in interfaceLinkedDomainFolder
- Returns:
- domain folder
- Throws:
IOException
- if an IO error occurs
-
compareTo
- Specified by:
compareTo
in interfaceComparable<DomainFolder>
-
setName
Description copied from interface:DomainFolder
Set the name on this domain folder.- Specified by:
setName
in 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.
-
getLocalProjectURL
Description copied from interface:DomainFolder
Get 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:
getLocalProjectURL
in interfaceDomainFolder
- Returns:
- local Ghidra URL for this folder or null if transient or not applicable
-
getPathname
Description copied from interface:DomainFolder
Returns the full path name to this folder- Specified by:
getPathname
in interfaceDomainFolder
- Returns:
- the path name
-
getFolders
public ghidra.framework.data.LinkedGhidraSubFolder[] getFolders()Description copied from interface:DomainFolder
Get DomainFolders in this folder. This may return cached information and does not force a full refresh.- Specified by:
getFolders
in interfaceDomainFolder
- Returns:
- list of sub-folders
-
getFolder
Description copied from interface:DomainFolder
Return the folder for the given name.- Specified by:
getFolder
in interfaceDomainFolder
- Parameters:
name
- of folder to retrieve- Returns:
- folder or null if there is no folder by the given name.
-
getFiles
Description copied from interface:DomainFolder
Get all domain files in this folder. This may return cached information and does not force a full refresh.- Specified by:
getFiles
in interfaceDomainFolder
- Returns:
- list of domain files
-
getLinkedFileNoError
Get the true file within this linked folder.- Parameters:
name
- file name- Returns:
- file or null if not found or error occurs
-
getFile
Description copied from interface:DomainFolder
Get the domain file in this folder with the given name.- Specified by:
getFile
in interfaceDomainFolder
- 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
public boolean isEmpty()Description copied from interface:DomainFolder
Determine if this folder contains any sub-folders or domain files.- Specified by:
isEmpty
in interfaceDomainFolder
- Returns:
- true if this folder is empty.
-
createFile
public DomainFile createFile(String name, DomainObject obj, TaskMonitor monitor) throws InvalidNameException, IOException, CancelledException Description copied from interface:DomainFolder
Add a domain object to this folder.- Specified by:
createFile
in interfaceDomainFolder
- 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:
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 name, File packFile, TaskMonitor monitor) throws InvalidNameException, IOException, CancelledException Description copied from interface:DomainFolder
Add a new domain file to this folder.- Specified by:
createFile
in interfaceDomainFolder
- 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:
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:DomainFolder
Create a subfolder within this folder.- Specified by:
createFolder
in interfaceDomainFolder
- Parameters:
name
- 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:DomainFolder
Deletes this folder, if empty, from the local filesystem- Specified by:
delete
in interfaceDomainFolder
- Throws:
IOException
- if IO or access error occurs
-
moveTo
Description copied from interface:DomainFolder
Move 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:
moveTo
in 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 DomainFolder copyTo(DomainFolder newParent, TaskMonitor monitor) throws IOException, CancelledException Description copied from interface:DomainFolder
Copy this folder into the newParent folder.- Specified by:
copyTo
in 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:DomainFolder
Create 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:
copyToAsLink
in 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:DomainFolder
Allows the framework to react to a request to make this folder the "active" one.- Specified by:
setActive
in interfaceDomainFolder
-