mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-06 03:50:02 +02:00
Test fixes; deprecation
This commit is contained in:
parent
81ea93cb29
commit
94e91bc417
5 changed files with 111 additions and 108 deletions
|
@ -288,21 +288,17 @@ public class ProgramManagerPlugin extends Plugin implements ProgramManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Program openProgram(DomainFile df, Component parent) {
|
public Program openProgram(DomainFile df, Component parent) {
|
||||||
return openProgram(df, -1, OPEN_CURRENT, parent);
|
return openProgram(df, -1, OPEN_CURRENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Program openProgram(final DomainFile df, final int version) {
|
public Program openProgram(DomainFile df, int version) {
|
||||||
return openProgram(df, version, OPEN_CURRENT);
|
return openProgram(df, version, OPEN_CURRENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Program openProgram(final DomainFile df, final int version, final int state) {
|
public Program openProgram(DomainFile domainFile, int version, int state) {
|
||||||
return openProgram(df, version, state, tool.getToolFrame());
|
|
||||||
}
|
|
||||||
|
|
||||||
private Program openProgram(final DomainFile domainFile, final int version, final int state,
|
|
||||||
final Component parent) {
|
|
||||||
if (domainFile == null) {
|
if (domainFile == null) {
|
||||||
throw new IllegalArgumentException("Domain file cannot be null");
|
throw new IllegalArgumentException("Domain file cannot be null");
|
||||||
}
|
}
|
||||||
|
@ -312,15 +308,12 @@ public class ProgramManagerPlugin extends Plugin implements ProgramManager {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
AtomicReference<Program> ref = new AtomicReference<>();
|
Program program = Swing.runNow(() -> {
|
||||||
Runnable r = () -> {
|
Program p = doOpenProgram(domainFile, version, state);
|
||||||
ref.set(doOpenProgram(domainFile, version, state));
|
|
||||||
updateActions();
|
updateActions();
|
||||||
};
|
return p;
|
||||||
|
});
|
||||||
|
|
||||||
SystemUtilities.runSwingNow(r);
|
|
||||||
|
|
||||||
Program program = ref.get();
|
|
||||||
if (program != null) {
|
if (program != null) {
|
||||||
Msg.info(this, "Opened program in " + tool.getName() + " tool: " + domainFile);
|
Msg.info(this, "Opened program in " + tool.getName() + " tool: " + domainFile);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,9 +26,8 @@ import ghidra.program.model.address.Address;
|
||||||
import ghidra.program.model.listing.Program;
|
import ghidra.program.model.listing.Program;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service for managing programs. Multiple programs may be open in a tool,
|
* Service for managing programs. Multiple programs may be open in a tool, but only one is active
|
||||||
* but only one is active at any given time.
|
* at any given time.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@ServiceInfo(defaultProvider = ProgramManagerPlugin.class, description = "Get the currently open program")
|
@ServiceInfo(defaultProvider = ProgramManagerPlugin.class, description = "Get the currently open program")
|
||||||
public interface ProgramManager {
|
public interface ProgramManager {
|
||||||
|
@ -59,11 +58,9 @@ public interface ProgramManager {
|
||||||
public Program getCurrentProgram();
|
public Program getCurrentProgram();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the specified program is open and considiered visible to
|
* Returns true if the specified program is open and considered visible to the user.
|
||||||
* the user.
|
* @param program the program
|
||||||
* @param program
|
* @return true if the specified program is open and considered visible to the user
|
||||||
* @return true if the specified program is open and considiered visible to
|
|
||||||
* the user
|
|
||||||
*/
|
*/
|
||||||
public boolean isVisible(Program program);
|
public boolean isVisible(Program program);
|
||||||
|
|
||||||
|
@ -75,8 +72,7 @@ public interface ProgramManager {
|
||||||
public boolean closeProgram();
|
public boolean closeProgram();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open the program corresponding to the given url. Once open it will
|
* Open the program corresponding to the given url.
|
||||||
* become
|
|
||||||
* @param ghidraURL valid server-based program URL
|
* @param ghidraURL valid server-based program URL
|
||||||
* @param state initial open state (OPEN_HIDDEN, OPEN_CURRENT, OPEN_VISIBLE).
|
* @param state initial open state (OPEN_HIDDEN, OPEN_CURRENT, OPEN_VISIBLE).
|
||||||
* The visibility states will be ignored if the program is already open.
|
* The visibility states will be ignored if the program is already open.
|
||||||
|
@ -94,6 +90,17 @@ public interface ProgramManager {
|
||||||
*/
|
*/
|
||||||
public Program openProgram(DomainFile domainFile);
|
public Program openProgram(DomainFile domainFile);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open the program for the given domainFile. Once open it will become the active program.
|
||||||
|
*
|
||||||
|
* <P>Note: this method functions exactly as {@link #openProgram(DomainFile)}
|
||||||
|
*
|
||||||
|
* @param domainFile domain file that has the program
|
||||||
|
* @param dialogParent unused
|
||||||
|
* @return the program
|
||||||
|
* @deprecated deprecated for 10.1; removal for 10.3 or later; use {@link #openProgram(DomainFile)}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public Program openProgram(DomainFile domainFile, Component dialogParent);
|
public Program openProgram(DomainFile domainFile, Component dialogParent);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -123,7 +130,7 @@ public interface ProgramManager {
|
||||||
* may not have it registered as open. The program is made the active program.
|
* may not have it registered as open. The program is made the active program.
|
||||||
* @param program the program to register as open with the tool.
|
* @param program the program to register as open with the tool.
|
||||||
*/
|
*/
|
||||||
void openProgram(Program program);
|
public void openProgram(Program program);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens the program to the tool. In this case the program is already open, but this tool
|
* Opens the program to the tool. In this case the program is already open, but this tool
|
||||||
|
@ -134,22 +141,21 @@ public interface ProgramManager {
|
||||||
* @deprecated use openProgram(Program program, int state) instead.
|
* @deprecated use openProgram(Program program, int state) instead.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
void openProgram(Program program, boolean current);
|
public void openProgram(Program program, boolean current);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open the specified program in te tool.
|
* Open the specified program in the tool.
|
||||||
* @param program
|
* @param program the program
|
||||||
* @param state initial open state (OPEN_HIDDEN, OPEN_CURRENT, OPEN_VISIBLE).
|
* @param state initial open state (OPEN_HIDDEN, OPEN_CURRENT, OPEN_VISIBLE).
|
||||||
* The visibility states will be ignored if the program is already open.
|
* The visibility states will be ignored if the program is already open.
|
||||||
*/
|
*/
|
||||||
public void openProgram(Program program, int state);
|
public void openProgram(Program program, int state);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Establish a persistent owner on an open program.
|
* Establish a persistent owner on an open program. This will cause the program manager to
|
||||||
* This will cause the program manager to simply make a program
|
* imply make a program hidden if it is closed.
|
||||||
* hidden if it is closed.
|
* @param program the program
|
||||||
* @param program
|
* @param owner the owner
|
||||||
* @param owner
|
|
||||||
* @return true if program is open and another object is not already the owner,
|
* @return true if program is open and another object is not already the owner,
|
||||||
* or the specified owner is already the owner.
|
* or the specified owner is already the owner.
|
||||||
* @see #releaseProgram(Program, Object)
|
* @see #releaseProgram(Program, Object)
|
||||||
|
@ -158,14 +164,14 @@ public interface ProgramManager {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Release the persistent ownership of a program.
|
* Release the persistent ownership of a program.
|
||||||
* The program will automatically be closed if it is hidden or was
|
* <p>
|
||||||
* marked as temporary. If any of these closures corresponds to a
|
* The program will automatically be closed if it is hidden or was marked as temporary. If
|
||||||
* program with changes the user will be given an opportunity to
|
* any of these closures corresponds to a program with changes the user will be given an
|
||||||
* save or keep the program open.
|
* opportunity to save or keep the program open.
|
||||||
* If persistentOwner is not the correct owner, the method will
|
* <p>
|
||||||
* have no affect.
|
* If persistentOwner is not the correct owner, the method will have no affect.
|
||||||
* @param program
|
* @param program the program
|
||||||
* @param persistentOwner
|
* @param persistentOwner the owner defined by {@link #setPersistentOwner(Program, Object)}
|
||||||
*/
|
*/
|
||||||
public void releaseProgram(Program program, Object persistentOwner);
|
public void releaseProgram(Program program, Object persistentOwner);
|
||||||
|
|
||||||
|
@ -192,7 +198,7 @@ public interface ProgramManager {
|
||||||
* @return true if all other programs were closed. Returns false if the user canceled the close
|
* @return true if all other programs were closed. Returns false if the user canceled the close
|
||||||
* while being prompted to save.
|
* while being prompted to save.
|
||||||
*/
|
*/
|
||||||
boolean closeOtherPrograms(boolean ignoreChanges);
|
public boolean closeOtherPrograms(boolean ignoreChanges);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closes all open programs in this tool. If this tool is the only tool with a program
|
* Closes all open programs in this tool. If this tool is the only tool with a program
|
||||||
|
@ -202,13 +208,13 @@ public interface ProgramManager {
|
||||||
* @return true if all programs were closed. Returns false if the user canceled the close
|
* @return true if all programs were closed. Returns false if the user canceled the close
|
||||||
* while being prompted to save.
|
* while being prompted to save.
|
||||||
*/
|
*/
|
||||||
boolean closeAllPrograms(boolean ignoreChanges);
|
public boolean closeAllPrograms(boolean ignoreChanges);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the given program to be the current active program in the tool.
|
* Sets the given program to be the current active program in the tool.
|
||||||
* @param p the program to make active.
|
* @param p the program to make active.
|
||||||
*/
|
*/
|
||||||
void setCurrentProgram(Program p);
|
public void setCurrentProgram(Program p);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the first program in the list of open programs that contains the given address.
|
* Returns the first program in the list of open programs that contains the given address.
|
||||||
|
@ -218,24 +224,28 @@ public interface ProgramManager {
|
||||||
* @param addr the address for which to search.
|
* @param addr the address for which to search.
|
||||||
* @return the first program that can be found to contain the given address.
|
* @return the first program that can be found to contain the given address.
|
||||||
*/
|
*/
|
||||||
Program getProgram(Address addr);
|
public Program getProgram(Address addr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of all open program.s
|
* Returns a list of all open program.
|
||||||
|
* @return the programs
|
||||||
*/
|
*/
|
||||||
Program[] getAllOpenPrograms();
|
public Program[] getAllOpenPrograms();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows program manager state to be locked/unlocked.
|
* Allows program manager state to be locked/unlocked. While locked, the program manager will
|
||||||
* While locked, the program manager will not support opening
|
* not support opening additional programs.
|
||||||
* additional programs.
|
|
||||||
* @param state locked if true, unlocked if false
|
* @param state locked if true, unlocked if false
|
||||||
|
* @deprecated deprecated for 10.1; removal for 10.3 or later
|
||||||
*/
|
*/
|
||||||
void lockDown(boolean state);
|
@Deprecated
|
||||||
|
public void lockDown(boolean state);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if program manager
|
* Returns true if program manager is in the locked state
|
||||||
* @return
|
* @return true if program manager is in the locked state
|
||||||
|
* @deprecated deprecated for 10.1; removal for 10.3 or later
|
||||||
*/
|
*/
|
||||||
boolean isLocked();
|
@Deprecated
|
||||||
|
public boolean isLocked();
|
||||||
}
|
}
|
||||||
|
|
|
@ -681,9 +681,9 @@ public class SearchTextPlugin1Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
AddressBasedTableModel<ProgramLocation> model) {
|
AddressBasedTableModel<ProgramLocation> model) {
|
||||||
GThreadedTablePanel<ProgramLocation> threadedTablePanel =
|
GThreadedTablePanel<ProgramLocation> threadedTablePanel =
|
||||||
(GThreadedTablePanel<ProgramLocation>) providers[0].getThreadedTablePanel();
|
(GThreadedTablePanel<ProgramLocation>) providers[0].getThreadedTablePanel();
|
||||||
final GTable table = threadedTablePanel.getTable();
|
GTable table = threadedTablePanel.getTable();
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
final int randomRow = random.nextInt(model.getRowCount());
|
int randomRow = random.nextInt(model.getRowCount());
|
||||||
|
|
||||||
DockingActionIf deleteRowAction = getAction(tool, "TableServicePlugin", "Remove Items");
|
DockingActionIf deleteRowAction = getAction(tool, "TableServicePlugin", "Remove Items");
|
||||||
ProgramLocation toBeDeleted = model.getRowObject(randomRow);
|
ProgramLocation toBeDeleted = model.getRowObject(randomRow);
|
||||||
|
@ -972,7 +972,7 @@ public class SearchTextPlugin1Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void searchOnce(JTextField tf) throws Exception {
|
private void searchOnce(JTextField tf) throws Exception {
|
||||||
final ActionListener listener = tf.getActionListeners()[0];
|
ActionListener listener = tf.getActionListeners()[0];
|
||||||
runSwing(() -> listener.actionPerformed(null));
|
runSwing(() -> listener.actionPerformed(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -155,7 +155,7 @@ public class SearchTextPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
JRadioButton exactRB = (JRadioButton) findAbstractButtonByText(container,
|
JRadioButton exactRB = (JRadioButton) findAbstractButtonByText(container,
|
||||||
SearchTextPlugin1Test.EXACT_MATCH_SEARCH);
|
SearchTextPlugin1Test.EXACT_MATCH_SEARCH);
|
||||||
assertNotNull(exactRB);
|
assertNotNull(exactRB);
|
||||||
assertTrue(!exactRB.isSelected());
|
assertFalse(exactRB.isSelected());
|
||||||
|
|
||||||
JRadioButton searchFieldsRB =
|
JRadioButton searchFieldsRB =
|
||||||
(JRadioButton) findAbstractButtonByText(container, "Selected Fields");
|
(JRadioButton) findAbstractButtonByText(container, "Selected Fields");
|
||||||
|
@ -188,24 +188,24 @@ public class SearchTextPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
|
|
||||||
JRadioButton searchAllRB = (JRadioButton) findAbstractButtonByText(container, "All Fields");
|
JRadioButton searchAllRB = (JRadioButton) findAbstractButtonByText(container, "All Fields");
|
||||||
assertNotNull(searchAllRB);
|
assertNotNull(searchAllRB);
|
||||||
assertTrue(!searchAllRB.isSelected());
|
assertFalse(searchAllRB.isSelected());
|
||||||
setSelected(searchAllRB);
|
setSelected(searchAllRB);
|
||||||
|
|
||||||
assertTrue(exactRB.isSelected());
|
assertTrue(exactRB.isSelected());
|
||||||
|
|
||||||
assertTrue(!functionCB.isEnabled());
|
assertFalse(functionCB.isEnabled());
|
||||||
assertTrue(!commentsCB.isEnabled());
|
assertFalse(commentsCB.isEnabled());
|
||||||
assertTrue(!labelCB.isEnabled());
|
assertFalse(labelCB.isEnabled());
|
||||||
assertTrue(!instMnemonicCB.isEnabled());
|
assertFalse(instMnemonicCB.isEnabled());
|
||||||
assertTrue(!instOpCB.isEnabled());
|
assertFalse(instOpCB.isEnabled());
|
||||||
assertTrue(!dataMnemonicCB.isEnabled());
|
assertFalse(dataMnemonicCB.isEnabled());
|
||||||
assertTrue(!dataOpCB.isEnabled());
|
assertFalse(dataOpCB.isEnabled());
|
||||||
|
|
||||||
// Select Quick Search --> Search Fields is selected
|
// Select Quick Search --> Search Fields is selected
|
||||||
setSelected(quickRB);
|
setSelected(quickRB);
|
||||||
|
|
||||||
assertTrue(searchFieldsRB.isSelected());
|
assertTrue(searchFieldsRB.isSelected());
|
||||||
assertTrue(!searchAllRB.isSelected());
|
assertFalse(searchAllRB.isSelected());
|
||||||
|
|
||||||
assertTrue(functionCB.isEnabled());
|
assertTrue(functionCB.isEnabled());
|
||||||
assertTrue(commentsCB.isEnabled());
|
assertTrue(commentsCB.isEnabled());
|
||||||
|
@ -434,7 +434,7 @@ public class SearchTextPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
waitForSwing();
|
waitForSwing();
|
||||||
cbPlugin.updateNow();
|
cbPlugin.updateNow();
|
||||||
loc = cbPlugin.getCurrentLocation();
|
loc = cbPlugin.getCurrentLocation();
|
||||||
assertTrue(!(addr.equals(loc.getAddress())));
|
assertFalse((addr.equals(loc.getAddress())));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -491,7 +491,7 @@ public class SearchTextPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
|
|
||||||
runSwing(() -> dismissButton.getActionListeners()[0].actionPerformed(null));
|
runSwing(() -> dismissButton.getActionListeners()[0].actionPerformed(null));
|
||||||
waitForSearchTasks(tempDialog);
|
waitForSearchTasks(tempDialog);
|
||||||
assertTrue(!tempDialog.isVisible());
|
assertFalse(tempDialog.isVisible());
|
||||||
}
|
}
|
||||||
|
|
||||||
private AbstractButton findButton(Container guiContainer, String text) {
|
private AbstractButton findButton(Container guiContainer, String text) {
|
||||||
|
@ -555,7 +555,7 @@ public class SearchTextPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
setTextAndPressEnter(tf, "hello");
|
setTextAndPressEnter(tf, "hello");
|
||||||
|
|
||||||
runSwing(() -> tool.removePlugins(new Plugin[] { plugin }));
|
runSwing(() -> tool.removePlugins(new Plugin[] { plugin }));
|
||||||
assertTrue(!tempDialog.isVisible());
|
assertFalse(tempDialog.isVisible());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void closeToolDuringSearch(String buttonText) throws Exception {
|
private void closeToolDuringSearch(String buttonText) throws Exception {
|
||||||
|
@ -588,7 +588,7 @@ public class SearchTextPlugin2Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
env.restartTool();
|
env.restartTool();
|
||||||
|
|
||||||
waitForSearchTasks(tempDialog);
|
waitForSearchTasks(tempDialog);
|
||||||
assertTrue(!tempDialog.isVisible());
|
assertFalse(tempDialog.isVisible());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void closeToolDuringSearch2(String buttonText) throws Exception {
|
private void closeToolDuringSearch2(String buttonText) throws Exception {
|
||||||
|
|
|
@ -194,29 +194,29 @@ public class SearchTextPlugin3Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
|
|
||||||
SearchTextDialog dialog = getDialog();
|
SearchTextDialog dialog = getDialog();
|
||||||
JComponent container = dialog.getComponent();
|
JComponent container = dialog.getComponent();
|
||||||
final JTextField tf = findTextField(container);
|
JTextField tf = findTextField(container);
|
||||||
|
|
||||||
JCheckBox cb = (JCheckBox) findAbstractButtonByText(container, "Functions");
|
JCheckBox cb = (JCheckBox) findAbstractButtonByText(container, "Functions");
|
||||||
cb.setSelected(true);
|
cb.setSelected(true);
|
||||||
|
|
||||||
cb = (JCheckBox) findAbstractButtonByText(container, "Labels");
|
cb = (JCheckBox) findAbstractButtonByText(container, "Labels");
|
||||||
cb.setSelected(true);
|
setToggleButtonSelected(cb, true);
|
||||||
|
|
||||||
cb = (JCheckBox) findAbstractButtonByText(container, "Instruction Mnemonics");
|
cb = (JCheckBox) findAbstractButtonByText(container, "Instruction Mnemonics");
|
||||||
cb.setSelected(true);
|
setToggleButtonSelected(cb, true);
|
||||||
|
|
||||||
cb = (JCheckBox) findAbstractButtonByText(container, "Instruction Operands");
|
cb = (JCheckBox) findAbstractButtonByText(container, "Instruction Operands");
|
||||||
cb.setSelected(true);
|
setToggleButtonSelected(cb, true);
|
||||||
|
|
||||||
cb = (JCheckBox) findAbstractButtonByText(container, "Defined Data Mnemonics");
|
cb = (JCheckBox) findAbstractButtonByText(container, "Defined Data Mnemonics");
|
||||||
cb.setSelected(true);
|
setToggleButtonSelected(cb, true);
|
||||||
|
|
||||||
cb = (JCheckBox) findAbstractButtonByText(container, "Defined Data Values");
|
cb = (JCheckBox) findAbstractButtonByText(container, "Defined Data Values");
|
||||||
cb.setSelected(true);
|
setToggleButtonSelected(cb, true);
|
||||||
|
|
||||||
goToService.goTo(new ProgramLocation(program, getAddr(0x01002c92)));
|
goToService.goTo(new ProgramLocation(program, getAddr(0x01002c92)));
|
||||||
|
|
||||||
final ActionListener listener = tf.getActionListeners()[0];
|
ActionListener listener = tf.getActionListeners()[0];
|
||||||
runSwing(() -> {
|
runSwing(() -> {
|
||||||
tf.setText("eax");
|
tf.setText("eax");
|
||||||
listener.actionPerformed(null);
|
listener.actionPerformed(null);
|
||||||
|
@ -281,10 +281,10 @@ public class SearchTextPlugin3Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
|
|
||||||
SearchTextDialog dialog = getDialog();
|
SearchTextDialog dialog = getDialog();
|
||||||
JComponent container = dialog.getComponent();
|
JComponent container = dialog.getComponent();
|
||||||
final JTextField tf = findTextField(container);
|
JTextField tf = findTextField(container);
|
||||||
final JButton searchButton = (JButton) findAbstractButtonByText(container, "Next");
|
JButton searchButton = (JButton) findAbstractButtonByText(container, "Next");
|
||||||
JCheckBox cb = (JCheckBox) findAbstractButtonByText(container, "Functions");
|
JCheckBox cb = (JCheckBox) findAbstractButtonByText(container, "Functions");
|
||||||
cb.setSelected(true);
|
setToggleButtonSelected(cb, true);
|
||||||
|
|
||||||
runSwing(() -> {
|
runSwing(() -> {
|
||||||
tf.setText("sscanf");
|
tf.setText("sscanf");
|
||||||
|
@ -296,8 +296,8 @@ public class SearchTextPlugin3Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
ProgramLocation loc = cbPlugin.getCurrentLocation();
|
ProgramLocation loc = cbPlugin.getCurrentLocation();
|
||||||
assertTrue(loc instanceof CommentFieldLocation);
|
assertTrue(loc instanceof CommentFieldLocation);
|
||||||
assertEquals(CodeUnit.PLATE_COMMENT, ((CommentFieldLocation) loc).getCommentType());
|
assertEquals(CodeUnit.PLATE_COMMENT, ((CommentFieldLocation) loc).getCommentType());
|
||||||
final ActionListener listener = searchButton.getActionListeners()[0];
|
|
||||||
|
|
||||||
|
ActionListener listener = searchButton.getActionListeners()[0];
|
||||||
runSwing(() -> listener.actionPerformed(null));
|
runSwing(() -> listener.actionPerformed(null));
|
||||||
|
|
||||||
waitForSearchTasks(dialog);
|
waitForSearchTasks(dialog);
|
||||||
|
@ -364,16 +364,16 @@ public class SearchTextPlugin3Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
|
|
||||||
SearchTextDialog dialog = getDialog();
|
SearchTextDialog dialog = getDialog();
|
||||||
JComponent container = dialog.getComponent();
|
JComponent container = dialog.getComponent();
|
||||||
final JTextField tf = findTextField(container);
|
JTextField tf = findTextField(container);
|
||||||
selectRadioButton(container, SearchTextPlugin1Test.EXACT_MATCH_SEARCH);
|
selectRadioButton(container, SearchTextPlugin1Test.EXACT_MATCH_SEARCH);
|
||||||
JCheckBox cb = (JCheckBox) findAbstractButtonByText(container, "Instruction Mnemonics");
|
JCheckBox cb = (JCheckBox) findAbstractButtonByText(container, "Instruction Mnemonics");
|
||||||
cb.setSelected(true);
|
setToggleButtonSelected(cb, true);
|
||||||
|
|
||||||
cb = (JCheckBox) findAbstractButtonByText(container, "Instruction Operands");
|
cb = (JCheckBox) findAbstractButtonByText(container, "Instruction Operands");
|
||||||
cb.setSelected(true);
|
setToggleButtonSelected(cb, true);
|
||||||
|
|
||||||
cb = (JCheckBox) findAbstractButtonByText(container, "Comments");
|
cb = (JCheckBox) findAbstractButtonByText(container, "Comments");
|
||||||
cb.setSelected(false);
|
setToggleButtonSelected(cb, false);
|
||||||
|
|
||||||
goToService.goTo(new ProgramLocation(program, getAddr(0x01004160)));
|
goToService.goTo(new ProgramLocation(program, getAddr(0x01004160)));
|
||||||
runSwing(() -> tf.setText("sscanf"));
|
runSwing(() -> tf.setText("sscanf"));
|
||||||
|
@ -455,15 +455,15 @@ public class SearchTextPlugin3Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
final JTextField tf = findTextField(container);
|
final JTextField tf = findTextField(container);
|
||||||
selectRadioButton(container, SearchTextPlugin1Test.EXACT_MATCH_SEARCH);
|
selectRadioButton(container, SearchTextPlugin1Test.EXACT_MATCH_SEARCH);
|
||||||
JCheckBox cb = (JCheckBox) findAbstractButtonByText(container, "Instruction Mnemonics");
|
JCheckBox cb = (JCheckBox) findAbstractButtonByText(container, "Instruction Mnemonics");
|
||||||
cb.setSelected(true);
|
setToggleButtonSelected(cb, true);
|
||||||
|
|
||||||
cb = (JCheckBox) findAbstractButtonByText(container, "Instruction Operands");
|
cb = (JCheckBox) findAbstractButtonByText(container, "Instruction Operands");
|
||||||
cb.setSelected(true);
|
setToggleButtonSelected(cb, true);
|
||||||
|
|
||||||
cb = (JCheckBox) findAbstractButtonByText(container, "Comments");
|
cb = (JCheckBox) findAbstractButtonByText(container, "Comments");
|
||||||
cb.setSelected(false);
|
setToggleButtonSelected(cb, true);
|
||||||
// Backwards
|
|
||||||
|
|
||||||
|
// Backwards
|
||||||
goToService.goTo(new ProgramLocation(program, getAddr(0x01004160)));
|
goToService.goTo(new ProgramLocation(program, getAddr(0x01004160)));
|
||||||
runSwing(() -> tf.setText("call sscanf"));
|
runSwing(() -> tf.setText("call sscanf"));
|
||||||
JButton searchButton = (JButton) findAbstractButtonByText(container, "Previous");
|
JButton searchButton = (JButton) findAbstractButtonByText(container, "Previous");
|
||||||
|
@ -492,19 +492,19 @@ public class SearchTextPlugin3Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
@Test
|
@Test
|
||||||
public void testHighlights() throws Exception {
|
public void testHighlights() throws Exception {
|
||||||
|
|
||||||
final SearchTextDialog dialog = getDialog();
|
SearchTextDialog dialog = getDialog();
|
||||||
JComponent container = dialog.getComponent();
|
JComponent container = dialog.getComponent();
|
||||||
final JTextField tf = findTextField(container);
|
JTextField tf = findTextField(container);
|
||||||
JCheckBox cb = (JCheckBox) findAbstractButtonByText(container, "Instruction Mnemonics");
|
JCheckBox cb = (JCheckBox) findAbstractButtonByText(container, "Instruction Mnemonics");
|
||||||
cb.setSelected(true);
|
setToggleButtonSelected(cb, true);
|
||||||
|
|
||||||
cb = (JCheckBox) findAbstractButtonByText(container, "Instruction Operands");
|
cb = (JCheckBox) findAbstractButtonByText(container, "Instruction Operands");
|
||||||
cb.setSelected(true);
|
setToggleButtonSelected(cb, true);
|
||||||
|
|
||||||
cb = (JCheckBox) findAbstractButtonByText(container, "Functions");
|
cb = (JCheckBox) findAbstractButtonByText(container, "Functions");
|
||||||
cb.setSelected(true);
|
setToggleButtonSelected(cb, true);
|
||||||
|
|
||||||
final String searchText = "param_";
|
String searchText = "param_";
|
||||||
runSwing(() -> {
|
runSwing(() -> {
|
||||||
tf.setText(searchText);
|
tf.setText(searchText);
|
||||||
ActionListener[] listeners = tf.getActionListeners();
|
ActionListener[] listeners = tf.getActionListeners();
|
||||||
|
@ -543,19 +543,19 @@ public class SearchTextPlugin3Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testHighlightsWithMultipleProviders() throws Exception {
|
public void testHighlightsWithMultipleProviders() throws Exception {
|
||||||
final SearchTextDialog dialog = getDialog();
|
SearchTextDialog dialog = getDialog();
|
||||||
JComponent container = dialog.getComponent();
|
JComponent container = dialog.getComponent();
|
||||||
final JTextField tf = findTextField(container);
|
JTextField tf = findTextField(container);
|
||||||
JCheckBox cb = (JCheckBox) findAbstractButtonByText(container, "Instruction Mnemonics");
|
JCheckBox cb = (JCheckBox) findAbstractButtonByText(container, "Instruction Mnemonics");
|
||||||
cb.setSelected(true);
|
setToggleButtonSelected(cb, true);
|
||||||
|
|
||||||
cb = (JCheckBox) findAbstractButtonByText(container, "Instruction Operands");
|
cb = (JCheckBox) findAbstractButtonByText(container, "Instruction Operands");
|
||||||
cb.setSelected(true);
|
setToggleButtonSelected(cb, true);
|
||||||
|
|
||||||
cb = (JCheckBox) findAbstractButtonByText(container, "Functions");
|
cb = (JCheckBox) findAbstractButtonByText(container, "Functions");
|
||||||
cb.setSelected(true);
|
setToggleButtonSelected(cb, true);
|
||||||
|
|
||||||
final JButton searchAllButton = (JButton) getInstanceField("allButton", dialog);
|
JButton searchAllButton = (JButton) getInstanceField("allButton", dialog);
|
||||||
runSwing(() -> {
|
runSwing(() -> {
|
||||||
tf.setText("param_");
|
tf.setText("param_");
|
||||||
searchAllButton.doClick();
|
searchAllButton.doClick();
|
||||||
|
@ -582,10 +582,10 @@ public class SearchTextPlugin3Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
assertTrue("Did not find highlights at expected field.", (numberOfHighlights > 0));
|
assertTrue("Did not find highlights at expected field.", (numberOfHighlights > 0));
|
||||||
|
|
||||||
// re-show the dialog to perform a new search
|
// re-show the dialog to perform a new search
|
||||||
final SearchTextDialog dialogTwo = getDialog();
|
SearchTextDialog dialogTwo = getDialog();
|
||||||
container = dialogTwo.getComponent();
|
container = dialogTwo.getComponent();
|
||||||
final JTextField tfTwo = findTextField(container);
|
JTextField tfTwo = findTextField(container);
|
||||||
final JButton searchAllButtonTwo = (JButton) getInstanceField("allButton", dialog);
|
JButton searchAllButtonTwo = (JButton) getInstanceField("allButton", dialog);
|
||||||
runSwing(() -> {
|
runSwing(() -> {
|
||||||
tfTwo.setText("text");
|
tfTwo.setText("text");
|
||||||
searchAllButtonTwo.doClick();
|
searchAllButtonTwo.doClick();
|
||||||
|
@ -612,13 +612,13 @@ public class SearchTextPlugin3Test extends AbstractGhidraHeadedIntegrationTest {
|
||||||
|
|
||||||
private void cancelSearch(String buttonText) throws Exception {
|
private void cancelSearch(String buttonText) throws Exception {
|
||||||
|
|
||||||
final SearchTextDialog dialog = getDialog();
|
SearchTextDialog dialog = getDialog();
|
||||||
JComponent container = dialog.getComponent();
|
JComponent container = dialog.getComponent();
|
||||||
final JTextField tf = findTextField(container);
|
JTextField tf = findTextField(container);
|
||||||
selectRadioButton(container, buttonText);
|
selectRadioButton(container, buttonText);
|
||||||
|
|
||||||
JCheckBox cb = (JCheckBox) findAbstractButtonByText(container, "Functions");
|
JCheckBox cb = (JCheckBox) findAbstractButtonByText(container, "Functions");
|
||||||
cb.setSelected(true);
|
setToggleButtonSelected(cb, true);
|
||||||
|
|
||||||
cb = (JCheckBox) findAbstractButtonByText(container, "Labels");
|
cb = (JCheckBox) findAbstractButtonByText(container, "Labels");
|
||||||
setToggleButtonSelected(cb, true);
|
setToggleButtonSelected(cb, true);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue