Ghidra is a software reverse engineering (SRE) framework
GP-4261 - Version Tracking - Fixed 'Unregistered Option' tooltip
dragonmachered8f22d47c60
diff --git a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/api/util/VTOptions.java b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/api/util/VTOptions.javaindex b026f6fc04..f14eb59018 100644--- a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/api/util/VTOptions.java+++ b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/api/util/VTOptions.java@@ -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.@@ -17,7 +17,7 @@ package ghidra.feature.vt.api.util;import org.jdom.Element;-import ghidra.framework.options.ToolOptions;+import ghidra.framework.options.*;public class VTOptions extends ToolOptions {@@ -42,4 +42,18 @@ public class VTOptions extends ToolOptions {public boolean validate() {return true;}++ @Override+ public String getDescription(String optionName) {+ Option option = getOption(optionName, OptionType.NO_TYPE, null);+ String description = option.getDescription();++ // Correlator factories may create an options object and set values without ever having+ // registered the option. Ideally we would update the VTOptions usage to make sure the+ // options are all registered. This check here is an easier fix.+ if (description.equals(Option.UNREGISTERED_OPTION)) {+ return option.getName();+ }+ return description;+ }}diff --git a/Ghidra/Framework/Gui/src/main/java/ghidra/framework/options/Option.java b/Ghidra/Framework/Gui/src/main/java/ghidra/framework/options/Option.javaindex 90c3c293b1..580ee354c2 100644--- a/Ghidra/Framework/Gui/src/main/java/ghidra/framework/options/Option.java+++ b/Ghidra/Framework/Gui/src/main/java/ghidra/framework/options/Option.java@@ -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.@@ -23,6 +23,8 @@ import ghidra.util.SystemUtilities;import utilities.util.reflection.ReflectionUtilities;public abstract class Option {+ public static final String UNREGISTERED_OPTION = "Unregistered Option";+private final String name;private Object defaultValue;private boolean isRegistered;@@ -89,7 +91,11 @@ public abstract class Option {}public String getDescription() {- return description == null ? "Unregistered Option" : description;+ // 'Unregistered Option' is returned when an option was never registered. It can also be+ // returned when an option value was set, but the option itself was never registered. In+ // that case, the isRegistered value is set to true, which means that a client has accessed+ // the option.+ return description == null ? UNREGISTERED_OPTION : description;}public Object getValue(Object passedInDefaultValue) {