mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-26 22:21:52 +00:00
GP-0 correct AnalysisOptionsTest failures
This commit is contained in:
parent
43476f2e20
commit
4e16b3aa3a
@ -29,7 +29,7 @@ import org.junit.*;
|
||||
import docking.action.DockingActionIf;
|
||||
import docking.widgets.OptionDialog;
|
||||
import docking.widgets.combobox.GhidraComboBox;
|
||||
import docking.widgets.dialogs.InputDialog;
|
||||
import docking.widgets.dialogs.InputWithChoicesDialog;
|
||||
import ghidra.app.plugin.core.codebrowser.CodeBrowserPlugin;
|
||||
import ghidra.app.services.ProgramManager;
|
||||
import ghidra.framework.Application;
|
||||
@ -276,7 +276,7 @@ public class AnalysisOptionsTest extends AbstractGhidraHeadedIntegrationTest {
|
||||
}
|
||||
|
||||
private void saveConfig(String name) {
|
||||
InputDialog dialog = waitForDialogComponent(InputDialog.class);
|
||||
InputWithChoicesDialog dialog = waitForDialogComponent(InputWithChoicesDialog.class);
|
||||
runSwing(() -> dialog.setValue(name));
|
||||
pressButtonByText(dialog, "OK");
|
||||
waitForSwing();
|
||||
|
@ -17,6 +17,7 @@ package docking.widgets.dialogs;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
@ -182,4 +183,17 @@ public class InputWithChoicesDialog extends DialogComponentProvider {
|
||||
Object selectedItem = combo.getSelectedItem();
|
||||
return selectedItem == null ? null : selectedItem.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the current choice to value.
|
||||
* @param value updated choice
|
||||
* @throws NoSuchElementException if choice does not permit edits and value is
|
||||
* not a valid choice.
|
||||
*/
|
||||
public void setValue(String value) {
|
||||
combo.setSelectedItem(value);
|
||||
if (!combo.isEditable() && !combo.getSelectedItem().equals(value)) {
|
||||
throw new NoSuchElementException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user