Package ghidra.plugins.fsbrowser
Class FSBFileNode
- java.lang.Object
-
- docking.widgets.tree.GTreeNode
-
- docking.widgets.tree.GTreeLazyNode
-
- docking.widgets.tree.GTreeSlowLoadingNode
-
- ghidra.plugins.fsbrowser.FSBNode
-
- ghidra.plugins.fsbrowser.FSBFileNode
-
- All Implemented Interfaces:
java.lang.Cloneable
,java.lang.Comparable<GTreeNode>
- Direct Known Subclasses:
FSBDirNode
public class FSBFileNode extends FSBNode
GTreeNode that represents a file on a filesystem.
-
-
Field Summary
Fields Modifier and Type Field Description protected GFile
file
protected boolean
hasPassword
protected boolean
isEncrypted
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.List<GTreeNode>
children()
GTreeNode
clone()
Creates a clone of this node.void
dispose()
protected void
doAddNode(int index, GTreeNode node)
Adds a node to this node's children at the given index and notifies the tree.protected void
doAddNode(GTreeNode node)
Adds a node to this node's children.protected void
doAddNodes(java.util.List<GTreeNode> nodes)
Adds the given nodes to this node's children.protected void
doFireNodeAdded(GTreeNode newNode)
protected void
doFireNodeChanged()
protected void
doFireNodeRemoved(GTreeNode removedNode, int index)
protected void
doFireNodeStructureChanged()
protected void
doRemoveNode(GTreeNode node)
Removes the node from this node's children and notifies the tree.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.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.java.util.List<GTreeNode>
generateChildren(TaskMonitor monitor)
Subclass must implement this method to generate their children.FSRL
getFSRL()
Returns theFSRL
of the filesystem object that this node represents.GTreeNode
getParent()
Returns the parent of this node.GTree
getTree()
Returns the GTree that this node is attached toint
hashCode()
boolean
hasMissingPassword()
Returns true if this file is missing its passwordboolean
hasPassword()
Local copy of the original GFile'sFileAttributeType.HAS_GOOD_PASSWORD_ATTR
attribute.boolean
isEncrypted()
Local copy of the original GFile'sFileAttributeType.IS_ENCRYPTED_ATTR
attribute.boolean
isInProgress()
Returns true if the node is in the process of loading its children.boolean
isLeaf()
Returns true if this node never has childrenboolean
isLoaded()
True if the children for this node have been loaded yet.boolean
isRoot()
Returns true if this is a root node of a GTreeboolean
needsFileAttributesUpdate(TaskMonitor monitor)
Returns true if this node's password status has changed, calling for a complete refresh of the status of all files in the file system.protected void
updateFileAttributes(TaskMonitor monitor)
-
Methods inherited from class ghidra.plugins.fsbrowser.FSBNode
createNodeFromFile, createNodesFromFileList, findContainingFileSystemFSBRootNode, getFSBRootNode, getIcon, getName, getToolTip
-
Methods inherited from class docking.widgets.tree.GTreeSlowLoadingNode
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, getIndexInParent, getIndexOfChild, getLeafCount, getNodeCount, getRoot, getTreePath, isAncestor, isEditable, isExpanded, iterator, setChildren, stream, toString, valueChanged
-
-
-
-
Field Detail
-
file
protected GFile file
-
isEncrypted
protected boolean isEncrypted
-
hasPassword
protected boolean hasPassword
-
-
Method Detail
-
isLeaf
public boolean isLeaf()
Description copied from class:GTreeNode
Returns true if this node never has children
-
updateFileAttributes
protected void updateFileAttributes(TaskMonitor monitor)
- Specified by:
updateFileAttributes
in classFSBNode
-
generateChildren
public java.util.List<GTreeNode> generateChildren(TaskMonitor monitor) throws CancelledException
Description copied from class:GTreeSlowLoadingNode
Subclass must implement this method to generate their children. This operation will always be performed in a background thread (i.e. Not the swing thread)- Specified by:
generateChildren
in classGTreeSlowLoadingNode
- Parameters:
monitor
- a TaskMonitor for reporting progress and cancel notification.- Returns:
- the list of children for this node.
- Throws:
CancelledException
- if the monitor is cancelled
-
isEncrypted
public boolean isEncrypted()
Local copy of the original GFile'sFileAttributeType.IS_ENCRYPTED_ATTR
attribute.- Returns:
- boolean true if file needs a password to be read
-
hasPassword
public boolean hasPassword()
Local copy of the original GFile'sFileAttributeType.HAS_GOOD_PASSWORD_ATTR
attribute.- Returns:
- boolean true if a password for the file has been found, false if missing the password
-
hasMissingPassword
public boolean hasMissingPassword()
Returns true if this file is missing its password- Returns:
- boolean true if this file is missing its password
-
needsFileAttributesUpdate
public boolean needsFileAttributesUpdate(TaskMonitor monitor)
Returns true if this node's password status has changed, calling for a complete refresh of the status of all files in the file system.- Parameters:
monitor
-TaskMonitor
- Returns:
- boolean true if this nodes password status has changed
-
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.
-
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
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:
clone
in 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()
-
-