mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 10:19:23 +02:00
GT-2824 - Comments - fixed infinite loop when editing comments
This commit is contained in:
parent
8f9a8dd1b1
commit
d33ffc2855
17 changed files with 853 additions and 516 deletions
|
@ -1989,15 +1989,14 @@ public abstract class AbstractDockingTest extends AbstractGenericTest {
|
|||
if (!rootNode.getName().equals(rootName)) {
|
||||
throw new RuntimeException(
|
||||
"When selecting paths by name the first path element must be the " +
|
||||
"name of the root node - path: " +
|
||||
StringUtilities.convertStringArray(path, "."));
|
||||
"name of the root node - path: " + StringUtils.join(path, '.'));
|
||||
}
|
||||
GTreeNode node = rootNode;
|
||||
for (int i = 1; i < path.length; i++) {
|
||||
GTreeNode child = node.getChild(path[i]);
|
||||
if (child == null) {
|
||||
throw new RuntimeException("Can't find path " +
|
||||
StringUtilities.convertStringArray(path, ".") + " failed at " + path[i]);
|
||||
throw new RuntimeException(
|
||||
"Can't find path " + StringUtils.join(path, '.') + " failed at " + path[i]);
|
||||
}
|
||||
node = child;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
/* ###
|
||||
* IP: GHIDRA
|
||||
* REVIEWED: YES
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -16,17 +15,17 @@
|
|||
*/
|
||||
package docking.widgets.tree.tasks;
|
||||
|
||||
import ghidra.util.Msg;
|
||||
import ghidra.util.StringUtilities;
|
||||
import ghidra.util.exception.CancelledException;
|
||||
import ghidra.util.task.TaskMonitor;
|
||||
|
||||
import javax.swing.JTree;
|
||||
import javax.swing.tree.TreePath;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import docking.widgets.tree.*;
|
||||
import docking.widgets.tree.internal.GTreeSelectionModel;
|
||||
import docking.widgets.tree.support.GTreeSelectionEvent.EventOrigin;
|
||||
import ghidra.util.Msg;
|
||||
import ghidra.util.exception.CancelledException;
|
||||
import ghidra.util.task.TaskMonitor;
|
||||
|
||||
public class GTreeSelectNodeByNameTask extends GTreeTask {
|
||||
|
||||
|
@ -49,7 +48,7 @@ public class GTreeSelectNodeByNameTask extends GTreeTask {
|
|||
String rootName = names[0];
|
||||
if (!node.getName().equals(rootName)) {
|
||||
Msg.debug(this, "When selecting paths by name the first path element must be the " +
|
||||
"name of the root node - path: " + StringUtilities.convertStringArray(names, "."));
|
||||
"name of the root node - path: " + StringUtils.join(names, '.'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -57,10 +56,8 @@ public class GTreeSelectNodeByNameTask extends GTreeTask {
|
|||
monitor.checkCanceled();
|
||||
node = findNodeByName(node, names[i], monitor);
|
||||
if (node == null) {
|
||||
Msg.debug(
|
||||
this,
|
||||
"Could not find node to select - path: " +
|
||||
StringUtilities.convertStringArray(names, "."));
|
||||
Msg.debug(this,
|
||||
"Could not find node to select - path: " + StringUtils.join(names, '.'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -80,17 +77,14 @@ public class GTreeSelectNodeByNameTask extends GTreeTask {
|
|||
}
|
||||
|
||||
private void selectPath(final TreePath treePath, final TaskMonitor monitor) {
|
||||
runOnSwingThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (monitor.isCancelled()) {
|
||||
return; // we can be cancelled while waiting for Swing to run us
|
||||
}
|
||||
|
||||
GTreeSelectionModel selectionModel = tree.getGTSelectionModel();
|
||||
selectionModel.setSelectionPaths(new TreePath[] { treePath }, origin);
|
||||
jTree.scrollPathToVisible(treePath);
|
||||
runOnSwingThread(() -> {
|
||||
if (monitor.isCancelled()) {
|
||||
return; // we can be cancelled while waiting for Swing to run us
|
||||
}
|
||||
|
||||
GTreeSelectionModel selectionModel = tree.getGTSelectionModel();
|
||||
selectionModel.setSelectionPaths(new TreePath[] { treePath }, origin);
|
||||
jTree.scrollPathToVisible(treePath);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue