Merge remote-tracking branch 'origin/GP-2780-dragonmacher-fixed-options-name-with-dot' into patch

This commit is contained in:
Ryan Kurtz
2022-11-03 10:50:47 -04:00
3 changed files with 14 additions and 6 deletions
@@ -65,7 +65,8 @@ import resources.ResourceManager;
import resources.icons.RotateIcon;
public interface DebuggerResources {
String OPTIONS_CATEGORY_WORKFLOW = "Debugger.Workflow";
String OPTIONS_CATEGORY_DEBUGGER = "Debugger";
String OPTIONS_CATEGORY_WORKFLOW = "Workflow";
ImageIcon ICON_DEBUGGER = ResourceManager.loadImage("images/debugger.png");
@@ -128,7 +128,7 @@ public class DebuggerWorkflowServicePlugin extends Plugin
/* testing */ final List<DebuggerBot> allBots = new ArrayList<>();
// Cannot auto-wire, since they're dynamically populated
private final ToolOptions options;
private final Options options;
@SuppressWarnings("hiding") // I'm FrontEndOnly
protected final FrontEndTool tool;
@@ -140,8 +140,9 @@ public class DebuggerWorkflowServicePlugin extends Plugin
this.tool = (FrontEndTool) tool; // I'm FrontEndOnly
this.autoServiceWiring = AutoService.wireServicesProvidedAndConsumed(this);
this.options = tool.getOptions(DebuggerResources.OPTIONS_CATEGORY_WORKFLOW);
this.options.addOptionsChangeListener(this);
ToolOptions rootOptions = tool.getOptions(DebuggerResources.OPTIONS_CATEGORY_DEBUGGER);
rootOptions.addOptionsChangeListener(this);
this.options = rootOptions.getOptions(DebuggerResources.OPTIONS_CATEGORY_WORKFLOW);
}
@@ -33,6 +33,7 @@ import ghidra.framework.plugintool.dialog.KeyBindingsPanel;
import ghidra.framework.plugintool.util.OptionsService;
import ghidra.util.HelpLocation;
import ghidra.util.Msg;
import ghidra.util.exception.AssertException;
/**
* Created by PluginTool to manage the set of Options for each category.
@@ -61,6 +62,12 @@ public class OptionsManager implements OptionsService, OptionsChangeListener {
@Override
public ToolOptions getOptions(String category) {
if (category.contains(Options.DELIMITER_STRING)) {
throw new AssertException(
"Options category cannot contain the options path delimiter '" + Options.DELIMITER +
"'");
}
ToolOptions opt = optionsMap.get(category);
if (opt == null) {
opt = new ToolOptions(category);
@@ -245,8 +252,7 @@ public class OptionsManager implements OptionsService, OptionsChangeListener {
}
private void removeUnusedOptions(List<String> deleteList) {
for (int i = 0; i < deleteList.size(); i++) {
String name = deleteList.get(i);
for (String name : deleteList) {
ToolOptions options = optionsMap.remove(name);
options.removeOptionsChangeListener(this);
}