mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-01-09 14:08:03 -05:00
GP-6024 - Version Tracking - Fixed missing tool options
This commit is contained in:
@@ -425,7 +425,6 @@ class PluginManager {
|
||||
private void unregisterPlugin(Plugin plugin) {
|
||||
if (pluginList.remove(plugin)) {
|
||||
plugin.cleanup();
|
||||
tool.getOptionsManager().deregisterOwner(plugin);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@@ -28,7 +28,6 @@ import docking.options.editor.OptionsDialog;
|
||||
import docking.tool.ToolConstants;
|
||||
import docking.tool.util.DockingToolConstants;
|
||||
import ghidra.framework.options.*;
|
||||
import ghidra.framework.plugintool.Plugin;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.framework.plugintool.dialog.KeyBindingsPanel;
|
||||
import ghidra.util.HelpLocation;
|
||||
@@ -111,9 +110,7 @@ public class OptionsManager implements OptionsService, OptionsChangeListener {
|
||||
public ToolOptions[] getOptions() {
|
||||
ToolOptions[] opt = new ToolOptions[optionsMap.size()];
|
||||
int idx = 0;
|
||||
Iterator<String> iter = optionsMap.keySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
String key = iter.next();
|
||||
for (String key : optionsMap.keySet()) {
|
||||
opt[idx] = optionsMap.get(key);
|
||||
++idx;
|
||||
}
|
||||
@@ -121,24 +118,6 @@ public class OptionsManager implements OptionsService, OptionsChangeListener {
|
||||
return opt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deregister the owner from the options; if options are empty, then
|
||||
* remove the options from the map.
|
||||
* @param ownerPlugin the owner plugin
|
||||
*/
|
||||
public void deregisterOwner(Plugin ownerPlugin) {
|
||||
List<String> deleteList = new ArrayList<>();
|
||||
Iterator<String> iter = optionsMap.keySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
String key = iter.next();
|
||||
ToolOptions opt = optionsMap.get(key);
|
||||
if (opt.getOptionNames().isEmpty()) {
|
||||
deleteList.add(opt.getName());
|
||||
}
|
||||
}
|
||||
removeUnusedOptions(deleteList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Write this object out; first remove any unused options so they
|
||||
* do not hang around.
|
||||
@@ -146,9 +125,7 @@ public class OptionsManager implements OptionsService, OptionsChangeListener {
|
||||
*/
|
||||
public Element getConfigState() {
|
||||
Element root = new Element("OPTIONS");
|
||||
Iterator<String> iter = optionsMap.keySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
String key = iter.next();
|
||||
for (String key : optionsMap.keySet()) {
|
||||
ToolOptions opt = optionsMap.get(key);
|
||||
if (hasNonDefaultValues(opt)) {
|
||||
root.addContent(opt.getXmlRoot(false));
|
||||
@@ -170,9 +147,7 @@ public class OptionsManager implements OptionsService, OptionsChangeListener {
|
||||
public void removeUnusedOptions() {
|
||||
// 1st clean up any unused options before saving...
|
||||
List<String> deleteList = new ArrayList<>();
|
||||
Iterator<String> iter = optionsMap.keySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
String key = iter.next();
|
||||
for (String key : optionsMap.keySet()) {
|
||||
ToolOptions opt = optionsMap.get(key);
|
||||
opt.removeUnusedOptions();
|
||||
if (opt.getOptionNames().isEmpty()) {
|
||||
@@ -239,9 +214,9 @@ public class OptionsManager implements OptionsService, OptionsChangeListener {
|
||||
}
|
||||
|
||||
keyBindingOptions.registerOptionsEditor(() -> new KeyBindingOptionsEditor());
|
||||
OptionsDialog dialog =
|
||||
new OptionsDialog("Options for " + tool.getName(), "Options", getEditableOptions(),
|
||||
null, true);
|
||||
String optionsName = "Options for " + tool.getName();
|
||||
Options[] options = getEditableOptions();
|
||||
OptionsDialog dialog = new OptionsDialog(optionsName, "Options", options, null, true);
|
||||
dialog.setSelectedPath(path);
|
||||
dialog.setHelpLocation(
|
||||
new HelpLocation(ToolConstants.TOOL_HELP_TOPIC, "ToolOptions_Dialog"));
|
||||
|
||||
Reference in New Issue
Block a user