Package ghidra.plugins.fsbrowser

# Class FSBRootNode

java.lang.Object
docking.widgets.tree.GTreeNode
docking.widgets.tree.GTreeLazyNode
docking.widgets.tree.GTreeSlowLoadingNode
ghidra.plugins.fsbrowser.FSBNode
ghidra.plugins.fsbrowser.FSBRootNode

All Implemented Interfaces:
  `Cloneable`, `Comparable<GTreeNode>`

public class FSBRootNode extends FSBNode
A GTreeNode that represents the root of a `GFileSystem`, and keeps the filesystem pinned in memory with its `FileSystemRef`.

The `FileSystemRef` is released when this node is `dispose()`d.

Since GTreeNodes are cloned during GTree filtering, and this class has a reference to an external resource that needs managing, this class needs to keeps track of the original modelNode and does all state modification using the modelNode's context.

- ## Field Summary

  ### Fields inherited from class ghidra.plugins.fsbrowser.FSBNode

  `FSBNODE_NAME_TYPE_COMPARATOR, name`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected final 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(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(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.
  `List<GTreeNode>`
  `generateChildren(TaskMonitor monitor)`
  Subclass must implement this method to generate their children.
  `FSRL`
  `getContainer()`
  `FileSystemRef`
  `getFSRef()`
  `FSRL`
  `getFSRL()`
  Returns the `FSRL` of the filesystem object that this node represents.
  `GFile`
  `getGFile()`
  `FSBNode`
  `getGFileFSBNode(GFile file, TaskMonitor monitor)`
  `Icon`
  `getIcon(boolean expanded)`
  Returns the Icon to be displayed for this node in the tree
  `FSRL`
  `getLoadableFSRL()`
  `final GTreeNode`
  `getParent()`
  Returns the parent of this node.
  `FSRL`
  `getProgramProviderFSRL(FSRL fsrl)`
  `String`
  `getToolTip()`
  Returns the string to be displayed as a tooltip when the user hovers the mouse on this node in the tree
  `GTree`
  `getTree()`
  Returns the GTree that this node is attached to
  `void`
  `init(TaskMonitor monitor)`
  `final boolean`
  `isInProgress()`
  Returns true if the node is in the process of loading its children.
  `boolean`
  `isLeaf()`
  Returns true if this node never has 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 GTree
  `void`
  `refreshNode(TaskMonitor monitor)`
  `void`
  `setCryptoStatusUpdated(boolean cryptoStatusUpdated)`
  `void`
  `swapBackPrevModelNodeAndDispose()`

  ### Methods inherited from class ghidra.plugins.fsbrowser.FSBNode

  `createNodeFromFile, createNodesFromFileList, findContainingFileSystemFSBRootNode, findMatchingNode, getFileExtension, getFormattedTreePath, getFSBRootNode, getName, loadChildrenIfNeeded, refreshChildren`

  ### Methods inherited from class docking.widgets.tree.GTreeSlowLoadingNode

  `generateChildren, iterator, 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, getChildren, getDisplayText, getIndexInParent, getIndexOfChild, getLeafCount, getNodeCount, getRoot, getTreePath, hashCode, isAncestor, isAutoExpandPermitted, isEditable, isExpanded, setChildren, stream, toString, valueChanged`

  ### Methods inherited from class java.lang.Object

  `finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Method Details

  - ### clone

    public GTreeNode clone() throws 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.
    Returns:
      the clone of this object.
    Throws:
      `CloneNotSupportedException` - if some implementation prevents itself from being cloned.

  - ### dispose

    public void dispose()

  - ### init

    public void init(TaskMonitor monitor) throws CancelledException
    Overrides:
      `init` in class `FSBNode`
    Throws:
      `CancelledException`

  - ### getIcon

    public Icon getIcon(boolean expanded)
    Description copied from class: `GTreeNode`
    Returns the Icon to be displayed for this node in the tree
    Overrides:
      `getIcon` in class `FSBNode`
    Parameters:
      `expanded` - true if the node is expanded
    Returns:
      the icon to be displayed for this node in the tree

  - ### setCryptoStatusUpdated

    public void setCryptoStatusUpdated(boolean cryptoStatusUpdated)

  - ### swapBackPrevModelNodeAndDispose

    public void swapBackPrevModelNodeAndDispose()

  - ### getGFile

    public GFile getGFile()
    Overrides:
      `getGFile` in class `FSBNode`

  - ### getFSRef

    public FileSystemRef getFSRef()

  - ### refreshNode

    public void refreshNode(TaskMonitor monitor) throws CancelledException
    Specified by:
      `refreshNode` in class `FSBNode`
    Throws:
      `CancelledException`

  - ### getToolTip

    public String 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
    Overrides:
      `getToolTip` in class `FSBNode`
    Returns:
      the tooltip to be displayed

  - ### isLeaf

    public boolean isLeaf()
    Description copied from class: `GTreeNode`
    Returns true if this node never has children
    Specified by:
      `isLeaf` in class `GTreeNode`
    Returns:
      true if this node is a leaf

  - ### generateChildren

    public 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 class `GTreeSlowLoadingNode`
    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

  - ### getFSRL

    public FSRL getFSRL()
    Description copied from class: `FSBNode`
    Returns the `FSRL` of the filesystem object that this node represents.

    The root of filesystems will return a `FSRLRoot`.

    Specified by:
      `getFSRL` in class `FSBNode`
    Returns:
      `FSRL` of the filesystem object.

  - ### getGFileFSBNode

    public FSBNode getGFileFSBNode(GFile file, TaskMonitor monitor)

  - ### getContainer

    public FSRL getContainer()

  - ### getProgramProviderFSRL

    public FSRL getProgramProviderFSRL(FSRL fsrl)

  - ### getLoadableFSRL

    public FSRL getLoadableFSRL()
    Specified by:
      `getLoadableFSRL` in class `FSBNode`

  - ### 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 List<GTreeNode> children()

  - ### doSetChildrenAndFireEvent

    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. 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(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 node
      `node` - 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(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

  - ### isInProgress

    public final boolean isInProgress()
    Returns true if the node is in the process of loading its children. See `GTreeSlowLoadingNode`
    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()