mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-09-07 09:11:15 -09:00
GP-4261 - Version Tracking - Fixed 'Unregistered Option' tooltip
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user