mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-31 14:12:58 +08:00
Merge remote-tracking branch 'origin/GP-1-dragonmacher-help-validation-tweak'
This commit is contained in:
@@ -32,11 +32,11 @@ import javax.swing.UIManager;
|
|||||||
|
|
||||||
import docking.ComponentProvider;
|
import docking.ComponentProvider;
|
||||||
import docking.action.DockingActionIf;
|
import docking.action.DockingActionIf;
|
||||||
|
import generic.concurrent.GThreadPool;
|
||||||
import generic.util.WindowUtilities;
|
import generic.util.WindowUtilities;
|
||||||
import ghidra.util.*;
|
import ghidra.util.*;
|
||||||
import ghidra.util.exception.AssertException;
|
import ghidra.util.exception.AssertException;
|
||||||
import ghidra.util.exception.CancelledException;
|
import ghidra.util.exception.CancelledException;
|
||||||
import ghidra.util.task.TaskLauncher;
|
|
||||||
import ghidra.util.task.TaskMonitor;
|
import ghidra.util.task.TaskMonitor;
|
||||||
import resources.ResourceManager;
|
import resources.ResourceManager;
|
||||||
import utilities.util.reflection.ReflectionUtilities;
|
import utilities.util.reflection.ReflectionUtilities;
|
||||||
@@ -188,6 +188,7 @@ public class HelpManager implements HelpService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the master help set (the one into which all other help sets are merged).
|
* Returns the master help set (the one into which all other help sets are merged).
|
||||||
|
* @return the help set
|
||||||
*/
|
*/
|
||||||
public GHelpSet getMasterHelpSet() {
|
public GHelpSet getMasterHelpSet() {
|
||||||
return mainHS;
|
return mainHS;
|
||||||
@@ -443,21 +444,20 @@ public class HelpManager implements HelpService {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskLauncher.launchNonModal("Validating Help", monitor -> {
|
GThreadPool.runAsync(Swing.GSWING_THREAD_POOL_NAME, this::doPrintBadHelp);
|
||||||
try {
|
|
||||||
printBadHelp(monitor);
|
|
||||||
}
|
|
||||||
catch (CancelledException e) {
|
|
||||||
// user cancelled; just exit
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void printBadHelp(TaskMonitor monitor) throws CancelledException {
|
private void doPrintBadHelp() {
|
||||||
|
|
||||||
Map<Object, HelpLocation> badHelp = getInvalidHelpLocations(monitor);
|
Map<Object, HelpLocation> badHelp;
|
||||||
if (badHelp.isEmpty()) {
|
try {
|
||||||
return;
|
badHelp = getInvalidHelpLocations(TaskMonitor.DUMMY);
|
||||||
|
if (badHelp.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (CancelledException e) {
|
||||||
|
return; // user cancelled
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder buffy = new StringBuilder();
|
StringBuilder buffy = new StringBuilder();
|
||||||
@@ -474,7 +474,6 @@ public class HelpManager implements HelpService {
|
|||||||
throws CancelledException {
|
throws CancelledException {
|
||||||
|
|
||||||
Map<Object, HelpLocation> map = new WeakHashMap<>();
|
Map<Object, HelpLocation> map = new WeakHashMap<>();
|
||||||
|
|
||||||
Map<Object, HelpLocation> helpLocationsCopy = copyHelpLocations();
|
Map<Object, HelpLocation> helpLocationsCopy = copyHelpLocations();
|
||||||
monitor.initialize(helpLocationsCopy.size());
|
monitor.initialize(helpLocationsCopy.size());
|
||||||
Set<Entry<Object, HelpLocation>> entries = helpLocationsCopy.entrySet();
|
Set<Entry<Object, HelpLocation>> entries = helpLocationsCopy.entrySet();
|
||||||
@@ -657,7 +656,7 @@ public class HelpManager implements HelpService {
|
|||||||
/**
|
/**
|
||||||
* Create a new help set for the given url, if one does
|
* Create a new help set for the given url, if one does
|
||||||
* not already exist.
|
* not already exist.
|
||||||
* @param classLoader
|
* @param classLoader the class loader
|
||||||
*/
|
*/
|
||||||
private HelpSet createHelpSet(URL url, GHelpClassLoader classLoader) throws HelpSetException {
|
private HelpSet createHelpSet(URL url, GHelpClassLoader classLoader) throws HelpSetException {
|
||||||
if (!urlToHelpSets.containsKey(url)) {
|
if (!urlToHelpSets.containsKey(url)) {
|
||||||
|
|||||||
@@ -76,6 +76,18 @@ public class GThreadPool {
|
|||||||
return threadPool;
|
return threadPool;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runs the given runnable in a background thread using a shared thread pool of the given name.
|
||||||
|
* @param poolName the thread pool name
|
||||||
|
* @param r the runnable
|
||||||
|
* @return the future
|
||||||
|
*/
|
||||||
|
public static CompletableFuture<Void> runAsync(String poolName, Runnable r) {
|
||||||
|
GThreadPool pool = getSharedThreadPool(poolName);
|
||||||
|
Executor ex = pool.getExecutor();
|
||||||
|
return CompletableFuture.runAsync(r, ex);
|
||||||
|
}
|
||||||
|
|
||||||
private GThreadPool(String name) {
|
private GThreadPool(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
executor = new GThreadPoolExecutor();
|
executor = new GThreadPoolExecutor();
|
||||||
|
|||||||
Reference in New Issue
Block a user