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:
java.lang.Cloneable,java.lang.Comparable<GTreeNode>
- Direct Known Subclasses:
FSBDirNode,FSBFileNode,FSBRootNode
public abstract class FSBNode extends GTreeSlowLoadingNode
Base interface for all filesystem browser gtree nodes.
-
-
Constructor Summary
Constructors Constructor Description FSBNode()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected java.util.List<GTreeNode>children()GTreeNodeclone()Creates a clone of this node.voiddispose()protected voiddoAddNode(int index, GTreeNode node)Adds a node to this node's children at the given index and notifies the tree.protected voiddoAddNode(GTreeNode node)Adds a node to this node's children.protected voiddoAddNodes(java.util.List<GTreeNode> nodes)Adds the given nodes to this node's children.protected voiddoFireNodeAdded(GTreeNode newNode)protected voiddoFireNodeChanged()protected voiddoFireNodeRemoved(GTreeNode removedNode, int index)protected voiddoFireNodeStructureChanged()protected voiddoRemoveNode(GTreeNode node)Removes the node from this node's children and notifies the tree.protected voiddoSetChildren(java.util.List<GTreeNode> childList)Sets the children of this node to the given list of child nodes, but does not notify the tree.protected voiddoSetChildrenAndFireEvent(java.util.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 FSBRootNodefindContainingFileSystemFSBRootNode(FSBNode node)Returns theFSBRootNodethat represents the root of the file system that contains the specified file node.abstract FSRLgetFSRL()Returns theFSRLof the filesystem object that this node represents.static FSBNodegetNodeFromFile(GFile file)Helper method to convert a singleGFileobject into a FSBNode object.static java.util.List<GTreeNode>getNodesFromFileList(java.util.List<GFile> files)Helper method to convertGFileobjects to FSBNode objects.GTreeNodegetParent()Returns the parent of this node.GTreegetTree()Returns the GTree that this node is attached tobooleanisInProgress()Returns true if the node is in the process of loading its children.booleanisLoaded()True if the children for this node have been loaded yet.-
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, getChildCount, getChildren, getDisplayText, getIcon, getIndexInParent, getIndexOfChild, getLeafCount, getName, getNodeCount, getRoot, getToolTip, getTreePath, hashCode, isAncestor, isEditable, isExpanded, isLeaf, isRoot, iterator, setChildren, stream, toString, valueChanged
-
-
-
-
Method Detail
-
getFSRL
public abstract FSRL getFSRL()
Returns theFSRLof the filesystem object that this node represents.The root of filesystems will return a
FSRLRoot.- Returns:
FSRLof the filesystem object.
-
findContainingFileSystemFSBRootNode
public static FSBRootNode findContainingFileSystemFSBRootNode(FSBNode node)
Returns theFSBRootNodethat 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.
-
getNodesFromFileList
public static java.util.List<GTreeNode> getNodesFromFileList(java.util.List<GFile> files)
Helper method to convertGFileobjects to FSBNode objects.
-
getNodeFromFile
public static FSBNode getNodeFromFile(GFile file)
Helper method to convert a singleGFileobject into a FSBNode object.
-
getParent
public final GTreeNode getParent()
Returns the parent of this node. Note: this method is deliberately not synchronized (See comments above)- Returns:
- the parent of this node.
-
children
protected final java.util.List<GTreeNode> children()
-
doSetChildrenAndFireEvent
protected void doSetChildrenAndFireEvent(java.util.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. 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:
if calling from a background thread.
-
doSetChildren
protected void doSetChildren(java.util.List<GTreeNode> childList)
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
protected void doAddNode(GTreeNode node)
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
protected void doAddNode(int index, GTreeNode node)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
protected void doRemoveNode(GTreeNode node)
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
protected void doAddNodes(java.util.List<GTreeNode> nodes)
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
public GTreeNode clone() throws java.lang.CloneNotSupportedException
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:
clonein classjava.lang.Object- Returns:
- the clone of this object.
- Throws:
java.lang.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
public GTree getTree()
Returns the GTree that this node is attached to- Returns:
- the GTree that this node is attached to
-
doFireNodeAdded
protected void doFireNodeAdded(GTreeNode newNode)
-
doFireNodeRemoved
protected void doFireNodeRemoved(GTreeNode removedNode, int index)
-
doFireNodeStructureChanged
protected void doFireNodeStructureChanged()
-
doFireNodeChanged
protected void doFireNodeChanged()
-
-