mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-09-28 17:11:11 -09:00
Test fixes
This commit is contained in:
@@ -175,9 +175,8 @@ public abstract class AbstractOptions implements Options {
|
||||
}
|
||||
|
||||
private void warnShouldUseTheme(String optionType) {
|
||||
Throwable throwable =
|
||||
ReflectionUtilities.createThrowableWithStackOlderThan(AbstractOptions.class,
|
||||
SubOptions.class);
|
||||
Throwable throwable = ReflectionUtilities
|
||||
.createThrowableWithStackOlderThan(AbstractOptions.class, SubOptions.class);
|
||||
String call = throwable.getStackTrace()[0].toString();
|
||||
Msg.warn(this, "Registering a direct " + optionType + " in the options is deprecated." +
|
||||
" Use registerTheme" + optionType + "Binding() instead!\n Called from " + call + "\n");
|
||||
@@ -343,8 +342,15 @@ public abstract class AbstractOptions implements Options {
|
||||
Object oldValue = option.getCurrentValue();
|
||||
option.setCurrentValue(newValue);
|
||||
|
||||
if (!notifyOptionChanged(optionName, oldValue, newValue)) {
|
||||
option.setCurrentValue(oldValue);
|
||||
boolean success = false;
|
||||
try {
|
||||
// this can throw an OptionsVetoException
|
||||
success = notifyOptionChanged(optionName, oldValue, newValue);
|
||||
}
|
||||
finally {
|
||||
if (!success) {
|
||||
option.setCurrentValue(oldValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -117,16 +117,25 @@ public class EditorState implements PropertyChangeListener {
|
||||
return;
|
||||
}
|
||||
|
||||
options.putObject(name, currentValue);
|
||||
Object newValue = options.getObject(name, null);
|
||||
boolean success = Objects.equals(currentValue, newValue);
|
||||
if (success) {
|
||||
originalValue = newValue;
|
||||
currentValue = newValue;
|
||||
//
|
||||
// The call to put() may throw an exception or may choose not to take the new value. Handle
|
||||
// both cases using a finally block along with checking the value after making the put()
|
||||
// call.
|
||||
//
|
||||
try {
|
||||
options.putObject(name, currentValue);
|
||||
}
|
||||
else {
|
||||
editor.setValue(originalValue);
|
||||
currentValue = originalValue;
|
||||
finally {
|
||||
Object newValue = options.getObject(name, null);
|
||||
boolean success = Objects.equals(currentValue, newValue);
|
||||
if (success) {
|
||||
originalValue = newValue;
|
||||
currentValue = newValue;
|
||||
}
|
||||
else {
|
||||
editor.setValue(originalValue);
|
||||
currentValue = originalValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user