mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-09-28 17:11:11 -09:00
Merge remote-tracking branch 'origin/GP-2875_ghidragon_split_out_gui_from_generic--SQUASHED'
This commit is contained in:
@@ -24,7 +24,7 @@ import org.junit.Test;
|
||||
|
||||
import docking.DialogComponentProvider;
|
||||
import docking.action.DockingActionIf;
|
||||
import generic.test.AbstractGenericTest;
|
||||
import generic.test.AbstractGuiTest;
|
||||
import ghidra.app.plugin.core.instructionsearch.InstructionSearchPlugin;
|
||||
import ghidra.app.plugin.core.instructionsearch.ui.*;
|
||||
import ghidra.app.plugin.core.table.TableComponentProvider;
|
||||
@@ -58,7 +58,7 @@ public class InstructionPatternSearchScreenShots extends AbstractSearchScreenSho
|
||||
|
||||
DialogComponentProvider dialog = getDialog();
|
||||
JButton manualEntryButton =
|
||||
(JButton) AbstractGenericTest.findComponentByName(dialog.getComponent(),
|
||||
(JButton) AbstractGuiTest.findComponentByName(dialog.getComponent(),
|
||||
"manual entry");
|
||||
pressButton(manualEntryButton);
|
||||
|
||||
@@ -210,7 +210,7 @@ public class InstructionPatternSearchScreenShots extends AbstractSearchScreenSho
|
||||
|
||||
DialogComponentProvider dialog = getDialog();
|
||||
JButton searchButton =
|
||||
(JButton) AbstractGenericTest.findAbstractButtonByText(dialog.getComponent(),
|
||||
(JButton) AbstractGuiTest.findAbstractButtonByText(dialog.getComponent(),
|
||||
"Search All");
|
||||
pressButton(searchButton);
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
package ghidra.framework.main;
|
||||
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -31,7 +31,7 @@ import docking.action.DockingActionIf;
|
||||
import docking.test.AbstractDockingTest;
|
||||
import docking.wizard.WizardManager;
|
||||
import generic.test.AbstractGTest;
|
||||
import generic.test.AbstractGenericTest;
|
||||
import generic.test.AbstractGuiTest;
|
||||
import ghidra.framework.client.*;
|
||||
import ghidra.framework.model.*;
|
||||
import ghidra.server.remote.ServerTestUtil;
|
||||
@@ -71,13 +71,13 @@ public class SharedProjectUtil {
|
||||
|
||||
DockingActionIf action = getAction(frontEndTool, "New Project");
|
||||
AbstractDockingTest.performAction(action, false);
|
||||
AbstractGenericTest.waitForSwing();
|
||||
AbstractGuiTest.waitForSwing();
|
||||
|
||||
WizardManager wm = AbstractDockingTest.waitForDialogComponent(WizardManager.class);
|
||||
|
||||
ProjectTypePanel typePanel = AbstractDockingTest.findComponent(wm, ProjectTypePanel.class);
|
||||
final JRadioButton rb =
|
||||
(JRadioButton) AbstractGenericTest.findAbstractButtonByText(typePanel,
|
||||
(JRadioButton) AbstractGuiTest.findAbstractButtonByText(typePanel,
|
||||
"Shared Project");
|
||||
|
||||
SwingUtilities.invokeAndWait(() -> rb.setSelected(true));
|
||||
@@ -85,41 +85,41 @@ public class SharedProjectUtil {
|
||||
JButton nextButton = AbstractDockingTest.findButtonByText(wm, "Next >>");
|
||||
JButton finishButton = AbstractDockingTest.findButtonByText(wm, "Finish");
|
||||
|
||||
AbstractGenericTest.pressButton(nextButton, true);
|
||||
AbstractGuiTest.pressButton(nextButton, true);
|
||||
|
||||
ServerInfoPanel serverPanel = AbstractDockingTest.findComponent(wm, ServerInfoPanel.class);
|
||||
|
||||
final JTextField serverField =
|
||||
(JTextField) AbstractGenericTest.findComponentByName(serverPanel, "Server Name");
|
||||
(JTextField) AbstractGuiTest.findComponentByName(serverPanel, "Server Name");
|
||||
final JTextField portNumberField =
|
||||
(JTextField) AbstractGenericTest.findComponentByName(serverPanel, "Port Number");
|
||||
(JTextField) AbstractGuiTest.findComponentByName(serverPanel, "Port Number");
|
||||
|
||||
SwingUtilities.invokeAndWait(() -> {
|
||||
serverField.setText(LOCALHOST);
|
||||
portNumberField.setText(Integer.toString(SERVER_PORT));
|
||||
});
|
||||
|
||||
AbstractGenericTest.pressButton(nextButton);
|
||||
AbstractGuiTest.pressButton(nextButton);
|
||||
|
||||
// next panel should be the repository panel
|
||||
RepositoryPanel repPanel = AbstractDockingTest.findComponent(wm, RepositoryPanel.class);
|
||||
|
||||
final JList<?> repList = AbstractGenericTest.findComponent(repPanel, JList.class);
|
||||
final JList<?> repList = AbstractGuiTest.findComponent(repPanel, JList.class);
|
||||
|
||||
// select existing repository
|
||||
SwingUtilities.invokeAndWait(() -> repList.setSelectedIndex(0));
|
||||
|
||||
// next panel is project location panel
|
||||
AbstractGenericTest.pressButton(nextButton, true);
|
||||
AbstractGuiTest.pressButton(nextButton, true);
|
||||
|
||||
final SelectProjectPanel projPanel =
|
||||
AbstractDockingTest.findComponent(wm, SelectProjectPanel.class);
|
||||
|
||||
final String testProjectDirectory = AbstractGTest.getTestDirectoryPath();
|
||||
final JTextField projDirField =
|
||||
(JTextField) AbstractGenericTest.findComponentByName(projPanel, "Project Directory");
|
||||
(JTextField) AbstractGuiTest.findComponentByName(projPanel, "Project Directory");
|
||||
final JTextField projNameField =
|
||||
(JTextField) AbstractGenericTest.findComponentByName(projPanel, "Project Name");
|
||||
(JTextField) AbstractGuiTest.findComponentByName(projPanel, "Project Name");
|
||||
|
||||
SwingUtilities.invokeAndWait(() -> {
|
||||
projDirField.setText(testProjectDirectory);
|
||||
@@ -133,8 +133,8 @@ public class SharedProjectUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
AbstractGenericTest.pressButton(finishButton, true);
|
||||
AbstractGenericTest.waitForSwing();
|
||||
AbstractGuiTest.pressButton(finishButton, true);
|
||||
AbstractGuiTest.waitForSwing();
|
||||
boolean didOpen = waitForProjectToOpen(projectName, projectListener);
|
||||
System.err.println("\tdid the project get opened?: " + didOpen);
|
||||
return didOpen;
|
||||
@@ -151,7 +151,7 @@ public class SharedProjectUtil {
|
||||
AbstractGTest.sleep(waitTime);
|
||||
}
|
||||
|
||||
AbstractGenericTest.waitForSwing();
|
||||
AbstractGuiTest.waitForSwing();
|
||||
boolean success = desiredProjectName.equals(lastOpenedProjectName);
|
||||
if (!success) {
|
||||
System.err.println("\tOpen windows: " + AbstractDockingTest.getOpenWindowsAsString());
|
||||
|
||||
@@ -32,6 +32,7 @@ import docking.action.DockingActionIf;
|
||||
import docking.widgets.OptionDialog;
|
||||
import docking.widgets.table.GTable;
|
||||
import docking.widgets.tree.GTreeNode;
|
||||
import generic.theme.GIcon;
|
||||
import ghidra.framework.main.projectdata.actions.VersionControlAction;
|
||||
import ghidra.framework.model.DomainFile;
|
||||
import ghidra.framework.model.DomainFolder;
|
||||
@@ -42,6 +43,7 @@ import ghidra.program.model.symbol.SymbolTable;
|
||||
import ghidra.util.task.TaskMonitor;
|
||||
import resources.MultiIcon;
|
||||
import resources.ResourceManager;
|
||||
import resources.icons.UrlImageIcon;
|
||||
|
||||
/**
|
||||
* Tests for version control (not multi user).
|
||||
@@ -424,4 +426,20 @@ public class VersionControlAction2Test extends AbstractVersionControlActionTest
|
||||
pressButtonByText(dialog, "Dismiss");
|
||||
waitForTasks();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the URL for the given icon
|
||||
* @param icon the icon to get a URL for
|
||||
* @return the URL for the given icon
|
||||
*/
|
||||
public URL getURL(Icon icon) {
|
||||
if (icon instanceof UrlImageIcon urlIcon) {
|
||||
return urlIcon.getUrl();
|
||||
}
|
||||
if (icon instanceof GIcon gIcon) {
|
||||
return gIcon.getUrl();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import docking.test.AbstractDockingTest;
|
||||
import docking.widgets.tree.GTree;
|
||||
import docking.widgets.tree.GTreeNode;
|
||||
import generic.test.AbstractGTest;
|
||||
import generic.test.AbstractGenericTest;
|
||||
import generic.test.AbstractGuiTest;
|
||||
import ghidra.framework.main.datatable.ProjectDataContext;
|
||||
import ghidra.framework.main.datatree.*;
|
||||
import ghidra.framework.model.DomainFile;
|
||||
@@ -104,7 +104,7 @@ public class DataTreeHelper {
|
||||
}
|
||||
|
||||
public void clearTreeSelection() {
|
||||
AbstractGenericTest.runSwing(() -> tree.clearSelection());
|
||||
AbstractGuiTest.runSwing(() -> tree.clearSelection());
|
||||
}
|
||||
|
||||
public void setTreeSelection(final TreePath[] paths) throws Exception {
|
||||
|
||||
@@ -30,7 +30,7 @@ import docking.widgets.OptionDialog;
|
||||
import docking.widgets.tree.GTree;
|
||||
import docking.widgets.tree.GTreeNode;
|
||||
import generic.test.AbstractGTest;
|
||||
import generic.test.AbstractGenericTest;
|
||||
import generic.test.AbstractGuiTest;
|
||||
import ghidra.framework.main.FrontEndTool;
|
||||
import ghidra.framework.main.SharedProjectUtil;
|
||||
import ghidra.framework.main.datatree.*;
|
||||
@@ -80,7 +80,7 @@ public class FrontEndTestEnv {
|
||||
// assume read-only project views are not active and only active
|
||||
// project tree is present
|
||||
DataTree tree =
|
||||
AbstractGenericTest.findComponent(frontEndTool.getToolFrame(), DataTree.class);
|
||||
AbstractGuiTest.findComponent(frontEndTool.getToolFrame(), DataTree.class);
|
||||
projectTreeHelper = new DataTreeHelper(tree, true);
|
||||
|
||||
Project project = frontEndTool.getProject();
|
||||
@@ -168,19 +168,19 @@ public class FrontEndTestEnv {
|
||||
}
|
||||
|
||||
public void waitForSwing() {
|
||||
AbstractGenericTest.waitForSwing();
|
||||
AbstractGuiTest.waitForSwing();
|
||||
}
|
||||
|
||||
private void runSwing(Runnable r) {
|
||||
AbstractGenericTest.runSwing(r);
|
||||
AbstractGuiTest.runSwing(r);
|
||||
}
|
||||
|
||||
private void runSwing(Runnable r, boolean wait) {
|
||||
AbstractGenericTest.runSwing(r, wait);
|
||||
AbstractGuiTest.runSwing(r, wait);
|
||||
}
|
||||
|
||||
private void waitForTasks() {
|
||||
AbstractGenericTest.waitForTasks();
|
||||
AbstractGuiTest.waitForTasks();
|
||||
}
|
||||
|
||||
public void setTreeSelection(final TreePath[] paths) throws Exception {
|
||||
@@ -237,8 +237,8 @@ public class FrontEndTestEnv {
|
||||
|
||||
assertTrue(node.getDomainFile().isCheckedOut());
|
||||
|
||||
AbstractGenericTest.waitForSwing();
|
||||
AbstractGenericTest.waitForTasks();
|
||||
AbstractGuiTest.waitForSwing();
|
||||
AbstractGuiTest.waitForTasks();
|
||||
|
||||
Program program =
|
||||
(Program) node.getDomainFile().getDomainObject(this, true, false, TaskMonitor.DUMMY);
|
||||
@@ -305,7 +305,7 @@ public class FrontEndTestEnv {
|
||||
ActionContext context = provider.getActionContext(null);
|
||||
AbstractDockingTest.performAction(terminateCheckoutAction, context, false);
|
||||
OptionDialog optDialog = AbstractDockingTest.waitForDialogComponent(OptionDialog.class);
|
||||
AbstractGenericTest.pressButtonByText(optDialog.getComponent(), "Yes", true);
|
||||
AbstractGuiTest.pressButtonByText(optDialog.getComponent(), "Yes", true);
|
||||
waitForTasks();
|
||||
waitForSwing();
|
||||
}
|
||||
@@ -323,7 +323,8 @@ public class FrontEndTestEnv {
|
||||
}
|
||||
|
||||
public List<PluginTool> getTools() {
|
||||
PluginTool[] tools = frontEndTool.getProject().getToolManager().getActiveWorkspace().getTools();
|
||||
PluginTool[] tools =
|
||||
frontEndTool.getProject().getToolManager().getActiveWorkspace().getTools();
|
||||
return new ArrayList<>(Arrays.asList(tools));
|
||||
}
|
||||
|
||||
@@ -371,9 +372,9 @@ public class FrontEndTestEnv {
|
||||
}
|
||||
|
||||
JButton okButton =
|
||||
(JButton) AbstractGenericTest.findAbstractButtonByText(dialog.getComponent(), "OK");
|
||||
(JButton) AbstractGuiTest.findAbstractButtonByText(dialog.getComponent(), "OK");
|
||||
assertNotNull(okButton);
|
||||
AbstractGenericTest.pressButton(okButton);
|
||||
AbstractGuiTest.pressButton(okButton);
|
||||
waitForTasks();
|
||||
DomainFile df = node.getDomainFile();
|
||||
|
||||
@@ -441,7 +442,7 @@ public class FrontEndTestEnv {
|
||||
*/
|
||||
public DataTreeHelper getReadOnlyProjectTreeHelper(String tabName) {
|
||||
String dataTreeName = "Data Tree: " + tabName;
|
||||
DataTree tree = (DataTree) AbstractGenericTest
|
||||
DataTree tree = (DataTree) AbstractGuiTest
|
||||
.findComponentByName(frontEndTool.getToolFrame(), dataTreeName);
|
||||
return tree != null ? new DataTreeHelper(tree, true) : null;
|
||||
}
|
||||
@@ -451,7 +452,7 @@ public class FrontEndTestEnv {
|
||||
* @return READ-ONLY project view tree helper for first view found or null if none displayed
|
||||
*/
|
||||
public DataTreeHelper getFirstReadOnlyProjectTreeHelper() {
|
||||
for (DataTree tree : AbstractGenericTest.findComponents(frontEndTool.getToolFrame(),
|
||||
for (DataTree tree : AbstractGuiTest.findComponents(frontEndTool.getToolFrame(),
|
||||
DataTree.class)) {
|
||||
if (tree.getName().startsWith("Data Tree:")) {
|
||||
return new DataTreeHelper(tree, true);
|
||||
|
||||
Reference in New Issue
Block a user