Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-2083: Remove extraneous parent,node params from fireChanged methods

Dan0f3703ac27a7
diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/objects/components/ObjectNode.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/objects/components/ObjectNode.java
index e9915a3b73..fa2a0d3b4a 100644
--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/objects/components/ObjectNode.java
+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/objects/components/ObjectNode.java
@@ -230,7 +230,7 @@ public class ObjectNode extends GTreeSlowLoadingNode { //extends GTreeNode
public void run() {
List<GTreeNode> updateNodes = tree.update(container);
for (GTreeNode n : updateNodes) {
- n.fireNodeChanged(ObjectNode.this, n);
+ n.fireNodeChanged();
}
}
});
diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/objects/components/ObjectTree.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/objects/components/ObjectTree.java
index c185523a93..5039189958 100644
--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/objects/components/ObjectTree.java
+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/objects/components/ObjectTree.java
@@ -248,7 +248,7 @@ public class ObjectTree implements ObjectPane {
ObjectNode node = nodeMap.get(path(container));
if (node != null) {
node.setContainer(this, container.getParent(), container);
- node.fireNodeChanged(node.getParent(), node);
+ node.fireNodeChanged();
}
});
}
diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/target/DebuggerConnectionsNode.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/target/DebuggerConnectionsNode.java
index 158c9f6d53..04afb24577 100644
--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/target/DebuggerConnectionsNode.java
+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/target/DebuggerConnectionsNode.java
@@ -46,7 +46,7 @@ public class DebuggerConnectionsNode extends AbstractDebuggerConnectionsNode
@Override
public void elementModified(DebuggerObjectModel element) {
- fireNodeChanged(DebuggerConnectionsNode.this, models.get(element));
+ fireNodeChanged();
}
@Override
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/tree/ArchiveNode.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/tree/ArchiveNode.java
index 009d0c5bd2..e2bca8e965 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/tree/ArchiveNode.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/tree/ArchiveNode.java
@@ -127,7 +127,7 @@ public class ArchiveNode extends CategoryNode {
}
public void nodeChanged() {
- fireNodeChanged(getParent(), this);
+ fireNodeChanged();
GTree tree = getTree();
if (tree != null) {
@@ -150,9 +150,8 @@ public class ArchiveNode extends CategoryNode {
@Override
/**
- * The equals must not be based on the name since it can change
- * based upon the underlying archive. This must be consistent with
- * the hashCode method implementation.
+ * The equals must not be based on the name since it can change based upon the underlying
+ * archive. This must be consistent with the hashCode method implementation.
*/
public boolean equals(Object o) {
if (this == o) {
@@ -175,9 +174,8 @@ public class ArchiveNode extends CategoryNode {
@Override
/**
- * The hashcode must not be based on the name since it can change
- * based upon the underlying archive. This must be consistent with
- * the equals method implementation.
+ * The hashcode must not be based on the name since it can change based upon the underlying
+ * archive. This must be consistent with the equals method implementation.
*/
public int hashCode() {
return getArchive().hashCode();
@@ -194,10 +192,11 @@ public class ArchiveNode extends CategoryNode {
}
/**
- * Finds the node that represents the given category.
+ * Finds the node that represents the given category.
*
- * <P>Children <b>will not</b> be loaded when searching for the node. This allows clients
- * to search for data types of interest, only updating the tree when the nodes are loaded.
+ * <P>
+ * Children <b>will not</b> be loaded when searching for the node. This allows clients to search
+ * for data types of interest, only updating the tree when the nodes are loaded.
*
* @param localCategory the category of interest
* @return the node if loaded; null if not loaded
@@ -304,7 +303,7 @@ public class ArchiveNode extends CategoryNode {
public void categoryRenamed(DataTypeManager dtm, CategoryPath oldPath,
CategoryPath newPath) {
if (oldPath.getParent() == null) { // root has no parent
- fireNodeChanged(null, ArchiveNode.this); // fire that the root changed
+ ArchiveNode.this.fireNodeChanged(); // fire that the root changed
return;
}
Category parentCategory = dtm.getCategory(oldPath.getParent());
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/tree/CategoryNode.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/tree/CategoryNode.java
index 5ed018ea77..fbe341d317 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/tree/CategoryNode.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/tree/CategoryNode.java
@@ -281,11 +281,12 @@ public class CategoryNode extends DataTypeTreeNode {
}
/**
- * Signals to this node that it has been cut during a cut operation, for example, like during
- * a cut/paste operation.
+ * Signals to this node that it has been cut during a cut operation, for example, like during a
+ * cut/paste operation.
* <p>
* This implementation will throw a runtime exception if this method is called and
* {@link #canCut()} returns false.
+ *
* @param isCut true signals that the node has been cut; false that it is not cut.
*/
@Override
@@ -294,7 +295,7 @@ public class CategoryNode extends DataTypeTreeNode {
throw new AssertException("Cannot call isCut() on a node that cannot be cut.");
}
this.isCut = isCut;
- fireNodeChanged(getParent(), this);
+ fireNodeChanged();
}
@Override
@@ -332,9 +333,9 @@ public class CategoryNode extends DataTypeTreeNode {
}
/**
- * This method is handy to signal whether this node is can be used to perform actions.
- * Returning false from this method is essentially a way to disable the actions that can
- * be performed upon this node.
+ * This method is handy to signal whether this node is can be used to perform actions. Returning
+ * false from this method is essentially a way to disable the actions that can be performed upon
+ * this node.
*
* @return true if this node is enabled.
*/
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/tree/DataTypeNode.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/tree/DataTypeNode.java
index c82ac41815..950350bf22 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/tree/DataTypeNode.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/tree/DataTypeNode.java
@@ -162,6 +162,7 @@ public class DataTypeNode extends DataTypeTreeNode {
/**
* Returns true if this dataType node uses and editor that is different than Java's default
* editor.
+ *
* @return true if this dataType node has a custom editor.
*/
public boolean hasCustomEditor() {
@@ -194,7 +195,7 @@ public class DataTypeNode extends DataTypeTreeNode {
@Override
public void setNodeCut(boolean isCut) {
this.isCut = isCut;
- fireNodeChanged(getParent(), this);
+ fireNodeChanged();
}
@Override
@@ -234,12 +235,12 @@ public class DataTypeNode extends DataTypeTreeNode {
}
public void dataTypeStatusChanged() {
- fireNodeChanged(getParent(), this);
+ fireNodeChanged();
}
public void dataTypeChanged() {
toolTipText = null;
- fireNodeChanged(getParent(), this);
+ fireNodeChanged();
GTree tree = getTree();
if (tree != null) {
tree.repaint(); // need to repaint in case related datatypes changes mod status.
@@ -253,7 +254,7 @@ public class DataTypeNode extends DataTypeTreeNode {
String currentDisplayText = getCurrentDisplayText();
if (!displayText.equals(currentDisplayText)) {
displayText = currentDisplayText;
- fireNodeChanged(getParent(), this);
+ fireNodeChanged();
}
return displayText;
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/script/GhidraScriptComponentProvider.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/script/GhidraScriptComponentProvider.java
index ebfe9e71da..c9bf4421c5 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/script/GhidraScriptComponentProvider.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/script/GhidraScriptComponentProvider.java
@@ -306,7 +306,8 @@ public class GhidraScriptComponentProvider extends ComponentProviderAdapter {
}
/**
- * @return the bundle host used for scripting, ultimately from {@link GhidraScriptUtil#getBundleHost()}
+ * @return the bundle host used for scripting, ultimately from
+ * {@link GhidraScriptUtil#getBundleHost()}
*/
public BundleHost getBundleHost() {
return bundleHost;
@@ -756,7 +757,7 @@ public class GhidraScriptComponentProvider extends ComponentProviderAdapter {
trimUnusedTreeCategories();
- scriptRoot.fireNodeStructureChanged(scriptRoot);
+ scriptRoot.fireNodeStructureChanged();
if (preRefreshSelectionPath != null) {
scriptCategoryTree.setSelectionPath(preRefreshSelectionPath);
}
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/widgets/tree/GTree.java b/Ghidra/Framework/Docking/src/main/java/docking/widgets/tree/GTree.java
index 19cd4ed0be..149b2987a6 100644
--- a/Ghidra/Framework/Docking/src/main/java/docking/widgets/tree/GTree.java
+++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/tree/GTree.java
@@ -15,8 +15,8 @@
*/
package docking.widgets.tree;
-import static docking.widgets.tree.support.GTreeSelectionEvent.EventOrigin.*;
-import static ghidra.util.SystemUtilities.*;
+import static docking.widgets.tree.support.GTreeSelectionEvent.EventOrigin.USER_GENERATED;
+import static ghidra.util.SystemUtilities.runSwingNow;
import java.awt.*;
import java.awt.dnd.Autoscroll;
@@ -61,26 +61,26 @@ public class GTree extends JPanel implements BusyListener {
private GTreeModel model;
/**
- * This is the root node of the tree's data model. It may or may not be the root node
- * that is currently being displayed by the tree. If there is currently a
- * filter applied, then then the displayed root node will be a clone whose children have been
- * trimmed to only those that match the filter. By keeping this variable around, we can give
- * this node to clients, regardless of the root node visible in the tree.
+ * This is the root node of the tree's data model. It may or may not be the root node that is
+ * currently being displayed by the tree. If there is currently a filter applied, then then the
+ * displayed root node will be a clone whose children have been trimmed to only those that match
+ * the filter. By keeping this variable around, we can give this node to clients, regardless of
+ * the root node visible in the tree.
*/
private volatile GTreeNode realModelRootNode;
/**
- * This is the root that is currently being displayed. This node will be either exactly the
- * same instance as the realModelRootNode (if no filter has been applied) or it will be the
- * filtered clone of the realModelRootNode.
+ * This is the root that is currently being displayed. This node will be either exactly the same
+ * instance as the realModelRootNode (if no filter has been applied) or it will be the filtered
+ * clone of the realModelRootNode.
*/
private volatile GTreeNode realViewRootNode;
/**
- * The rootParent is a node that is assigned as the parent to the realRootNode. It's primary purpose is
- * to allow nodes access to the tree. It overrides the getTree() method on GTreeNode to return
- * this tree. This eliminated the need for clients to create special root nodes that had
- * public setTree/getTree methods.
+ * The rootParent is a node that is assigned as the parent to the realRootNode. It's primary
+ * purpose is to allow nodes access to the tree. It overrides the getTree() method on GTreeNode
+ * to return this tree. This eliminated the need for clients to create special root nodes that
+ * had public setTree/getTree methods.
*/
private GTreeRootParentNode rootParent = new GTreeRootParentNode(this);
@@ -112,8 +112,8 @@ public class GTree extends JPanel implements BusyListener {
private Set<GTreeNode> ignoredNodes = new HashSet<>();
/**
- * Creates a GTree with the given root node. The created GTree will use a threaded model
- * for performing tasks, which allows the GUI to be responsive for reaaaaaaaaly big trees.
+ * Creates a GTree with the given root node. The created GTree will use a threaded model for
+ * performing tasks, which allows the GUI to be responsive for reaaaaaaaaly big trees.
*
* @param root The root node of the tree.
*/
@@ -147,22 +147,22 @@ public class GTree extends JPanel implements BusyListener {
}
/**
- * Returns the monitor in associated with the GTree for the calling thread. This method is
- * designed to be used by slow loading nodes that are loading <b>off the Swing thread</b>.
- * Some of the loading methods are called by the slow loading node at a point when it is
- * not passed a monitor (like when clients ask how many children the node has).
+ * Returns the monitor in associated with the GTree for the calling thread. This method is
+ * designed to be used by slow loading nodes that are loading <b>off the Swing thread</b>. Some
+ * of the loading methods are called by the slow loading node at a point when it is not passed a
+ * monitor (like when clients ask how many children the node has).
* <p>
- * When a {@link GTreeTask} is run in thread from a thread pool, it registers its monitor
- * (which is different than the GTree's) with this tree. Then, if a node performing work,
- * like loading, needs a monitor, it can call {@link #getThreadLocalMonitor()} in order to
- * get the monitor that was registered with that thread.
+ * When a {@link GTreeTask} is run in thread from a thread pool, it registers its monitor (which
+ * is different than the GTree's) with this tree. Then, if a node performing work, like loading,
+ * needs a monitor, it can call {@link #getThreadLocalMonitor()} in order to get the monitor
+ * that was registered with that thread.
* <P>
* This method is necessary because the concurrent library used by this tree will provide a
* unique monitor for each task that is run, which will be different (but connected) to the
* monitor created by this tree.
* <p>
- * If this method is called from a client other than a {@link GTreeTask}, then a dummy
- * monitor will be returned.
+ * If this method is called from a client other than a {@link GTreeTask}, then a dummy monitor
+ * will be returned.
*
* @return the monitor associated with the calling thread; null if the monitor was not set
* @see #setThreadLocalMonitor(TaskMonitor)
@@ -186,6 +186,7 @@ public class GTree extends JPanel implements BusyListener {
/**
* Turns tree event notifications on/off
+ *
* @param b true to enable events, false to disable events
*/
public void setEventsEnabled(boolean b) {
@@ -317,8 +318,9 @@ public class GTree extends JPanel implements BusyListener {
* Returns a state object that allows this tree to later restore its expanded and selected
* state.
* <p>
- * <b>Note: </b>See the usage note at the header of this class concerning how tree state
- * is used relative to the <code>equals()</code> method.
+ * <b>Note: </b>See the usage note at the header of this class concerning how tree state is used
+ * relative to the <code>equals()</code> method.
+ *
* @return the saved state
*/
public GTreeState getTreeState() {
@@ -330,11 +332,11 @@ public class GTree extends JPanel implements BusyListener {
}
/**
- * Restores the expanded and selected state of this tree to that contained in the given
- * state object.
+ * Restores the expanded and selected state of this tree to that contained in the given state
+ * object.
* <p>
- * <b>Note: </b>See the usage note at the header of this class concerning how tree state
- * is used relative to the <code>equals()</code> method.
+ * <b>Note: </b>See the usage note at the header of this class concerning how tree state is used
+ * relative to the <code>equals()</code> method.
*
* @param state the state to restore
*
@@ -346,8 +348,8 @@ public class GTree extends JPanel implements BusyListener {
}
/**
- * Signal to the tree that it should record its expanded and selected state when a
- * new filter is applied
+ * Signal to the tree that it should record its expanded and selected state when a new filter is
+ * applied
*/
void saveFilterRestoreState() {
// this may be called by sub-filter tasks and we wish to save only the first one
@@ -365,10 +367,10 @@ public class GTree extends JPanel implements BusyListener {
}
/**
- * A method that subclasses can use to be notified when tree state has been restored. This
- * method is called after a major structural tree change has happened <b>and</b> the paths
- * that should be opened have been opened. Thus any other nodes are closed and can be
- * disposed, if desired.
+ * A method that subclasses can use to be notified when tree state has been restored. This
+ * method is called after a major structural tree change has happened <b>and</b> the paths that
+ * should be opened have been opened. Thus any other nodes are closed and can be disposed, if
+ * desired.
*
* @param taskMonitor the TaskMonitor
*/
@@ -399,7 +401,7 @@ public class GTree extends JPanel implements BusyListener {
public void collapseAll(GTreeNode node) {
runSwingNow(() -> {
- node.fireNodeStructureChanged(node);
+ node.fireNodeStructureChanged();
tree.collapsePath(node.getTreePath());
boolean nodeIsRoot = node.equals(model.getRoot());
@@ -466,8 +468,8 @@ public class GTree extends JPanel implements BusyListener {
}
/**
- * A convenience method to select a node by a path, starting with the tree root name, down
- * each level until the desired node name.
+ * A convenience method to select a node by a path, starting with the tree root name, down each
+ * level until the desired node name.
*
* @param namePath The path to select
*/
@@ -489,8 +491,8 @@ public class GTree extends JPanel implements BusyListener {
}
/**
- * Selects the node that matches the each name in the given tree path. It is worth noting
- * that the items in the tree path themselves are not used to identify nodes, but the
+ * Selects the node that matches the each name in the given tree path. It is worth noting that
+ * the items in the tree path themselves are not used to identify nodes, but the
* {@link #toString()} of those items will be used.
*
* @param treePath The path containing the names of the path of the node to select
@@ -522,11 +524,11 @@ public class GTree extends JPanel implements BusyListener {
}
/**
- * Sets the size of the scroll when mouse scrolling or pressing the scroll up/down buttons.
- * Most clients will not need this method, as the default behavior of the tree is correct,
- * which is to scroll based upon the size of the nodes (which is usually uniform and a
- * single row in size). However, some clients that have variable row height, with potentially
- * large rows, may wish to change the scrolling behavior so that it is not too fast.
+ * Sets the size of the scroll when mouse scrolling or pressing the scroll up/down buttons. Most
+ * clients will not need this method, as the default behavior of the tree is correct, which is
+ * to scroll based upon the size of the nodes (which is usually uniform and a single row in
+ * size). However, some clients that have variable row height, with potentially large rows, may
+ * wish to change the scrolling behavior so that it is not too fast.
*
* @param increment the new (uniform) scroll increment.
*/
@@ -536,6 +538,7 @@ public class GTree extends JPanel implements BusyListener {
/**
* Returns the model for this tree
+ *
* @return the model for this tree
*/
public GTreeModel getModel() {
@@ -551,7 +554,8 @@ public class GTree extends JPanel implements BusyListener {
/**
* Returns the current viewport position of the scrollable tree.
- * @return the current viewport position of the scrollable tree.
+ *
+ * @return the current viewport position of the scrollable tree.
*/
public Point getViewPosition() {
JViewport viewport = scrollPane.getViewport();
@@ -580,12 +584,12 @@ public class GTree extends JPanel implements BusyListener {
/**
* Gets the model node for the given node. This is useful if the node that is in the path has
- * been replaced by a new node that is equal, but a different instance. One way this happens
- * is if the tree is filtered and therefor the displayed nodes are clones of the model nodes.
- * This can also happen if the tree nodes are rebuilt for some reason.
+ * been replaced by a new node that is equal, but a different instance. One way this happens is
+ * if the tree is filtered and therefor the displayed nodes are clones of the model nodes. This
+ * can also happen if the tree nodes are rebuilt for some reason.
*
* @param node the node
- * @return the corresponding model node in the tree. If the tree is filtered the viewed node
+ * @return the corresponding model node in the tree. If the tree is filtered the viewed node
* will be a clone of the corresponding model node.
*/
public GTreeNode getModelNode(GTreeNode node) {
@@ -594,12 +598,12 @@ public class GTree extends JPanel implements BusyListener {
/**
* Gets the model node for the given path. This is useful if the node that is in the path has
- * been replaced by a new node that is equal, but a different instance. One way this happens
- * is if the tree is filtered and therefor the displayed nodes are clones of the model nodes.
- * This can also happen if the tree nodes are rebuilt for some reason.
+ * been replaced by a new node that is equal, but a different instance. One way this happens is
+ * if the tree is filtered and therefor the displayed nodes are clones of the model nodes. This
+ * can also happen if the tree nodes are rebuilt for some reason.
*
* @param path the path of the node
- * @return the corresponding model node in the tree. If the tree is filtered the viewed node
+ * @return the corresponding model node in the tree. If the tree is filtered the viewed node
* will be a clone of the corresponding model node.
*/
public GTreeNode getModelNodeForPath(TreePath path) {
@@ -608,7 +612,7 @@ public class GTree extends JPanel implements BusyListener {
/**
* Gets the view node for the given node. This is useful to translate to a tree path that is
- * valid for the currently displayed tree. (Remember that if the tree is filtered, then the
+ * valid for the currently displayed tree. (Remember that if the tree is filtered, then the
* displayed nodes are clones of the model nodes.)
*
* @param node the node
@@ -620,7 +624,7 @@ public class GTree extends JPanel implements BusyListener {
/**
* Gets the view node for the given path. This is useful to translate to a tree path that is
- * valid for the currently displayed tree. (Remember that if the tree is filtered, then the
+ * valid for the currently displayed tree. (Remember that if the tree is filtered, then the
* displayed nodes are clones of the model nodes.)
*
* @param path the path of the node
@@ -687,8 +691,8 @@ public class GTree extends JPanel implements BusyListener {
}
/**
- * Disabled the filter text field, but allows the tree to still filter. This is useful if
- * you want to allow programmatic filtering, but to not allow the user to filter.
+ * Disabled the filter text field, but allows the tree to still filter. This is useful if you
+ * want to allow programmatic filtering, but to not allow the user to filter.
*
* @param enabled True makes the filter field editable; false makes it uneditable
* @see #setFilteringEnabled(boolean)
@@ -698,8 +702,8 @@ public class GTree extends JPanel implements BusyListener {
}
/**
- * Disables all filtering performed by this tree. Also, the filter field of the tree will
- * be disabled.
+ * Disables all filtering performed by this tree. Also, the filter field of the tree will be
+ * disabled.
* <p>
* Use this method to temporarily disable filtering.
*
@@ -714,7 +718,7 @@ public class GTree extends JPanel implements BusyListener {
}
/**
- * Hides the filter field. Filtering will still take place, as defined by the
+ * Hides the filter field. Filtering will still take place, as defined by the
* {@link GTreeFilterProvider}.
*
* @param visible true to show the filter; false to hide it.
@@ -731,8 +735,8 @@ public class GTree extends JPanel implements BusyListener {
}
/**
- * Sets a transformer object used to perform filtering. This object is responsible for
- * turning the tree's nodes into a list of strings that can be searched when filtering.
+ * Sets a transformer object used to perform filtering. This object is responsible for turning
+ * the tree's nodes into a list of strings that can be searched when filtering.
*
* @param transformer the transformer to set
*/
@@ -773,7 +777,7 @@ public class GTree extends JPanel implements BusyListener {
* Sets the root node for this tree.
* <P>
* NOTE: if this method is not called from the Swing thread, then the root node will be set
- * later on the Swing thread. That is, this method will return before the work has been done.
+ * later on the Swing thread. That is, this method will return before the work has been done.
*
* @param rootNode The node to set as the new root.
*/
@@ -816,11 +820,12 @@ public class GTree extends JPanel implements BusyListener {
}
/**
- * This method returns the root node that was provided to the tree by the client, whether from the
- * constructor or from {@link #setRootNode(GTreeNode)}.
- * This node represents the data model and always contains all the nodes regardless of any filter
- * being applied. If a filter is applied to the tree, then this is not the actual root node being
- * displayed by the {@link JTree}.
+ * This method returns the root node that was provided to the tree by the client, whether from
+ * the constructor or from {@link #setRootNode(GTreeNode)}. This node represents the data model
+ * and always contains all the nodes regardless of any filter being applied. If a filter is
+ * applied to the tree, then this is not the actual root node being displayed by the
+ * {@link JTree}.
+ *
* @return the root node as provided by the client.
*/
public GTreeNode getModelRoot() {
@@ -828,10 +833,11 @@ public class GTree extends JPanel implements BusyListener {
}
/**
- * This method returns the root node currently being displayed by the {@link JTree}. If there
- * are no filters applied, then this will be the same as the model root (See {@link #getModelRoot()}).
- * If a filter is applied, then this will be a clone of the model root that contains clones of all
- * nodes matching the filter.
+ * This method returns the root node currently being displayed by the {@link JTree}. If there
+ * are no filters applied, then this will be the same as the model root (See
+ * {@link #getModelRoot()}). If a filter is applied, then this will be a clone of the model root
+ * that contains clones of all nodes matching the filter.
+ *
* @return the root node currently being display by the {@link JTree}
*/
public GTreeNode getViewRoot() {
@@ -839,9 +845,11 @@ public class GTree extends JPanel implements BusyListener {
}
/**
- * This method is useful for debugging tree problems. Don't know where else to put it.
+ * This method is useful for debugging tree problems. Don't know where else to put it.
+ *
* @param out the output writer
- * @param name use this to indicate what tree event occurred ("node inserted" "node removed", etc.)
+ * @param name use this to indicate what tree event occurred ("node inserted" "node removed",
+ * etc.)
* @param e the TreeModelEvent;
*/
public static void printEvent(PrintWriter out, String name, TreeModelEvent e) {
@@ -1027,26 +1035,29 @@ public class GTree extends JPanel implements BusyListener {
}
/**
- * A specialized method that will get the child node from the given parent node when it
- * becomes available to the model. This method will ensure that the named child passes any
- * current filter in order for the child to appear in the tree. This effect is temporary and
- * will be undone when next the filter changes.
+ * A specialized method that will get the child node from the given parent node when it becomes
+ * available to the model. This method will ensure that the named child passes any current
+ * filter in order for the child to appear in the tree. This effect is temporary and will be
+ * undone when next the filter changes.
*
- * <p>This method is intended to be used by clients using an asynchronous node model, where
- * new nodes will get created by application-level events. Such clients may wish to perform
- * work when newly created nodes become available. This method simplifies the concurrent
- * nature of the GTree, asynchronous nodes and the processing of asynchronous application-level
- * events by providing a callback mechanism for clients. <b>This method is non-blocking.</b>
+ * <p>
+ * This method is intended to be used by clients using an asynchronous node model, where new
+ * nodes will get created by application-level events. Such clients may wish to perform work
+ * when newly created nodes become available. This method simplifies the concurrent nature of
+ * the GTree, asynchronous nodes and the processing of asynchronous application-level events by
+ * providing a callback mechanism for clients. <b>This method is non-blocking.</b>
*
- * <p>Note: this method assumes that the given parent node is in the view and not filtered
- * out of the view. This method makes no attempt to ensure the given parent node passes any
- * existing filter.
+ * <p>
+ * Note: this method assumes that the given parent node is in the view and not filtered out of
+ * the view. This method makes no attempt to ensure the given parent node passes any existing
+ * filter.
*
- * <p>Note: this method will not wait forever for the given node to appear. It will eventually
- * give up if the node never arrives.
+ * <p>
+ * Note: this method will not wait forever for the given node to appear. It will eventually give
+ * up if the node never arrives.
*
- * @param parent the model's parent node. If the view's parent node is passed, it will
- * be translated to the model node.
+ * @param parent the model's parent node. If the view's parent node is passed, it will be
+ * translated to the model node.
* @param childName the name of the desired child
* @param consumer the consumer callback to which the child node will be given when available
*/
@@ -1054,17 +1065,17 @@ public class GTree extends JPanel implements BusyListener {
Consumer<GTreeNode> consumer) {
/*
-
+
If the GTree were to use Java's CompletableStage API, then the code below
could be written thusly:
-
+
tree.getNewNode(modelParent, newName)
.thenCompose(newModelChild -> {
tree.ignoreFilter(newModelChild);
return tree.getNewNode(viewParent, newName);
))
.thenAccept(consumer);
-
+
*/
// ensure we operate on the model node which will always have the given child not the view
@@ -1080,9 +1091,9 @@ public class GTree extends JPanel implements BusyListener {
}
/**
- * Requests that the node with the given name, in the given parent, be edited. This operation
- * is asynchronous. This request will be buffered as needed to wait for the given node to be
- * added to the parent, up to a timeout period.
+ * Requests that the node with the given name, in the given parent, be edited. This operation is
+ * asynchronous. This request will be buffered as needed to wait for the given node to be added
+ * to the parent, up to a timeout period.
*
* @param parent the parent node
* @param childName the name of the child to edit
@@ -1108,7 +1119,7 @@ public class GTree extends JPanel implements BusyListener {
}
/**
- * Requests that the node be edited. This operation is asynchronous.
+ * Requests that the node be edited. This operation is asynchronous.
*
* @param node the node to edit
*/
@@ -1239,8 +1250,9 @@ public class GTree extends JPanel implements BusyListener {
}
/**
- * Re-filters the tree if the newNode should be included in the current filter results. If
- * the new node doesn't match the filter, there is no need to refilter the tree.
+ * Re-filters the tree if the newNode should be included in the current filter results. If the
+ * new node doesn't match the filter, there is no need to refilter the tree.
+ *
* @param newNode the node that may cause the tree to refilter.
*/
public void refilterLater(GTreeNode newNode) {
@@ -1275,8 +1287,8 @@ public class GTree extends JPanel implements BusyListener {
}
/**
- * Used to run tree tasks. This method is not meant for general clients of this tree, but
- * rather for tasks to tell the tree to perform subtasks.
+ * Used to run tree tasks. This method is not meant for general clients of this tree, but rather
+ * for tasks to tell the tree to perform subtasks.
*
* @param task the task to run
*/
@@ -1285,9 +1297,10 @@ public class GTree extends JPanel implements BusyListener {
}
/**
- * Used to run simple GTree tasks that can be expressed as a {@link MonitoredRunnable}
- * (or a lambda taking a {@link TaskMonitor}).
+ * Used to run simple GTree tasks that can be expressed as a {@link MonitoredRunnable} (or a
+ * lambda taking a {@link TaskMonitor}).
* <p>
+ *
* @param runnableTask {@link TaskMonitor} to watch and update with progress.
*/
public void runTask(MonitoredRunnable runnableTask) {
@@ -1343,7 +1356,7 @@ public class GTree extends JPanel implements BusyListener {
recurseClearSizeCache(child);
}
}
- node.fireNodeChanged(node.getParent(), node);
+ node.fireNodeChanged();
}
//==================================================================================================
@@ -1448,13 +1461,13 @@ public class GTree extends JPanel implements BusyListener {
}
/**
- * Need to override the addMouseListener method of the JTree to defer to the
- * delegate mouse listener. The GTree uses a mouse listener delegate for itself
- * and the JTree it wraps. When the delegate was installed, it moved all the existing mouse
- * listeners from the JTree to the delegate. Any additional listeners should also
- * be moved to the delegate. Otherwise, some Ghidra components that use a convention/pattern
- * to avoid listener duplication by first removing a listener before adding it,
- * don't work and duplicates get added.
+ * Need to override the addMouseListener method of the JTree to defer to the delegate mouse
+ * listener. The GTree uses a mouse listener delegate for itself and the JTree it wraps.
+ * When the delegate was installed, it moved all the existing mouse listeners from the JTree
+ * to the delegate. Any additional listeners should also be moved to the delegate.
+ * Otherwise, some Ghidra components that use a convention/pattern to avoid listener
+ * duplication by first removing a listener before adding it, don't work and duplicates get
+ * added.
*/
@Override
public synchronized void addMouseListener(MouseListener l) {
@@ -1467,13 +1480,13 @@ public class GTree extends JPanel implements BusyListener {
}
/**
- * Need to override the removeMouseListener method of the JTree to defer to the
- * delegate mouse listener. The GTree uses a mouse listener delegate for itself
- * and the JTree it wraps. When the delegate was installed, it moved all the existing mouse
- * listeners from the JTree to the delegate. All listener remove calls should also
- * be moved to the delegate. Otherwise, some Ghidra components that use a convention/pattern
- * to avoid listener duplication by first removing a listener before adding it,
- * don't work and duplicates get added.
+ * Need to override the removeMouseListener method of the JTree to defer to the delegate
+ * mouse listener. The GTree uses a mouse listener delegate for itself and the JTree it
+ * wraps. When the delegate was installed, it moved all the existing mouse listeners from
+ * the JTree to the delegate. All listener remove calls should also be moved to the
+ * delegate. Otherwise, some Ghidra components that use a convention/pattern to avoid
+ * listener duplication by first removing a listener before adding it, don't work and
+ * duplicates get added.
*/
@Override
public synchronized void removeMouseListener(MouseListener l) {
@@ -1506,9 +1519,10 @@ public class GTree extends JPanel implements BusyListener {
}
/**
- * Calling setSelectedPaths on GTree queues the selection for after
- * any currently scheduled tasks. This method sets the selected path immediately
- * and does not wait for for scheduled tasks.
+ * Calling setSelectedPaths on GTree queues the selection for after any currently scheduled
+ * tasks. This method sets the selected path immediately and does not wait for for scheduled
+ * tasks.
+ *
* @param path the path to select.
*/
@Override
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/widgets/tree/GTreeNode.java b/Ghidra/Framework/Docking/src/main/java/docking/widgets/tree/GTreeNode.java
index c7beb85b7d..33e742c1ac 100644
--- a/Ghidra/Framework/Docking/src/main/java/docking/widgets/tree/GTreeNode.java
+++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/tree/GTreeNode.java
@@ -28,45 +28,47 @@ import ghidra.util.task.TaskMonitor;
import util.CollectionUtils;
/**
- * Base implementation for GTree nodes. Direct subclasses of this class are expected to have
- * all their children in hand when initially constructed (either in their constructor or externally
- * using {@link #addNode(GTreeNode)} or {@link #setChildren(List)}. For large trees, subclasses
+ * Base implementation for GTree nodes. Direct subclasses of this class are expected to have all
+ * their children in hand when initially constructed (either in their constructor or externally
+ * using {@link #addNode(GTreeNode)} or {@link #setChildren(List)}. For large trees, subclasses
* should instead extend {@link GTreeLazyNode} or {@link GTreeSlowLoadingNode}
* <P>
- * All methods in this class that mutate the children node must perform that operation in
- * the swing thread.
+ * All methods in this class that mutate the children node must perform that operation in the swing
+ * thread.
* <P>
- * To create a simple GTreeNode where nodes will be added immediately
- * using the addNode() methods, simply extend this class and implement the following methods:
+ * To create a simple GTreeNode where nodes will be added immediately using the addNode() methods,
+ * simply extend this class and implement the following methods:
* <ul>
- * <li>getName()</li>
- * <li>getToolTip()</li>
- * <li>isLeaf()</li>
- * <li>getIcon()</li>
+ * <li>getName()</li>
+ * <li>getToolTip()</li>
+ * <li>isLeaf()</li>
+ * <li>getIcon()</li>
* </ul>
*
* <a id="usage"></a>Usage Notes:
* <ul>
- * <li>The <b><code>equals()</code></b> method: The <code>GTree</code> has the ability to remember expanded and
- * selected states. This will only work if the nodes in the saved state can be matched
- * with the nodes in the <code>GTree</code>. Java will do this by using the <code>equals()</code> method.
- * There is a potential problem with this usage. If nodes within the <code>GTree</code> get rebuilt (
- * i.e., new nodes are created), then, by default, the expanded and selected state
- * feature will be unable to find the correct nodes, since the default <code>equals()</code>
- * method on <code>GTreeNode</code> performs a comparison based upon instances. To fix this problem,
- * the {@link #equals(Object)} method has been implemented such that nodes are considered equal if they have
- * the same name (see {@link #getName()}). The {@link #hashCode()} method will return the hash of the name. The name
- * attribute was chosen because it should be the most unique and descriptive piece of information
- * available in a generic GTreeNode.
- * <p><br>
- * <p>
- * There are two situations where the {@link #equals(Object)} and {@link #hashCode()} using the
- * name are insufficient. One is if your tree implementation allows nodes with the same name
- * with the same parent. The other possible situation is if your nodes can change their name,
- * which may confuse the tree. If either of these situations apply, just override the
- * {@link #equals(Object)} and {@link #hashCode()} methods to make them more robust.
- * <p><br>
- * </li>
+ * <li>The <b><code>equals()</code></b> method: The <code>GTree</code> has the ability to remember
+ * expanded and selected states. This will only work if the nodes in the saved state can be matched
+ * with the nodes in the <code>GTree</code>. Java will do this by using the <code>equals()</code>
+ * method. There is a potential problem with this usage. If nodes within the <code>GTree</code> get
+ * rebuilt ( i.e., new nodes are created), then, by default, the expanded and selected state feature
+ * will be unable to find the correct nodes, since the default <code>equals()</code> method on
+ * <code>GTreeNode</code> performs a comparison based upon instances. To fix this problem, the
+ * {@link #equals(Object)} method has been implemented such that nodes are considered equal if they
+ * have the same name (see {@link #getName()}). The {@link #hashCode()} method will return the hash
+ * of the name. The name attribute was chosen because it should be the most unique and descriptive
+ * piece of information available in a generic GTreeNode.
+ * <p>
+ * <br>
+ * <p>
+ * There are two situations where the {@link #equals(Object)} and {@link #hashCode()} using the name
+ * are insufficient. One is if your tree implementation allows nodes with the same name with the
+ * same parent. The other possible situation is if your nodes can change their name, which may
+ * confuse the tree. If either of these situations apply, just override the {@link #equals(Object)}
+ * and {@link #hashCode()} methods to make them more robust.
+ * <p>
+ * <br>
+ * </li>
* </ul>
*/
@@ -78,12 +80,13 @@ public abstract class GTreeNode extends CoreGTreeNode implements Comparable<GTre
}
/**
- * Returns the display text for the node. By default, this is the same as the name of the node.
- * The name of the node usually serves two purposes: 1) to uniquely identify the node (the
- * identity) and 2) the display text (what you see in the tree). Sometimes, it is useful to
- * display more information in the tree without affecting the nodes identity. In this case,
- * you can override this method to return the "display" name, while {@link #getName()} will
- * still return the name used to identify the node.
+ * Returns the display text for the node. By default, this is the same as the name of the node.
+ * The name of the node usually serves two purposes: 1) to uniquely identify the node (the
+ * identity) and 2) the display text (what you see in the tree). Sometimes, it is useful to
+ * display more information in the tree without affecting the nodes identity. In this case, you
+ * can override this method to return the "display" name, while {@link #getName()} will still
+ * return the name used to identify the node.
+ *
* @return the display text for the node.
*/
public String getDisplayText() {
@@ -91,10 +94,10 @@ public abstract class GTreeNode extends CoreGTreeNode implements Comparable<GTre
}
/**
- * Returns the name of the node. If {@link #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, override
- * {@link #getDisplayText()}.
+ * Returns the name of the node. If {@link #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, override
+ * {@link #getDisplayText()}.
*
* @return the name of the node
*/
@@ -102,20 +105,23 @@ public abstract class GTreeNode extends CoreGTreeNode implements Comparable<GTre
/**
* Returns the Icon to be displayed for this node in the tree
+ *
* @param expanded true if the node is expanded
* @return the icon to be displayed for this node in the tree
*/
public abstract Icon getIcon(boolean expanded);
/**
- * Returns the string to be displayed as a tooltip when the user
- * hovers the mouse on this node in the tree
+ * Returns the string to be displayed as a tooltip when the user hovers the mouse on this node
+ * in the tree
+ *
* @return the tooltip to be displayed
*/
public abstract String getToolTip();
/**
* Returns true if this node never has children
+ *
* @return true if this node is a leaf
*/
public abstract boolean isLeaf();
@@ -126,8 +132,10 @@ public abstract class GTreeNode extends CoreGTreeNode implements Comparable<GTre
}
/**
- * Adds the given node as a child to this node. Note: this method may be inefficient so if you
- * have many nodes to add, you should use either {@link #addNodes(List)} or {@link #setChildren(List)}
+ * Adds the given node as a child to this node. Note: this method may be inefficient so if you
+ * have many nodes to add, you should use either {@link #addNodes(List)} or
+ * {@link #setChildren(List)}
+ *
* @param node the node to add as a child
*/
public void addNode(GTreeNode node) {
@@ -136,6 +144,7 @@ public abstract class GTreeNode extends CoreGTreeNode implements Comparable<GTre
/**
* Adds the given nodes as children to this node
+ *
* @param nodes the nodes to add
*/
public void addNodes(List<GTreeNode> nodes) {
@@ -144,6 +153,7 @@ public abstract class GTreeNode extends CoreGTreeNode implements Comparable<GTre
/**
* Adds the given node at the given index as a child to this node
+ *
* @param index the index to place the node
* @param node the node to add as a child of this node
*/
@@ -152,19 +162,20 @@ public abstract class GTreeNode extends CoreGTreeNode implements Comparable<GTre
}
/**
- * Returns all of the <b>visible</b> children of this node. If there are filtered nodes, then
+ * Returns all of the <b>visible</b> children of this node. If there are filtered nodes, then
* they will not be returned.
*
- * @return all of the <b>visible</b> children of this node. If there are filtered nodes, then
- * they will not be returned.
+ * @return all of the <b>visible</b> children of this node. If there are filtered nodes, then
+ * they will not be returned.
*/
public List<GTreeNode> getChildren() {
return Collections.unmodifiableList(children());
}
/**
- * Returns the number of <b>visible</b> children of this node. Does not include
- * nodes that are current filtered out
+ * Returns the number of <b>visible</b> children of this node. Does not include nodes that are
+ * current filtered out
+ *
* @return the number of <b>visible</b> children of this node
*/
public int getChildCount() {
@@ -173,6 +184,7 @@ public abstract class GTreeNode extends CoreGTreeNode implements Comparable<GTre
/**
* Returns the child node of this node with the given name.
+ *
* @param name the name of the child to be returned
* @return the child with the given name
*/
@@ -186,8 +198,8 @@ public abstract class GTreeNode extends CoreGTreeNode implements Comparable<GTre
}
/**
- * Returns the child node at the given index. Returns null if the index is out of
- * bounds.
+ * Returns the child node at the given index. Returns null if the index is out of bounds.
+ *
* @param index the index of the child to be returned
* @return the child at the given index
*/
@@ -196,8 +208,8 @@ public abstract class GTreeNode extends CoreGTreeNode implements Comparable<GTre
}
/**
- * Returns the total number of nodes in the subtree rooted at this node. Leaf
- * nodes return 1.
+ * Returns the total number of nodes in the subtree rooted at this node. Leaf nodes return 1.
+ *
* @return the number of nodes from this node downward
*/
public int getNodeCount() {
@@ -209,9 +221,10 @@ public abstract class GTreeNode extends CoreGTreeNode implements Comparable<GTre
}
/**
- * Returns the total number of leaf nodes in the subtree from this node. Note that if any
- * nodes are "lazy" (see {@link GTreeLazyNode}) and not currently loaded, then it will be
- * considered as a leaf and return 1.
+ * Returns the total number of leaf nodes in the subtree from this node. Note that if any nodes
+ * are "lazy" (see {@link GTreeLazyNode}) and not currently loaded, then it will be considered
+ * as a leaf and return 1.
+ *
* @return the total number of leaf nodes in the subtree from this node
*/
public int getLeafCount() {
@@ -227,6 +240,7 @@ public abstract class GTreeNode extends CoreGTreeNode implements Comparable<GTre
/**
* Returns the index of this node within its parent node
+ *
* @return the index of this node within its parent node
*/
public int getIndexInParent() {
@@ -238,8 +252,9 @@ public abstract class GTreeNode extends CoreGTreeNode implements Comparable<GTre
}
/**
- * Returns the index of the given node within this node. -1 is returned
- * if the node is not a child of this node.
+ * Returns the index of the given node within this node. -1 is returned if the node is not a
+ * child of this node.
+ *
* @param node whose index we want
* @return the index of the given node within this node
*/
@@ -249,6 +264,7 @@ public abstract class GTreeNode extends CoreGTreeNode implements Comparable<GTre
/**
* Returns the TreePath for this node
+ *
* @return the TreePath for this node
*/
public TreePath getTreePath() {
@@ -256,7 +272,7 @@ public abstract class GTreeNode extends CoreGTreeNode implements Comparable<GTre
}
/**
- * Removes all children from this node. The children nodes will be disposed.
+ * Removes all children from this node. The children nodes will be disposed.
*/
public void removeAll() {
Swing.runNow(() -> doSetChildrenAndFireEvent(null));
@@ -264,6 +280,7 @@ public abstract class GTreeNode extends CoreGTreeNode implements Comparable<GTre
/**
* Remove the given node from this node
+ *
* @param node the to be removed
*/
public void removeNode(GTreeNode node) {
@@ -271,7 +288,8 @@ public abstract class GTreeNode extends CoreGTreeNode implements Comparable<GTre
}
/**
- * Sets the children on this node. Any existing current children will be dispose.
+ * Sets the children on this node. Any existing current children will be dispose.
+ *
* @param childList this list of nodes to be set as children of this node
*/
public void setChildren(List<GTreeNode> childList) {
@@ -280,8 +298,9 @@ public abstract class GTreeNode extends CoreGTreeNode implements Comparable<GTre
/**
* Returns true if the given node is a child of this node or one of its children.
+ *
* @param node the potential descendant node to check
- * @return true if the given node is a child of this node or one of its children
+ * @return true if the given node is a child of this node or one of its children
*/
public boolean isAncestor(GTreeNode node) {
GTreeNode nodeParent = node.getParent();
@@ -295,9 +314,9 @@ public abstract class GTreeNode extends CoreGTreeNode implements Comparable<GTre
}
/**
- * Notification method called when a cell editor completes editing to notify this
- * node that its value has changed. If you override this method you must also override
- * {@link #isEditable()}.
+ * Notification method called when a cell editor completes editing to notify this node that its
+ * value has changed. If you override this method you must also override {@link #isEditable()}.
+ *
* @param newValue the new value provided by the cell editor
* @see #isEditable()
*/
@@ -306,9 +325,10 @@ public abstract class GTreeNode extends CoreGTreeNode implements Comparable<GTre
}
/**
- * Returns true if this node is allowed to be edited in the tree. You must override this
- * method to allow a node to be edited. You must also override {@link #valueChanged(Object)}
- * to handle the result of the edit.
+ * Returns true if this node is allowed to be edited in the tree. You must override this method
+ * to allow a node to be edited. You must also override {@link #valueChanged(Object)} to handle
+ * the result of the edit.
+ *
* @return true if this node is allowed to be edited in the tree
* @see #valueChanged(Object)
*/
@@ -317,8 +337,8 @@ public abstract class GTreeNode extends CoreGTreeNode implements Comparable<GTre
}
/**
- * Returns the rootNode for this tree or null if there is no parent path to a
- * root node.
+ * Returns the rootNode for this tree or null if there is no parent path to a root node.
+ *
* @return the rootNode for a tree of nodes in a {@link GTree}
*/
public GTreeNode getRoot() {
@@ -335,14 +355,15 @@ public abstract class GTreeNode extends CoreGTreeNode implements Comparable<GTre
/**
* Generates a filtered copy of this node and its children.
* <P>
- * A node will be included if it or any of its descendants are accepted by the filter.
- * NOTE: the filter will only be applied to a nodes children if they are loaded. So to
- * perform a filter on all the nodes in the tree, the {@link #loadAll(TaskMonitor)} should
- * be called before the filter call.
+ * A node will be included if it or any of its descendants are accepted by the filter. NOTE: the
+ * filter will only be applied to a nodes children if they are loaded. So to perform a filter on
+ * all the nodes in the tree, the {@link #loadAll(TaskMonitor)} should be called before the
+ * filter call.
+ *
* @param filter the filter being applied
* @param monitor a TaskMonitor for tracking the progress and cancelling
- * @return A copy of this node and its children that matches the filter or null
- * if this node and none of its children match the filter.
+ * @return A copy of this node and its children that matches the filter or null if this node and
+ * none of its children match the filter.
* @throws CancelledException if the operation is cancelled via the TaskMonitor
* @throws CloneNotSupportedException if any nodes in the tree explicitly prevents cloning
*/
@@ -371,9 +392,10 @@ public abstract class GTreeNode extends CoreGTreeNode implements Comparable<GTre
}
/**
- * Causes any lazy or slow loading nodes in the tree to load their children so that the tree
- * is fully loaded. Nodes that are already loaded (including normal nodes which are always loaded)
+ * Causes any lazy or slow loading nodes in the tree to load their children so that the tree is
+ * fully loaded. Nodes that are already loaded (including normal nodes which are always loaded)
* do nothing except recursively call {@link #loadAll(TaskMonitor)} on their children.
+ *
* @param monitor the TaskMonitor to monitor progress and provide cancel checking
* @return the total number of nodes in the subtree of this node
* @throws CancelledException if the operation is cancelled using the monitor
@@ -412,7 +434,9 @@ public abstract class GTreeNode extends CoreGTreeNode implements Comparable<GTre
/**
* Returns a stream of the GTree nodes in the subtree of this node
- * @param depthFirst if true, the nodes will be streamed in depth-first order, otherwise breadth-first order
+ *
+ * @param depthFirst if true, the nodes will be streamed in depth-first order, otherwise
+ * breadth-first order
* @return a stream of the GTree nodes in the subtree of this node
*/
public Stream<GTreeNode> stream(boolean depthFirst) {
@@ -421,7 +445,9 @@ public abstract class GTreeNode extends CoreGTreeNode implements Comparable<GTre
/**
* Returns an iterator of the GTree nodes in the subtree of this node
- * @param depthFirst if true, the nodes will be returned in depth-first order, otherwise breadth-first order
+ *
+ * @param depthFirst if true, the nodes will be returned in depth-first order, otherwise
+ * breadth-first order
* @return an iterator of the GTree nodes in the subtree of this node
*/
public Iterator<GTreeNode> iterator(boolean depthFirst) {
@@ -437,24 +463,22 @@ public abstract class GTreeNode extends CoreGTreeNode implements Comparable<GTre
}
/**
- * Notifies the tree that the node has different children. This method
- * @param node the node that has changed.
+ * Notifies the tree that the node has different children.
*/
- public void fireNodeStructureChanged(GTreeNode node) {
+ public void fireNodeStructureChanged() {
Swing.runNow(() -> doFireNodeStructureChanged());
}
/**
- * Notifies the tree that a node has changed
- * @param parentNode the node that contains the node that was changed
- * @param node the that changed
+ * Notifies the tree that a node has changed, excluding its children. If it has gained or lost
+ * children, then use {@link #fireNodeStructureChanged()} instead.
*/
- public void fireNodeChanged(GTreeNode parentNode, GTreeNode node) {
+ public void fireNodeChanged() {
Swing.runNow(() -> doFireNodeChanged());
}
/**
- * Convenience method for expanding (opening) this node in the tree. If this node is not
+ * Convenience method for expanding (opening) this node in the tree. If this node is not
* currently attached to a visible tree, then this call does nothing
*/
public void expand() {
@@ -465,7 +489,7 @@ public abstract class GTreeNode extends CoreGTreeNode implements Comparable<GTre
}
/**
- * Convenience method for collapsing (closing) this node in the tree. If this node is not
+ * Convenience method for collapsing (closing) this node in the tree. If this node is not
* currently attached to a visible tree, then this call does nothing
*/
public void collapse() {
@@ -476,7 +500,7 @@ public abstract class GTreeNode extends CoreGTreeNode implements Comparable<GTre
}
/**
- * Convenience method determining if this node is expanded in a tree. If the node is not
+ * Convenience method determining if this node is expanded in a tree. If the node is not
* currently attached to a visible tree, then this call returns false
*
* @return true if the node is expanded in a currently visible tree.
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/widgets/tree/GTreeSlowLoadingNode.java b/Ghidra/Framework/Docking/src/main/java/docking/widgets/tree/GTreeSlowLoadingNode.java
index d5353aa530..2ef63a7979 100644
--- a/Ghidra/Framework/Docking/src/main/java/docking/widgets/tree/GTreeSlowLoadingNode.java
+++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/tree/GTreeSlowLoadingNode.java
@@ -25,15 +25,17 @@ import ghidra.util.task.TaskMonitor;
import util.CollectionUtils;
/**
- * Base class for nodes that generate their children on demand, but because generating their children
- * is slow, that operation is moved to a background thread. While the children are being generated,
- * an {@link InProgressGTreeNode} will appear in the tree until the {@link LoadChildrenTask} has completed.
+ * Base class for nodes that generate their children on demand, but because generating their
+ * children is slow, that operation is moved to a background thread. While the children are being
+ * generated, an {@link InProgressGTreeNode} will appear in the tree until the
+ * {@link LoadChildrenTask} has completed.
*/
public abstract class GTreeSlowLoadingNode extends GTreeLazyNode {
/**
* 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)
+ *
* @param monitor a TaskMonitor for reporting progress and cancel notification.
* @return the list of children for this node.
* @throws CancelledException if the monitor is cancelled
@@ -95,7 +97,7 @@ public abstract class GTreeSlowLoadingNode extends GTreeLazyNode {
// had a chance to run. Since we last left the JTree thinking there is an
// "in progress" node in place, we need to notify the JTree that this is no longer
// the case.
- fireNodeStructureChanged(GTreeSlowLoadingNode.this);
+ fireNodeStructureChanged();
return;
}
diff --git a/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/datatree/DomainFileNode.java b/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/datatree/DomainFileNode.java
index 2e89a33d6a..c655a5d954 100644
--- a/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/datatree/DomainFileNode.java
+++ b/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/datatree/DomainFileNode.java
@@ -58,8 +58,9 @@ public class DomainFileNode extends GTreeNode implements Cuttable {
}
/**
- * Get the domain file if this node represents a file object versus
- * a folder; interface method for DomainDataTransfer.
+ * Get the domain file if this node represents a file object versus a folder; interface method
+ * for DomainDataTransfer.
+ *
* @return null if this node represents a domain folder
*/
public DomainFile getDomainFile() {
@@ -99,13 +100,12 @@ public class DomainFileNode extends GTreeNode implements Cuttable {
}
/**
- * Set this node to be deleted so that it can be
- * rendered as such.
+ * Set this node to be deleted so that it can be rendered as such.
*/
@Override
public void setIsCut(boolean isCut) {
this.isCut = isCut;
- fireNodeChanged(getParent(), this);
+ fireNodeChanged();
}
/**
@@ -165,8 +165,8 @@ public class DomainFileNode extends GTreeNode implements Cuttable {
/**
* Update the display name.
- * @return true if the node should be reloaded because the
- * display name has changed
+ *
+ * @return true if the node should be reloaded because the display name has changed
*/
void refresh() {
DomainFileNodeSwingWorker worker = new DomainFileNodeSwingWorker();
@@ -215,7 +215,7 @@ public class DomainFileNode extends GTreeNode implements Cuttable {
icon = domainFile.getIcon(false);
disabledIcon = ResourceManager.getDisabledIcon(icon);
- fireNodeChanged(getParent(), this);
+ fireNodeChanged();
}
private void setToolTipText() {
diff --git a/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/datatree/DomainFolderNode.java b/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/datatree/DomainFolderNode.java
index f9dd5cf94e..352c86f160 100644
--- a/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/datatree/DomainFolderNode.java
+++ b/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/datatree/DomainFolderNode.java
@@ -63,8 +63,7 @@ public class DomainFolderNode extends GTreeLazyNode implements Cuttable {
}
/**
- * Get the domain folder; returns null if this node represents a
- * domain file.
+ * Get the domain folder; returns null if this node represents a domain file.
*
* @return DomainFolder
*/
@@ -81,13 +80,12 @@ public class DomainFolderNode extends GTreeLazyNode implements Cuttable {
}
/**
- * Set this node to be deleted so that it can be
- * rendered as such.
+ * Set this node to be deleted so that it can be rendered as such.
*/
@Override
public void setIsCut(boolean isCut) {
this.isCut = isCut;
- fireNodeChanged(getParent(), this);
+ fireNodeChanged();
}
/**
diff --git a/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/datatree/DomainFolderRootNode.java b/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/datatree/DomainFolderRootNode.java
index 792ccfc137..d47579cbe6 100644
--- a/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/datatree/DomainFolderRootNode.java
+++ b/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/datatree/DomainFolderRootNode.java
@@ -51,7 +51,7 @@ public class DomainFolderRootNode extends DomainFolderNode {
void setName(String newName) {
projectName = newName;
- fireNodeChanged(null, this);
+ fireNodeChanged();
}
@Override
diff --git a/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/projectdata/actions/ProjectDataReadOnlyAction.java b/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/projectdata/actions/ProjectDataReadOnlyAction.java
index f36e389319..59e058b72a 100644
--- a/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/projectdata/actions/ProjectDataReadOnlyAction.java
+++ b/Ghidra/Framework/Project/src/main/java/ghidra/framework/main/projectdata/actions/ProjectDataReadOnlyAction.java
@@ -38,7 +38,7 @@ public class ProjectDataReadOnlyAction extends ProjectDataContextToggleAction {
Object contextObject = context.getContextObject();
if (contextObject instanceof DomainFileNode) {
DomainFileNode node = (DomainFileNode) contextObject;
- node.fireNodeChanged(node.getParent(), node);
+ node.fireNodeChanged();
}
}