Package ghidra.plugins.fsbrowser
Class FSBNode
java.lang.Object
docking.widgets.tree.GTreeNode
docking.widgets.tree.GTreeLazyNode
docking.widgets.tree.GTreeSlowLoadingNode
ghidra.plugins.fsbrowser.FSBNode
- All Implemented Interfaces:
Cloneable
,Comparable<GTreeNode>
- Direct Known Subclasses:
FSBFileNode
,FSBRootNode
Base class for all filesystem browser gtree nodes.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionchildren()
clone()
Creates a clone of this node.static FSBFileNode
createNodeFromFile
(GFile file, TaskMonitor monitor) Helper method to convert a singleGFile
object into a FSBNode object.createNodesFromFileList
(List<GFile> files, TaskMonitor monitor) Helper method to convertGFile
objects to FSBNode objects.void
dispose()
protected void
Adds a node to this node's children at the given index and notifies the tree.protected void
Adds a node to this node's children.protected void
doAddNodes
(List<GTreeNode> nodes) Adds the given nodes to this node's children.protected void
doFireNodeAdded
(GTreeNode newNode) protected void
protected void
doFireNodeRemoved
(GTreeNode removedNode, int index) protected void
protected void
doRemoveNode
(GTreeNode node) Removes the node from this node's children and notifies the tree.protected void
doSetChildren
(List<GTreeNode> childList) Sets the children of this node to the given list of child nodes, but does not notify the tree.protected void
doSetChildrenAndFireEvent
(List<GTreeNode> childList) Sets the children of this node to the given list of child nodes and fires the appropriate tree event to kick the tree to update the display.static FSBRootNode
Returns theFSBRootNode
that represents the root of the file system that contains the specified file node.protected FSBFileNode
findMatchingNode
(GFile f, TaskMonitor monitor) abstract FSRL
getFSRL()
Returns theFSRL
of the filesystem object that this node represents.getGFile()
getIcon
(boolean expanded) Returns the Icon to be displayed for this node in the treeabstract FSRL
getName()
Returns the name of the node.final GTreeNode
Returns the parent of this node.Returns the string to be displayed as a tooltip when the user hovers the mouse on this node in the treegetTree()
Returns the GTree that this node is attached tovoid
init
(TaskMonitor monitor) final boolean
Returns true if the node is in the process of loading its children.boolean
isLoaded()
True if the children for this node have been loaded yet.final boolean
isRoot()
Returns true if this is a root node of a GTreeprotected void
loadChildrenIfNeeded
(TaskMonitor monitor) protected void
refreshChildren
(TaskMonitor monitor) abstract void
refreshNode
(TaskMonitor monitor) Methods inherited from class docking.widgets.tree.GTreeSlowLoadingNode
generateChildren, generateChildren, loadAll
Methods inherited from class docking.widgets.tree.GTreeLazyNode
addNode, addNode, addNodes, removeAll, removeNode, unloadChildren
Methods inherited from class docking.widgets.tree.GTreeNode
collapse, compareTo, equals, expand, filter, fireNodeChanged, fireNodeStructureChanged, getChild, getChild, getChild, getChildCount, getChildren, getDisplayText, getIndexInParent, getIndexOfChild, getLeafCount, getNodeCount, getRoot, getTreePath, hashCode, isAncestor, isAutoExpandPermitted, isEditable, isExpanded, isLeaf, iterator, setChildren, stream, toString, valueChanged
-
Field Details
-
FSBNODE_NAME_TYPE_COMPARATOR
-
-
Constructor Details
-
FSBNode
public FSBNode()
-
-
Method Details
-
getFSRL
Returns theFSRL
of the filesystem object that this node represents.The root of filesystems will return a
FSRLRoot
.- Returns:
FSRL
of the filesystem object.
-
init
- Throws:
CancelledException
-
getGFile
-
getToolTip
Description copied from class:GTreeNode
Returns the string to be displayed as a tooltip when the user hovers the mouse on this node in the tree- Specified by:
getToolTip
in classGTreeNode
- Returns:
- the tooltip to be displayed
-
getIcon
Description copied from class:GTreeNode
Returns the Icon to be displayed for this node in the tree -
getName
Description copied from class:GTreeNode
Returns the name of the node. IfGTreeNode.getDisplayText()
is not overridden, then this is also the text that will be displayed in the tree for that node. In general, the name of a node should not change. If the text displayed in the tree changes over time, overrideGTreeNode.getDisplayText()
. -
getFSBRootNode
-
refreshNode
- Throws:
CancelledException
-
loadChildrenIfNeeded
- Throws:
CancelledException
-
refreshChildren
- Throws:
CancelledException
-
findMatchingNode
- Throws:
CancelledException
-
getFormattedTreePath
-
getLoadableFSRL
-
findContainingFileSystemFSBRootNode
Returns theFSBRootNode
that represents the root of the file system that contains the specified file node.- Parameters:
node
- GTree node that represents a file.- Returns:
- FSBRootNode that represents the file system holding the file.
-
createNodesFromFileList
Helper method to convertGFile
objects to FSBNode objects.- Parameters:
files
-List
ofGFile
objects to convertmonitor
-TaskMonitor
- Returns:
List
ofFSBNode
instances (return typed as a GTreeNode list), specific to each GFile instance's type.
-
createNodeFromFile
Helper method to convert a singleGFile
object into a FSBNode object.- Parameters:
file
-GFile
to convert- Returns:
- a new
FSBFileNode
with type specific to the GFile's type.
-
getParent
Returns the parent of this node. Note: this method is deliberately not synchronized (See comments above)- Returns:
- the parent of this node.
-
isRoot
public final boolean isRoot()Returns true if this is a root node of a GTree- Returns:
- true if this is a root node of a GTree
-
children
-
doSetChildrenAndFireEvent
Sets the children of this node to the given list of child nodes and fires the appropriate tree event to kick the tree to update the display. Note: This method must be called from the swing thread because it will notify the underlying JTree.- Parameters:
childList
- the list of child nodes to assign as children to this node- See Also:
-
doSetChildren
Sets the children of this node to the given list of child nodes, but does not notify the tree. This method does not have to be called from the swing thread. It is intended to be used by background threads that want to populate all or part of the tree, but wait until the bulk operations are completed before notifying the tree.- Parameters:
childList
- the list of child nodes to assign as children to this node
-
doAddNode
Adds a node to this node's children. Must be called from the swing thread.- Parameters:
node
- the node to add as a child to this node
-
doAddNode
Adds a node to this node's children at the given index and notifies the tree. Must be called from the swing thread.- Parameters:
index
- the index at which to add the new nodenode
- the node to add as a child to this node
-
doRemoveNode
Removes the node from this node's children and notifies the tree. Must be called from the swing thread.- Parameters:
node
- the node to remove
-
doAddNodes
Adds the given nodes to this node's children. Must be called from the swing thread.- Parameters:
nodes
- the nodes to add to the children this node
-
clone
Creates a clone of this node. The clone should contain a shallow copy of all the node's attributes except that the parent and children are null.- Overrides:
clone
in classObject
- Returns:
- the clone of this object.
- Throws:
CloneNotSupportedException
- if some implementation prevents itself from being cloned.
-
dispose
public void dispose() -
isInProgress
public final boolean isInProgress()Returns true if the node is in the process of loading its children. SeeGTreeSlowLoadingNode
- Returns:
- true if the node is in the process of loading its children.
-
isLoaded
public boolean isLoaded()True if the children for this node have been loaded yet. Some GTree nodes are lazy in that they don't load their children until needed. Nodes that have the IN_PROGRESS node as it child is considered loaded if in the swing thread, otherwise they are considered not loaded.- Returns:
- true if the children for this node have been loaded.
-
getTree
Returns the GTree that this node is attached to- Returns:
- the GTree that this node is attached to
-
doFireNodeAdded
-
doFireNodeRemoved
-
doFireNodeStructureChanged
protected void doFireNodeStructureChanged() -
doFireNodeChanged
protected void doFireNodeChanged()
-