mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-22 04:05:39 +00:00
GT-2801: fixed analysis options bug causing apply button to not be
activated
This commit is contained in:
parent
227be22a1f
commit
59fb950c79
@ -33,6 +33,7 @@ import org.apache.commons.collections4.CollectionUtils;
|
||||
import docking.options.editor.GenericOptionsComponent;
|
||||
import docking.widgets.OptionDialog;
|
||||
import docking.widgets.table.*;
|
||||
import ghidra.GhidraOptions;
|
||||
import ghidra.app.services.Analyzer;
|
||||
import ghidra.framework.options.*;
|
||||
import ghidra.program.model.listing.Program;
|
||||
@ -465,20 +466,27 @@ class AnalysisPanel extends JPanel implements PropertyChangeListener {
|
||||
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
checkForDifferences();
|
||||
if (checkForDifferences()) {
|
||||
propertyChangeListener.propertyChange(
|
||||
new PropertyChangeEvent(this, GhidraOptions.APPLY_ENABLED, null, Boolean.TRUE));
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkForDifferences() {
|
||||
boolean changes = false;
|
||||
for (int i = 0; i < analyzerNames.size(); ++i) {
|
||||
String analyzerName = analyzerNames.get(i);
|
||||
boolean currEnabled = analyzerEnablement.get(i);
|
||||
boolean origEnabled = analysisOptions.getBoolean(analyzerName, false);
|
||||
if (currEnabled != origEnabled) {
|
||||
changes = true;
|
||||
propertyChangeListener.propertyChange(
|
||||
new PropertyChangeEvent(this, analyzerName, origEnabled, currEnabled));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (changes) {
|
||||
return true;
|
||||
}
|
||||
for (EditorState info : editorList) {
|
||||
if (info.isValueChanged()) {
|
||||
return true;
|
||||
@ -603,20 +611,17 @@ class AnalysisPanel extends JPanel implements PropertyChangeListener {
|
||||
public void updateOptionForAllPrograms(String analyzerName, boolean enabled) {
|
||||
for (Program program : programs) {
|
||||
|
||||
boolean commit = false;
|
||||
int id = program.startTransaction("Setting analysis property");
|
||||
try {
|
||||
// Check to make sure we're only handling events that relate to analyzers. If we
|
||||
// receive something else (eg: "analyze.apply") ignore it.
|
||||
Options options = program.getOptions(Program.ANALYSIS_PROPERTIES);
|
||||
|
||||
// Sanity check to make sure that the analyzer is appropriate for
|
||||
// this program. This should always be the case but it doesn't
|
||||
// hurt to check.
|
||||
if (!options.getOptionNames().contains(analyzerName)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean commit = false;
|
||||
int id = program.startTransaction("Setting analysis property " + analyzerName);
|
||||
try {
|
||||
options.setBoolean(analyzerName, enabled);
|
||||
|
||||
commit = true;
|
||||
}
|
||||
finally {
|
||||
@ -624,5 +629,4 @@ class AnalysisPanel extends JPanel implements PropertyChangeListener {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user