mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-28 15:11:44 +00:00
Merge remote-tracking branch 'origin/GP-2875_ghidragon_split_out_gui_from_generic--SQUASHED'
This commit is contained in:
commit
112c4afe52
@ -38,13 +38,7 @@ configurations {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api project(':Utility')
|
||||
api project(':Generic')
|
||||
api project(':Docking')
|
||||
api project(':Graph')
|
||||
api project(':SoftwareModeling')
|
||||
api project(':DB')
|
||||
api project(':Help')
|
||||
|
||||
api 'org.apache.felix:org.apache.felix.framework:7.0.3'
|
||||
api 'com.github.rotty3000:phidias:0.3.7'
|
||||
|
@ -22,6 +22,7 @@ import java.util.*;
|
||||
|
||||
import generic.jar.ResourceFile;
|
||||
import generic.test.AbstractGenericTest;
|
||||
import generic.test.AbstractGuiTest;
|
||||
import ghidra.app.cmd.data.CreateDataCmd;
|
||||
import ghidra.app.cmd.disassemble.ArmDisassembleCommand;
|
||||
import ghidra.app.cmd.disassemble.DisassembleCommand;
|
||||
@ -216,7 +217,7 @@ public class ProgramBuilder {
|
||||
private void flushEvents() {
|
||||
program.flushEvents();
|
||||
if (!SystemUtilities.isInHeadlessMode()) {
|
||||
AbstractGenericTest.waitForSwing();
|
||||
AbstractGuiTest.waitForSwing();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.util.*;
|
||||
|
||||
import generic.test.AbstractGenericTest;
|
||||
import generic.test.AbstractGuiTest;
|
||||
import ghidra.framework.model.*;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.framework.store.LockException;
|
||||
@ -131,7 +131,7 @@ public class ProjectTestUtils {
|
||||
Msg.warn(ProjectTestUtils.class, "deleteLockFile(): " + "unable to delete file " +
|
||||
lockFile.getAbsolutePath() + "- trying again.");
|
||||
for (int i = 0; i < 6; i++) {
|
||||
AbstractGenericTest.waitForPostedSwingRunnables();
|
||||
AbstractGuiTest.waitForPostedSwingRunnables();
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
|
@ -189,12 +189,12 @@ public class TestEnv {
|
||||
closeAllProgramsFor(tool);
|
||||
|
||||
// don't want to prompt for saving
|
||||
AbstractGenericTest.runSwing(() -> {
|
||||
AbstractGuiTest.runSwing(() -> {
|
||||
tool.setConfigChanged(false);
|
||||
|
||||
});
|
||||
AbstractGenericTest.runSwing(() -> tool.close(), false);
|
||||
AbstractGenericTest.waitForSwing();
|
||||
AbstractGuiTest.runSwing(() -> tool.close(), false);
|
||||
AbstractGuiTest.waitForSwing();
|
||||
|
||||
tool = null;
|
||||
}
|
||||
@ -231,7 +231,7 @@ public class TestEnv {
|
||||
}
|
||||
|
||||
extraTools.remove(toolToClose);
|
||||
AbstractGenericTest.executeOnSwingWithoutBlocking(() -> {
|
||||
AbstractGuiTest.executeOnSwingWithoutBlocking(() -> {
|
||||
if (ignoreChanges) {
|
||||
toolToClose.setConfigChanged(false);
|
||||
}
|
||||
@ -244,13 +244,13 @@ public class TestEnv {
|
||||
return;
|
||||
}
|
||||
|
||||
AbstractGenericTest.runSwing(() -> frontEndTool.close());
|
||||
AbstractGuiTest.runSwing(() -> frontEndTool.close());
|
||||
frontEndTool = null;
|
||||
removeFrontEndFromSystem();
|
||||
}
|
||||
|
||||
private void dipsoseTestTools() {
|
||||
AbstractGenericTest.runSwing(() -> {
|
||||
AbstractGuiTest.runSwing(() -> {
|
||||
disposeSingleTool(tool);
|
||||
|
||||
Iterator<PluginTool> it = extraTools.iterator();
|
||||
@ -279,7 +279,7 @@ public class TestEnv {
|
||||
}
|
||||
|
||||
public void saveRestoreToolState() {
|
||||
AbstractGenericTest.runSwing(() -> {
|
||||
AbstractGuiTest.runSwing(() -> {
|
||||
Element element = lazyTool().saveDataStateToXml(true);
|
||||
lazyTool().restoreDataStateFromXml(element);
|
||||
});
|
||||
@ -413,7 +413,7 @@ public class TestEnv {
|
||||
ToolChest toolChest = project.getLocalToolChest();
|
||||
ToolTemplate template = getToolTemplate(AbstractGenericTest.DEFAULT_TEST_TOOL_NAME);
|
||||
template.setName(AbstractGenericTest.DEFAULT_TOOL_NAME);
|
||||
AbstractGenericTest.runSwing(() -> toolChest.replaceToolTemplate(template));
|
||||
AbstractGuiTest.runSwing(() -> toolChest.replaceToolTemplate(template));
|
||||
}
|
||||
|
||||
private void initializeSimpleTool() {
|
||||
@ -422,7 +422,7 @@ public class TestEnv {
|
||||
throw new AssertException("Tool already exists--you are doing something wrong!");
|
||||
}
|
||||
|
||||
AbstractGenericTest.runSwing(() -> {
|
||||
AbstractGuiTest.runSwing(() -> {
|
||||
|
||||
Project project = gp.getProject();
|
||||
tool = new TestTool(project);
|
||||
@ -452,7 +452,7 @@ public class TestEnv {
|
||||
return frontEndTool;
|
||||
}
|
||||
|
||||
AbstractGenericTest.runSwing(() -> {
|
||||
AbstractGuiTest.runSwing(() -> {
|
||||
frontEndTool = new TestFrontEndTool(gp.getProjectManager());
|
||||
frontEndTool.setActiveProject(getProject());
|
||||
|
||||
@ -517,7 +517,7 @@ public class TestEnv {
|
||||
|
||||
protected PluginTool launchDefaultToolByName(String toolName) {
|
||||
|
||||
return AbstractGenericTest.runSwing(() -> {
|
||||
return AbstractGuiTest.runSwing(() -> {
|
||||
|
||||
ToolTemplate toolTemplate = getToolTemplate(toolName);
|
||||
if (toolTemplate == null) {
|
||||
@ -540,7 +540,7 @@ public class TestEnv {
|
||||
|
||||
private static ToolTemplate getToolTemplate(String toolName) {
|
||||
|
||||
return AbstractGenericTest.runSwing(() -> {
|
||||
return AbstractGuiTest.runSwing(() -> {
|
||||
ToolTemplate toolTemplate =
|
||||
ToolUtils.readToolTemplate("defaultTools/" + toolName + ToolUtils.TOOL_EXTENSION);
|
||||
if (toolTemplate == null) {
|
||||
@ -620,7 +620,7 @@ public class TestEnv {
|
||||
public PluginTool restartTool() {
|
||||
closeTool();
|
||||
|
||||
AbstractGenericTest.waitForSwing();
|
||||
AbstractGuiTest.waitForSwing();
|
||||
|
||||
tool = null;
|
||||
initializeSimpleTool();
|
||||
@ -634,7 +634,7 @@ public class TestEnv {
|
||||
*/
|
||||
public PluginTool launchAnotherDefaultTool() {
|
||||
PluginTool newTool = createDefaultTool();
|
||||
AbstractGenericTest.runSwing(() -> newTool.setToolName(newTool.getToolName() + toolID++));
|
||||
AbstractGuiTest.runSwing(() -> newTool.setToolName(newTool.getToolName() + toolID++));
|
||||
extraTools.add(newTool);
|
||||
return newTool;
|
||||
|
||||
@ -833,7 +833,7 @@ public class TestEnv {
|
||||
throw new AssertException("Tool already exists--you are doing something wrong!");
|
||||
}
|
||||
|
||||
AbstractGenericTest.runSwing(() -> {
|
||||
AbstractGuiTest.runSwing(() -> {
|
||||
tool = launchDefaultTool();
|
||||
ProgramManager pm = tool.getService(ProgramManager.class);
|
||||
pm.openProgram(program.getDomainFile());
|
||||
@ -844,7 +844,7 @@ public class TestEnv {
|
||||
"Unable to launch the default tool: " + ToolServices.DEFAULT_TOOLNAME);
|
||||
}
|
||||
|
||||
AbstractGenericTest.waitForSwing();
|
||||
AbstractGuiTest.waitForSwing();
|
||||
|
||||
removeAllConsumersExceptTool(program, tool);
|
||||
|
||||
@ -879,7 +879,7 @@ public class TestEnv {
|
||||
public PluginTool launchTool(String toolName, DomainFile domainFile) {
|
||||
AtomicReference<PluginTool> ref = new AtomicReference<>();
|
||||
|
||||
AbstractGenericTest.runSwing(() -> {
|
||||
AbstractGuiTest.runSwing(() -> {
|
||||
PluginTool newTool = doLaunchTool(toolName);
|
||||
ref.set(newTool);
|
||||
if (newTool != null) {
|
||||
@ -909,7 +909,7 @@ public class TestEnv {
|
||||
public PluginTool launchToolWithURL(String toolName, URL ghidraUrl) {
|
||||
AtomicReference<PluginTool> ref = new AtomicReference<>();
|
||||
|
||||
AbstractGenericTest.runSwing(() -> {
|
||||
AbstractGuiTest.runSwing(() -> {
|
||||
PluginTool newTool = doLaunchTool(toolName);
|
||||
ref.set(newTool);
|
||||
if (newTool != null) {
|
||||
@ -956,7 +956,7 @@ public class TestEnv {
|
||||
|
||||
protected void setAutoSaveEnabled(final FrontEndTool frontEndToolInstance,
|
||||
final boolean enabled) {
|
||||
AbstractGenericTest.runSwing(() -> {
|
||||
AbstractGuiTest.runSwing(() -> {
|
||||
Options options = frontEndToolInstance.getOptions(ToolConstants.TOOL_OPTIONS);
|
||||
options.setBoolean(FrontEndTool.AUTOMATICALLY_SAVE_TOOLS, enabled);
|
||||
});
|
||||
@ -1085,7 +1085,7 @@ public class TestEnv {
|
||||
Project project = gp.getProject();
|
||||
String projectName = project.getName();
|
||||
try {
|
||||
AbstractGenericTest.runSwing(() -> gp.close());
|
||||
AbstractGuiTest.runSwing(() -> gp.close());
|
||||
}
|
||||
catch (Throwable t) {
|
||||
Msg.error(TestEnv.class, "Problem disposing the test project", t);
|
||||
@ -1146,7 +1146,7 @@ public class TestEnv {
|
||||
|
||||
private void printOpenModalDialogs() {
|
||||
boolean hasModal = false;
|
||||
Set<Window> windows = AbstractGenericTest.getAllWindows();
|
||||
Set<Window> windows = AbstractGuiTest.getAllWindows();
|
||||
for (Window window : windows) {
|
||||
if (window instanceof Dialog) {
|
||||
if (((Dialog) window).isModal() && window.isShowing()) {
|
||||
@ -1168,7 +1168,7 @@ public class TestEnv {
|
||||
}
|
||||
|
||||
private void disposeTestTools() {
|
||||
AbstractGenericTest.runSwing(() -> {
|
||||
AbstractGuiTest.runSwing(() -> {
|
||||
try {
|
||||
dipsoseTestTools();
|
||||
}
|
||||
@ -1183,7 +1183,7 @@ public class TestEnv {
|
||||
// the deprecation is OK--we are a framework method and we know we can use it
|
||||
@SuppressWarnings("deprecation")
|
||||
private void privateWaitForSwingRunnables() {
|
||||
AbstractGenericTest.privateWaitForPostedSwingRunnables_SwingSafe();
|
||||
AbstractGuiTest.privateWaitForPostedSwingRunnables_SwingSafe();
|
||||
}
|
||||
|
||||
private void disposeAllSwingUpdateManagers() {
|
||||
@ -1207,7 +1207,7 @@ public class TestEnv {
|
||||
Msg.out(StringUtils.join(list, ",\n"));
|
||||
*/
|
||||
|
||||
AbstractGenericTest.runSwing(() -> s.clear());
|
||||
AbstractGuiTest.runSwing(() -> s.clear());
|
||||
}
|
||||
|
||||
private void markAllProgramsAsUnchanged() {
|
||||
|
@ -21,8 +21,7 @@ import java.util.*;
|
||||
import db.DBConstants;
|
||||
import db.DBHandle;
|
||||
import db.buffers.BufferFile;
|
||||
import generic.test.AbstractGTest;
|
||||
import generic.test.AbstractGenericTest;
|
||||
import generic.test.*;
|
||||
import ghidra.app.util.xml.*;
|
||||
import ghidra.framework.data.DomainObjectAdapterDB;
|
||||
import ghidra.framework.model.*;
|
||||
@ -243,7 +242,7 @@ public class TestProgramManager {
|
||||
while (true) {
|
||||
try {
|
||||
DomainFile df = folder.createFile(name, gzf, TaskMonitor.DUMMY);
|
||||
AbstractGenericTest.waitForPostedSwingRunnables();
|
||||
AbstractGuiTest.waitForPostedSwingRunnables();
|
||||
DomainObject dobj = df.getDomainObject(this, true, false, null);
|
||||
try {
|
||||
if (dobj.isChanged()) {
|
||||
|
@ -25,6 +25,7 @@ import docking.action.DockingActionIf;
|
||||
import docking.widgets.tree.GTree;
|
||||
import docking.widgets.tree.GTreeNode;
|
||||
import generic.test.AbstractGenericTest;
|
||||
import generic.test.AbstractGuiTest;
|
||||
import ghidra.app.plugin.core.datamgr.archive.*;
|
||||
import ghidra.app.plugin.core.datamgr.tree.ArchiveNode;
|
||||
import ghidra.app.plugin.core.datamgr.tree.DataTypeArchiveGTree;
|
||||
@ -125,7 +126,7 @@ public class DataTypeTestUtils {
|
||||
// who cares?
|
||||
}
|
||||
}
|
||||
AbstractGenericTest.waitForPostedSwingRunnables();
|
||||
AbstractGuiTest.waitForPostedSwingRunnables();
|
||||
}
|
||||
|
||||
public static ArchiveNode openArchive(String archiveName, boolean checkout,
|
||||
@ -239,14 +240,14 @@ public class DataTypeTestUtils {
|
||||
|
||||
public static void performAction(DockingActionIf action, Program program, GTree tree,
|
||||
boolean wait) {
|
||||
AbstractGenericTest.runSwing(() -> {
|
||||
AbstractGuiTest.runSwing(() -> {
|
||||
ActionContext context =
|
||||
new DataTypesActionContext(null, program, (DataTypeArchiveGTree) tree, null, true);
|
||||
action.actionPerformed(context);
|
||||
}, wait);
|
||||
|
||||
if (!SwingUtilities.isEventDispatchThread()) {
|
||||
AbstractGenericTest.waitForSwing();
|
||||
AbstractGuiTest.waitForSwing();
|
||||
}
|
||||
}
|
||||
|
||||
@ -255,14 +256,14 @@ public class DataTypeTestUtils {
|
||||
}
|
||||
|
||||
public static void performAction(DockingActionIf action, GTree tree, boolean wait) {
|
||||
AbstractGenericTest.runSwing(() -> {
|
||||
AbstractGuiTest.runSwing(() -> {
|
||||
ActionContext context =
|
||||
new DataTypesActionContext(null, null, (DataTypeArchiveGTree) tree, null, true);
|
||||
action.actionPerformed(context);
|
||||
}, wait);
|
||||
|
||||
if (!SwingUtilities.isEventDispatchThread()) {
|
||||
AbstractGenericTest.waitForSwing();
|
||||
AbstractGuiTest.waitForSwing();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,12 +22,12 @@ import java.util.*;
|
||||
|
||||
import org.junit.*;
|
||||
|
||||
import generic.test.AbstractGenericTest;
|
||||
import generic.test.AbstractGuiTest;
|
||||
import ghidra.framework.model.*;
|
||||
import ghidra.framework.options.Options;
|
||||
import ghidra.framework.store.LockException;
|
||||
|
||||
public class PairedTransactionTest extends AbstractGenericTest {
|
||||
public class PairedTransactionTest extends AbstractGuiTest {
|
||||
|
||||
DummyDomainObject obj1;
|
||||
DummyDomainObject obj2;
|
||||
|
@ -25,7 +25,7 @@ import javax.swing.text.Document;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import generic.test.AbstractGenericTest;
|
||||
import generic.test.AbstractGuiTest;
|
||||
import ghidra.framework.plugintool.DummyPluginTool;
|
||||
|
||||
public class ConsoleTextPaneTest {
|
||||
@ -110,28 +110,28 @@ public class ConsoleTextPaneTest {
|
||||
|
||||
private void assertCaretAtTop(ConsoleTextPane text) {
|
||||
|
||||
AbstractGenericTest.waitForSwing();
|
||||
AbstractGuiTest.waitForSwing();
|
||||
int expectedPosition = 0;
|
||||
assertCaretPosition(text, expectedPosition);
|
||||
}
|
||||
|
||||
private void assertCaretAtBottom(ConsoleTextPane text) {
|
||||
|
||||
AbstractGenericTest.waitForSwing();
|
||||
AbstractGuiTest.waitForSwing();
|
||||
int expectedPosition = text.getDocument().getLength();
|
||||
assertCaretPosition(text, expectedPosition);
|
||||
}
|
||||
|
||||
private void assertCaretPosition(ConsoleTextPane text, int expectedPosition) {
|
||||
|
||||
AbstractGenericTest.waitForSwing();
|
||||
AbstractGuiTest.waitForSwing();
|
||||
Document doc = text.getDocument();
|
||||
int actualPosition = swing(() -> text.getCaretPosition());
|
||||
assertEquals(expectedPosition, actualPosition);
|
||||
}
|
||||
|
||||
private void printEnoughLinesToOverflowTheMaxCharCount(ConsoleTextPane text) {
|
||||
AbstractGenericTest.runSwing(() -> {
|
||||
AbstractGuiTest.runSwing(() -> {
|
||||
|
||||
int charsWritten = 0;
|
||||
for (int i = 0; charsWritten < text.getMaximumCharacterLimit(); i++) {
|
||||
@ -145,10 +145,10 @@ public class ConsoleTextPaneTest {
|
||||
}
|
||||
|
||||
private void swing(Runnable r) {
|
||||
AbstractGenericTest.runSwing(r);
|
||||
AbstractGuiTest.runSwing(r);
|
||||
}
|
||||
|
||||
private <T> T swing(Supplier<T> s) {
|
||||
return AbstractGenericTest.runSwing(s);
|
||||
return AbstractGuiTest.runSwing(s);
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ package ghidra.app;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import generic.test.AbstractGenericTest;
|
||||
import generic.test.AbstractGuiTest;
|
||||
import ghidra.app.plugin.core.codebrowser.CodeBrowserPlugin;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.model.address.AddressSpace;
|
||||
@ -56,7 +56,7 @@ public class SampleLocationGenerator implements GhidraLocationGenerator {
|
||||
* @param cb
|
||||
*/
|
||||
public void toggleOpenComposites(final CodeBrowserPlugin cb) {
|
||||
AbstractGenericTest.runSwing(() -> {
|
||||
AbstractGuiTest.runSwing(() -> {
|
||||
Data data = program.getListing().getDataAt(addr(0x100d0f3));
|
||||
if (data.getDataType() instanceof Composite) {
|
||||
cb.toggleOpen(data);
|
||||
|
@ -23,7 +23,7 @@ import javax.swing.JTextField;
|
||||
|
||||
import docking.test.AbstractDockingTest;
|
||||
import generic.test.AbstractGTest;
|
||||
import generic.test.AbstractGenericTest;
|
||||
import generic.test.AbstractGuiTest;
|
||||
import ghidra.app.plugin.core.assembler.AssemblyDualTextField.AssemblyCompletion;
|
||||
import ghidra.app.plugin.core.assembler.AssemblyDualTextField.AssemblyInstruction;
|
||||
import ghidra.app.plugin.core.codebrowser.CodeViewerProvider;
|
||||
@ -78,14 +78,14 @@ public class AssemblerPluginTestHelper {
|
||||
}
|
||||
|
||||
public List<AssemblyCompletion> inputAndGetCompletions(String text) {
|
||||
AbstractGenericTest.runSwing(() -> {
|
||||
AbstractGuiTest.runSwing(() -> {
|
||||
instructionInput.setText(text);
|
||||
JTextField field = instructionInput.getOperandsField();
|
||||
instructionInput.auto.fakeFocusGained(field);
|
||||
instructionInput.auto.startCompletion(field);
|
||||
instructionInput.auto.updateNow();
|
||||
});
|
||||
return AbstractGenericTest.waitForValue(() -> AbstractGenericTest.runSwing(() -> {
|
||||
return AbstractGuiTest.waitForValue(() -> AbstractGuiTest.runSwing(() -> {
|
||||
List<AssemblyCompletion> suggestions = instructionInput.auto.getSuggestions();
|
||||
if (suggestions.isEmpty()) {
|
||||
return null;
|
||||
@ -98,7 +98,7 @@ public class AssemblerPluginTestHelper {
|
||||
ListingPanel listingPanel = provider.getListingPanel();
|
||||
ProgramLocation location = new ProgramLocation(program, address);
|
||||
AbstractGTest.waitForCondition(() -> {
|
||||
AbstractGenericTest.runSwing(() -> listingPanel.goTo(location));
|
||||
AbstractGuiTest.runSwing(() -> listingPanel.goTo(location));
|
||||
ProgramLocation confirm = listingPanel.getCursorLocation();
|
||||
if (confirm == null) {
|
||||
return false;
|
||||
@ -126,7 +126,7 @@ public class AssemblerPluginTestHelper {
|
||||
assertTrue(first instanceof AssemblyInstruction);
|
||||
AssemblyInstruction ai = (AssemblyInstruction) first;
|
||||
|
||||
AbstractGenericTest.runSwing(() -> patchInstructionAction.accept(ai));
|
||||
AbstractGuiTest.runSwing(() -> patchInstructionAction.accept(ai));
|
||||
AbstractGhidraHeadedIntegrationTest.waitForProgram(program);
|
||||
|
||||
return AbstractGTest.waitForValue(() -> listing.getInstructionAt(address));
|
||||
@ -140,7 +140,7 @@ public class AssemblerPluginTestHelper {
|
||||
assertEquals(expText, dataInput.getText());
|
||||
assertEquals(address, patchDataAction.getAddress());
|
||||
|
||||
AbstractGenericTest.runSwing(() -> {
|
||||
AbstractGuiTest.runSwing(() -> {
|
||||
dataInput.setText(newText);
|
||||
patchDataAction.accept();
|
||||
});
|
||||
|
@ -21,7 +21,7 @@ import java.util.List;
|
||||
|
||||
import org.junit.*;
|
||||
|
||||
import generic.test.AbstractGenericTest;
|
||||
import generic.test.AbstractGuiTest;
|
||||
import ghidra.app.services.DataTypeManagerService;
|
||||
import ghidra.app.util.cparser.C.ParseException;
|
||||
import ghidra.program.database.ProgramBuilder;
|
||||
@ -34,7 +34,7 @@ import ghidra.program.model.listing.*;
|
||||
import ghidra.program.model.pcode.Varnode;
|
||||
import ghidra.util.exception.InvalidInputException;
|
||||
|
||||
public class FunctionEditorModelTest extends AbstractGenericTest {
|
||||
public class FunctionEditorModelTest extends AbstractGuiTest {
|
||||
|
||||
private FunctionEditorModel model;
|
||||
private volatile boolean dataChangeCalled;
|
||||
|
@ -22,7 +22,7 @@ import java.util.List;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import generic.test.AbstractGenericTest;
|
||||
import generic.test.AbstractGuiTest;
|
||||
import ghidra.program.database.ProgramBuilder;
|
||||
import ghidra.program.database.ProgramDB;
|
||||
import ghidra.program.model.address.Address;
|
||||
@ -32,7 +32,7 @@ import ghidra.program.model.listing.Function;
|
||||
import ghidra.program.model.listing.VariableStorage;
|
||||
import ghidra.util.exception.InvalidInputException;
|
||||
|
||||
public class StorageEditorModelTest extends AbstractGenericTest {
|
||||
public class StorageEditorModelTest extends AbstractGuiTest {
|
||||
|
||||
protected static final int REQUIRE_SIZE = 8;
|
||||
protected StorageAddressModel model;
|
||||
|
@ -30,13 +30,13 @@ import javax.swing.KeyStroke;
|
||||
import org.jdom.Element;
|
||||
import org.junit.*;
|
||||
|
||||
import generic.test.AbstractGenericTest;
|
||||
import generic.test.AbstractGuiTest;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
import ghidra.util.HelpLocation;
|
||||
import ghidra.util.bean.opteditor.OptionsVetoException;
|
||||
import ghidra.util.exception.InvalidInputException;
|
||||
|
||||
public class OptionsTest extends AbstractGenericTest {
|
||||
public class OptionsTest extends AbstractGuiTest {
|
||||
|
||||
public enum FRUIT {
|
||||
Apple, Orange, Pear
|
||||
|
@ -20,6 +20,7 @@ import java.io.IOException;
|
||||
import db.*;
|
||||
import db.buffers.BufferFile;
|
||||
import generic.test.AbstractGenericTest;
|
||||
import generic.test.AbstractGuiTest;
|
||||
import ghidra.app.plugin.core.analysis.AutoAnalysisManager;
|
||||
import ghidra.framework.data.GhidraFolder;
|
||||
import ghidra.framework.model.DomainFile;
|
||||
@ -158,7 +159,7 @@ public abstract class AbstractMTFModel {
|
||||
}
|
||||
if (resultProgram != null) {
|
||||
resultProgram.flushEvents();
|
||||
AbstractGenericTest.waitForSwing();
|
||||
AbstractGuiTest.waitForSwing();
|
||||
resultProgram.release(this);
|
||||
resultProgram = null;
|
||||
}
|
||||
|
@ -44,7 +44,6 @@ import edu.uci.ics.jung.graph.Graph;
|
||||
import edu.uci.ics.jung.visualization.VisualizationModel;
|
||||
import edu.uci.ics.jung.visualization.VisualizationViewer;
|
||||
import edu.uci.ics.jung.visualization.picking.PickedState;
|
||||
import generic.test.AbstractGenericTest;
|
||||
import generic.test.TestUtils;
|
||||
import ghidra.app.cmd.label.AddLabelCmd;
|
||||
import ghidra.app.cmd.label.SetLabelPrimaryCmd;
|
||||
@ -2312,11 +2311,11 @@ public abstract class AbstractFunctionGraphTest extends AbstractGhidraHeadedInte
|
||||
}
|
||||
|
||||
protected void swing(Runnable r) {
|
||||
AbstractGenericTest.runSwing(r);
|
||||
runSwing(r);
|
||||
}
|
||||
|
||||
protected <T> T swing(Supplier<T> s) {
|
||||
return AbstractGenericTest.runSwing(s);
|
||||
return runSwing(s);
|
||||
}
|
||||
|
||||
static class DummyTransferable implements Transferable {
|
||||
|
@ -22,7 +22,7 @@ import javax.swing.tree.TreeModel;
|
||||
import javax.swing.tree.TreePath;
|
||||
|
||||
import docking.widgets.tree.GTreeNode;
|
||||
import generic.test.AbstractGenericTest;
|
||||
import generic.test.AbstractGuiTest;
|
||||
|
||||
public class TreeTestUtils {
|
||||
public static TreePath findTreePathToText(JTree tree, String text) {
|
||||
@ -57,7 +57,7 @@ public class TreeTestUtils {
|
||||
*/
|
||||
public static void selectTreeNodeByText(final JTree tree, final String text) {
|
||||
|
||||
AbstractGenericTest.runSwing(new Runnable() {
|
||||
AbstractGuiTest.runSwing(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
TreePath path = findTreePathToText(tree, text);
|
||||
@ -68,9 +68,9 @@ public class TreeTestUtils {
|
||||
}
|
||||
});
|
||||
|
||||
AbstractGenericTest.waitForSwing();
|
||||
AbstractGuiTest.waitForSwing();
|
||||
|
||||
AbstractGenericTest.runSwing(new Runnable() {
|
||||
AbstractGuiTest.runSwing(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
TreePath path = findTreePathToText(tree, text);
|
||||
|
@ -24,7 +24,6 @@ apply plugin: 'eclipse'
|
||||
eclipse.project.name = 'Framework Docking'
|
||||
|
||||
dependencies {
|
||||
api project(':Generic')
|
||||
api project(':Help')
|
||||
|
||||
// include code from src/test in Generic
|
||||
|
@ -21,7 +21,7 @@ import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import generic.test.AbstractGTest;
|
||||
import generic.test.AbstractGenericTest;
|
||||
import generic.test.AbstractGuiTest;
|
||||
|
||||
/**
|
||||
* This class mainly serves as a conduit through which testing code can access some of the
|
||||
@ -44,7 +44,7 @@ public class DockingWindowManagerTestUtils {
|
||||
public static Window moveProviderToWindow(final DockingWindowManager dwm,
|
||||
final ComponentProvider provider) {
|
||||
|
||||
AbstractGenericTest.runSwing(() -> {
|
||||
AbstractGuiTest.runSwing(() -> {
|
||||
if (!dwm.containsProvider(provider)) {
|
||||
return;
|
||||
}
|
||||
@ -65,7 +65,7 @@ public class DockingWindowManagerTestUtils {
|
||||
public static void moveProvider(final DockingWindowManager dwm, final ComponentProvider movee,
|
||||
final ComponentProvider relativeTo, final WindowPosition position) {
|
||||
|
||||
AbstractGenericTest.runSwing(() -> {
|
||||
AbstractGuiTest.runSwing(() -> {
|
||||
ComponentPlaceholder moveePlaceholder = dwm.getPlaceholder(movee);
|
||||
ComponentPlaceholder relativeToPlaceholder = dwm.getPlaceholder(relativeTo);
|
||||
dwm.movePlaceholder(moveePlaceholder, relativeToPlaceholder, position);
|
||||
@ -76,7 +76,7 @@ public class DockingWindowManagerTestUtils {
|
||||
final ComponentProvider provider) {
|
||||
|
||||
final AtomicReference<DockableComponent> ref = new AtomicReference<>();
|
||||
AbstractGenericTest.runSwing(() -> ref.set(dwm.getDockableComponent(provider)));
|
||||
AbstractGuiTest.runSwing(() -> ref.set(dwm.getDockableComponent(provider)));
|
||||
|
||||
return ref.get();
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import java.awt.event.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
@ -48,8 +49,9 @@ import docking.widgets.filechooser.GhidraFileChooser;
|
||||
import docking.widgets.table.threaded.ThreadedTableModel;
|
||||
import docking.widgets.tree.GTree;
|
||||
import docking.widgets.tree.GTreeNode;
|
||||
import generic.test.AbstractGenericTest;
|
||||
import generic.test.AbstractGuiTest;
|
||||
import generic.test.ConcurrentTestExceptionHandler;
|
||||
import generic.theme.GIcon;
|
||||
import generic.util.image.ImageUtils;
|
||||
import ghidra.GhidraTestApplicationLayout;
|
||||
import ghidra.framework.ApplicationConfiguration;
|
||||
@ -58,11 +60,12 @@ import ghidra.util.exception.AssertException;
|
||||
import ghidra.util.task.SwingUpdateManager;
|
||||
import ghidra.util.worker.Worker;
|
||||
import junit.framework.AssertionFailedError;
|
||||
import resources.icons.UrlImageIcon;
|
||||
import sun.awt.AppContext;
|
||||
import util.CollectionUtils;
|
||||
import utility.application.ApplicationLayout;
|
||||
|
||||
public abstract class AbstractDockingTest extends AbstractGenericTest {
|
||||
public abstract class AbstractDockingTest extends AbstractGuiTest {
|
||||
|
||||
static {
|
||||
ConcurrentTestExceptionHandler.registerHandler();
|
||||
@ -2265,4 +2268,39 @@ public abstract class AbstractDockingTest extends AbstractGenericTest {
|
||||
ImageUtils.writeFile(image, imageFile);
|
||||
Msg.info(AbstractDockingTest.class, "Wrote image to " + imageFile.getCanonicalPath());
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the two icons are or refer to the same icon (handles GIcon)
|
||||
* @param expected the expected icon
|
||||
* @param actual the actual icon
|
||||
*/
|
||||
public void assertIconsEqual(Icon expected, Icon actual) {
|
||||
if (expected.equals(actual)) {
|
||||
return;
|
||||
}
|
||||
URL url1 = getURL(expected);
|
||||
URL url2 = getURL(actual);
|
||||
|
||||
if (url1 != null && url1.equals(url2)) {
|
||||
return;
|
||||
}
|
||||
fail("Expected icon [" + expected.getClass().getSimpleName() + "]" + expected.toString() +
|
||||
", but got: [" + actual.getClass().getSimpleName() + "]" + actual.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ package docking.widgets.filter;
|
||||
|
||||
import static docking.test.AbstractDockingTest.*;
|
||||
import static generic.test.AbstractGTest.*;
|
||||
import static generic.test.AbstractGenericTest.*;
|
||||
import static generic.test.AbstractGuiTest.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
@ -32,7 +32,7 @@ import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import generic.test.AbstractGTest;
|
||||
import generic.test.AbstractGenericTest;
|
||||
import generic.test.AbstractGuiTest;
|
||||
import utility.function.Callback;
|
||||
|
||||
public class FilterTextFieldTest {
|
||||
@ -276,7 +276,7 @@ public class FilterTextFieldTest {
|
||||
|
||||
private void clickClearFilterIcon() {
|
||||
JLabel clearLabel = filter.getClearLabel();
|
||||
AbstractGenericTest.clickMouse(clearLabel, MouseEvent.BUTTON1, 0, 0, 1, 0);
|
||||
AbstractGuiTest.clickMouse(clearLabel, MouseEvent.BUTTON1, 0, 0, 1, 0);
|
||||
}
|
||||
|
||||
private void setFilter(String text) {
|
||||
|
@ -18,13 +18,10 @@ package docking.widgets.fieldpanel;
|
||||
import org.junit.Test;
|
||||
|
||||
import docking.widgets.fieldpanel.internal.ColorRangeMap;
|
||||
import generic.test.AbstractGenericTest;
|
||||
import generic.test.AbstractGuiTest;
|
||||
import generic.theme.GThemeDefaults.Colors.Palette;
|
||||
|
||||
public class ColorRangeMapTest extends AbstractGenericTest {
|
||||
public ColorRangeMapTest() {
|
||||
super();
|
||||
}
|
||||
public class ColorRangeMapTest extends AbstractGuiTest {
|
||||
|
||||
@Test
|
||||
public void testPaint1() {
|
||||
|
@ -23,7 +23,7 @@ import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import docking.widgets.tree.*;
|
||||
import generic.test.AbstractGenericTest;
|
||||
import generic.test.AbstractGuiTest;
|
||||
|
||||
/**
|
||||
* Class to test the {@link DepthFirstIterator} and {@link BreadthFirstIterator} classes for
|
||||
@ -48,7 +48,7 @@ public class TreeIteratorTest {
|
||||
node0_1 = new GTestNode("Node0_1");
|
||||
node1_0 = new GTestNode("Node1_0");
|
||||
|
||||
AbstractGenericTest.runSwing(() -> {
|
||||
AbstractGuiTest.runSwing(() -> {
|
||||
root.addNode(node0);
|
||||
root.addNode(node1);
|
||||
root.addNode(node2);
|
||||
|
@ -23,7 +23,6 @@ apply plugin: 'eclipse'
|
||||
eclipse.project.name = 'Framework FileSystem'
|
||||
|
||||
dependencies {
|
||||
api project(':Generic')
|
||||
api project(':DB')
|
||||
api project(':Docking')
|
||||
}
|
||||
|
@ -38,13 +38,9 @@ dependencies {
|
||||
api 'org.bouncycastle:bcpkix-jdk15on:1.69' // requires bcutil and bcprov
|
||||
api 'org.bouncycastle:bcprov-jdk15on:1.69'
|
||||
api 'org.bouncycastle:bcutil-jdk15on:1.69'
|
||||
api 'com.formdev:flatlaf:2.6'
|
||||
|
||||
|
||||
compileOnly "junit:junit:4.12"
|
||||
}
|
||||
|
||||
ext.addExports([
|
||||
'java.desktop/sun.awt=ALL-UNNAMED'
|
||||
])
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -22,8 +22,6 @@ import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
import ghidra.util.HTMLUtilities;
|
||||
|
||||
public class FileLocker {
|
||||
|
||||
private static final String META_TAG = "<META> ";
|
||||
@ -111,10 +109,10 @@ public class FileLocker {
|
||||
for (String name : PROPERTY_KEYS) {
|
||||
buf.append("<tr><td>");
|
||||
buf.append(" ");
|
||||
buf.append(HTMLUtilities.escapeHTML(name));
|
||||
buf.append(name);
|
||||
buf.append(": ");
|
||||
buf.append("</td><td>");
|
||||
buf.append(HTMLUtilities.escapeHTML(existingLockProperties.get(name).toString()));
|
||||
buf.append(existingLockProperties.get(name).toString());
|
||||
buf.append("</td></tr>");
|
||||
}
|
||||
buf.append("</table>");
|
||||
|
@ -24,7 +24,6 @@ import org.apache.logging.log4j.core.LoggerContext;
|
||||
import ghidra.util.Msg;
|
||||
import ghidra.util.SystemUtilities;
|
||||
import ghidra.util.exception.AssertException;
|
||||
import resources.ResourceManager;
|
||||
|
||||
public class LoggingInitialization {
|
||||
|
||||
@ -90,7 +89,7 @@ public class LoggingInitialization {
|
||||
loggingConfigFilename = DEVELOPMENT_LOGGING_CONFIGURATION_FILE;
|
||||
}
|
||||
|
||||
return ResourceManager.getResource(loggingConfigFilename);
|
||||
return LoggingInitialization.class.getClassLoader().getResource(loggingConfigFilename);
|
||||
}
|
||||
|
||||
private static URL getLogFileFromSystemProperty() {
|
||||
@ -100,7 +99,7 @@ public class LoggingInitialization {
|
||||
}
|
||||
|
||||
// first see if the given filename is something that is in our classpath
|
||||
URL resource = ResourceManager.getResource(configString);
|
||||
URL resource = LoggingInitialization.class.getClassLoader().getResource(configString);
|
||||
if (resource != null) {
|
||||
return resource;
|
||||
}
|
||||
|
@ -33,8 +33,6 @@ import ghidra.security.KeyStorePasswordProvider;
|
||||
import ghidra.util.Msg;
|
||||
import ghidra.util.SystemUtilities;
|
||||
import ghidra.util.exception.CancelledException;
|
||||
import ghidra.util.filechooser.ExtensionFileFilter;
|
||||
import ghidra.util.filechooser.GhidraFileFilter;
|
||||
|
||||
/**
|
||||
* <code>ApplicationKeyManagerFactory</code> provides application keystore management
|
||||
@ -58,12 +56,6 @@ public class ApplicationKeyManagerFactory {
|
||||
*/
|
||||
public static final String KEYSTORE_PASSWORD_PROPERTY = "ghidra.password";
|
||||
|
||||
/**
|
||||
* PKCS Private Key/Certificate File Filter
|
||||
*/
|
||||
public static final GhidraFileFilter CERTIFICATE_FILE_FILTER =
|
||||
new ExtensionFileFilter(ApplicationKeyStore.PKCS_FILE_EXTENSIONS, "PKCS Key File");
|
||||
|
||||
public static final String DEFAULT_PASSWORD = "changeme";
|
||||
|
||||
private static final int SELF_SIGNED_DURATION_DAYS = 2 * 365; // 2-years
|
||||
|
@ -26,6 +26,7 @@ import java.util.*;
|
||||
import javax.net.ssl.*;
|
||||
import javax.security.auth.DestroyFailedException;
|
||||
import javax.security.auth.x500.X500Principal;
|
||||
import javax.swing.filechooser.FileNameExtensionFilter;
|
||||
|
||||
import org.bouncycastle.asn1.x500.X500Name;
|
||||
import org.bouncycastle.asn1.x500.style.RFC4519Style;
|
||||
@ -61,6 +62,10 @@ public class ApplicationKeyManagerUtils {
|
||||
public static final String BEGIN_CERT = "-----BEGIN CERTIFICATE-----";
|
||||
public static final String END_CERT = "-----END CERTIFICATE-----";
|
||||
|
||||
public static final String[] PKCS_FILE_EXTENSIONS = new String[] { "p12", "pks", "pfx" };
|
||||
public static final FileNameExtensionFilter PKCS_FILENAME_FILTER =
|
||||
new FileNameExtensionFilter("PKCS Key File", PKCS_FILE_EXTENSIONS);
|
||||
|
||||
static {
|
||||
/**
|
||||
* Bouncy Castle uses its BCStyle for X500Names which reverses Distingushed Name ordering.
|
||||
@ -356,21 +361,21 @@ public class ApplicationKeyManagerUtils {
|
||||
long durationMs = (long) durationDays * MILLISECONDS_PER_DAY;
|
||||
Date notAfter = new Date(notBefore.getTime() + durationMs);
|
||||
BigInteger serialNumber = new BigInteger(128, random);
|
||||
|
||||
|
||||
// JcaX509ExtensionUtils x509Utils = new JcaX509ExtensionUtils();
|
||||
|
||||
|
||||
X509v3CertificateBuilder certificateBuilder = new X509v3CertificateBuilder(caX500Name,
|
||||
serialNumber, notBefore, notAfter, x500Name, bcPk);
|
||||
certificateBuilder
|
||||
// .addExtension(Extension.subjectKeyIdentifier, true, x509Utils.createSubjectKeyIdentifier(bcPk))
|
||||
.addExtension(Extension.keyUsage, true, keyUsage);
|
||||
|
||||
|
||||
if (caEntry == null) {
|
||||
certificateBuilder
|
||||
.addExtension(Extension.basicConstraints, true, new BasicConstraints(1));
|
||||
// .addExtension(Extension.authorityKeyIdentifier, true, x509Utils.createAuthorityKeyIdentifier(bcPk));
|
||||
}
|
||||
|
||||
|
||||
ContentSigner contentSigner =
|
||||
new JcaContentSignerBuilder(SIGNING_ALGORITHM).build(issuerKey);
|
||||
|
||||
|
@ -23,7 +23,6 @@ import java.util.Date;
|
||||
import java.util.Enumeration;
|
||||
|
||||
import javax.security.auth.x500.X500Principal;
|
||||
import javax.swing.filechooser.FileNameExtensionFilter;
|
||||
|
||||
import ghidra.util.Msg;
|
||||
|
||||
@ -35,11 +34,6 @@ import ghidra.util.Msg;
|
||||
*/
|
||||
class ApplicationKeyStore {
|
||||
|
||||
static final String[] PKCS_FILE_EXTENSIONS = new String[] { "p12", "pks", "pfx" };
|
||||
|
||||
private static final FileNameExtensionFilter PKCS_FILENAME_FILTER =
|
||||
new FileNameExtensionFilter("PKCS Key File", PKCS_FILE_EXTENSIONS);
|
||||
|
||||
private ApplicationKeyStore() {
|
||||
// no instantiation - static methods only
|
||||
}
|
||||
@ -113,7 +107,7 @@ class ApplicationKeyStore {
|
||||
throws IOException, KeyStoreException, NoSuchAlgorithmException, CertificateException {
|
||||
|
||||
File keystoreFile = new File(keystorePath);
|
||||
boolean isPKCS12 = PKCS_FILENAME_FILTER.accept(keystoreFile);
|
||||
boolean isPKCS12 = ApplicationKeyManagerUtils.PKCS_FILENAME_FILTER.accept(keystoreFile);
|
||||
String type = isPKCS12 ? "PKCS12" : "JKS"; // JKS assumed if not PKCS
|
||||
KeyStore ks = KeyStore.getInstance(type);
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* ###
|
||||
* IP: GHIDRA
|
||||
* REVIEWED: YES
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -16,15 +15,8 @@
|
||||
*/
|
||||
package ghidra.util.xml;
|
||||
|
||||
|
||||
|
||||
import java.io.*;
|
||||
|
||||
import resources.ResourceManager;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* A class for creating XML files.
|
||||
*/
|
||||
@ -42,68 +34,75 @@ public class XmlWriter {
|
||||
* @throws IOException if an i/o error occurs
|
||||
*/
|
||||
public XmlWriter(File file, String dtdName) throws IOException {
|
||||
this(new FileOutputStream(file), dtdName);
|
||||
this(new FileOutputStream(file), dtdName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new XML writer.
|
||||
* @param out the output stream
|
||||
* @param dtdName the name of the DTD
|
||||
* @throws IOException if an i/o error occurs
|
||||
*/
|
||||
public XmlWriter(OutputStream out, String dtdName) throws IOException {
|
||||
writer = new PrintWriter(out);
|
||||
counter = new Counter();
|
||||
public XmlWriter(OutputStream out, String dtdName) throws IOException {
|
||||
writer = new PrintWriter(out);
|
||||
counter = new Counter();
|
||||
if (dtdName != null) {
|
||||
writeDTD(dtdName);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns the XML summary string.
|
||||
* @return the XML summary string
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the XML summary string.
|
||||
* @return the XML summary string
|
||||
*/
|
||||
public Counter getCounter() {
|
||||
return counter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes this XML writer.
|
||||
*/
|
||||
public void close() {
|
||||
writer.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the specified DTD into the file.
|
||||
* @param dtdName the name of the DTD
|
||||
* @throws IOException if an i/o error occurs
|
||||
*/
|
||||
public void writeDTD(String dtdName) throws IOException {
|
||||
InputStream is = ResourceManager.getResourceAsStream(dtdName);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
|
||||
String line;
|
||||
while((line = reader.readLine()) != null) {
|
||||
writer.println(line);
|
||||
}
|
||||
reader.close();
|
||||
}
|
||||
/**
|
||||
* Writes the specified start element.
|
||||
* @param name the name of the start element
|
||||
*/
|
||||
public void writeDTD(String dtdName) throws IOException {
|
||||
InputStream is = getClass().getClassLoader().getResourceAsStream(dtdName);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
writer.println(line);
|
||||
}
|
||||
reader.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the specified start element.
|
||||
* @param name the name of the start element
|
||||
*/
|
||||
public void startElement(String name) {
|
||||
startElement(name, null, null);
|
||||
}
|
||||
/**
|
||||
* Writes the specified start element with the attributes.
|
||||
* @param name the name of the start element
|
||||
* @param attrs the attributes of the start element
|
||||
*/
|
||||
|
||||
/**
|
||||
* Writes the specified start element with the attributes.
|
||||
* @param name the name of the start element
|
||||
* @param attrs the attributes of the start element
|
||||
*/
|
||||
public void startElement(String name, XmlAttributes attrs) {
|
||||
startElement(name, attrs, null);
|
||||
}
|
||||
|
||||
private void startElement(String name, XmlAttributes attrs, String text) {
|
||||
if (addedText) {
|
||||
throw new IllegalStateException("Cannot have child elements in parent elements with text!");
|
||||
}
|
||||
private void startElement(String name, XmlAttributes attrs, String text) {
|
||||
if (addedText) {
|
||||
throw new IllegalStateException(
|
||||
"Cannot have child elements in parent elements with text!");
|
||||
}
|
||||
|
||||
counter.increment(name);
|
||||
|
||||
@ -111,54 +110,56 @@ public class XmlWriter {
|
||||
writer.println(">");
|
||||
incompleteLine = false;
|
||||
}
|
||||
indent();
|
||||
indentLevel++;
|
||||
writer.print("<");
|
||||
writer.print(name);
|
||||
indent();
|
||||
indentLevel++;
|
||||
writer.print("<");
|
||||
writer.print(name);
|
||||
incompleteLine = true;
|
||||
if (attrs != null) {
|
||||
writer.print(attrs.toString());
|
||||
}
|
||||
if (text != null) {
|
||||
writer.print(">");
|
||||
writer.print(XmlUtilities.escapeElementEntities(text));
|
||||
if (attrs != null) {
|
||||
writer.print(attrs.toString());
|
||||
}
|
||||
if (text != null) {
|
||||
writer.print(">");
|
||||
writer.print(XmlUtilities.escapeElementEntities(text));
|
||||
incompleteLine = false;
|
||||
addedText = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the specified end element.
|
||||
* @param name the name of the end element
|
||||
*/
|
||||
public void endElement(String name) {
|
||||
/**
|
||||
* Writes the specified end element.
|
||||
* @param name the name of the end element
|
||||
*/
|
||||
public void endElement(String name) {
|
||||
indentLevel--;
|
||||
if (incompleteLine) {
|
||||
if (incompleteLine) {
|
||||
writer.println(" />");
|
||||
}
|
||||
else {
|
||||
if (!addedText) {
|
||||
}
|
||||
else {
|
||||
if (!addedText) {
|
||||
indent();
|
||||
}
|
||||
writer.println("</"+name+">");
|
||||
}
|
||||
}
|
||||
writer.println("</" + name + ">");
|
||||
}
|
||||
incompleteLine = false;
|
||||
addedText = false;
|
||||
}
|
||||
/**
|
||||
* Writes the specified element with the attributes.
|
||||
* @param name the name of the start element
|
||||
* @param attrs the attributes of the start element
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the specified element with the attributes.
|
||||
* @param name the name of the start element
|
||||
* @param attrs the attributes of the start element
|
||||
*/
|
||||
public void writeElement(String name, XmlAttributes attrs) {
|
||||
writeElement(name, attrs, null);
|
||||
}
|
||||
/**
|
||||
* Writes the specified element with the attributes and text.
|
||||
* @param name the name of the element
|
||||
* @param attrs the attributes of the element
|
||||
* @param text the text of the element
|
||||
*/
|
||||
|
||||
/**
|
||||
* Writes the specified element with the attributes and text.
|
||||
* @param name the name of the element
|
||||
* @param attrs the attributes of the element
|
||||
* @param text the text of the element
|
||||
*/
|
||||
public void writeElement(String name, XmlAttributes attrs, String text) {
|
||||
startElement(name, attrs, text);
|
||||
endElement(name);
|
||||
@ -170,5 +171,3 @@ public class XmlWriter {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -25,7 +25,7 @@ import org.junit.*;
|
||||
|
||||
import edu.uci.ics.jung.algorithms.layout.DAGLayout;
|
||||
import edu.uci.ics.jung.algorithms.layout.Layout;
|
||||
import generic.test.AbstractGenericTest;
|
||||
import generic.test.AbstractGuiTest;
|
||||
import ghidra.graph.graphs.*;
|
||||
import ghidra.graph.support.*;
|
||||
import ghidra.graph.viewer.GraphViewerUtils;
|
||||
@ -60,7 +60,7 @@ public class GraphViewerTransformationsTest {
|
||||
}
|
||||
|
||||
protected void swing(Runnable r) {
|
||||
AbstractGenericTest.runSwing(r);
|
||||
AbstractGuiTest.runSwing(r);
|
||||
}
|
||||
|
||||
private TestVisualGraph buildGraph() {
|
||||
@ -196,7 +196,7 @@ public class GraphViewerTransformationsTest {
|
||||
|
||||
// TODO move up the Swing methods? ...to reduce dependencies on slow startup stuff?
|
||||
|
||||
AbstractGenericTest.runSwing(() -> GraphViewerUtils.setGraphScale(viewer, d));
|
||||
AbstractGenericTest.waitForSwing();
|
||||
AbstractGuiTest.runSwing(() -> GraphViewerUtils.setGraphScale(viewer, d));
|
||||
AbstractGuiTest.waitForSwing();
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ import org.apache.logging.log4j.Logger;
|
||||
import org.junit.*;
|
||||
|
||||
import generic.test.AbstractGTest;
|
||||
import generic.test.AbstractGenericTest;
|
||||
import generic.test.AbstractGuiTest;
|
||||
import ghidra.framework.LoggingInitialization;
|
||||
import ghidra.util.Msg;
|
||||
import ghidra.util.SystemUtilities;
|
||||
@ -35,7 +35,7 @@ import ghidra.util.datastruct.WeakDataStructureFactory;
|
||||
import ghidra.util.datastruct.WeakSet;
|
||||
import ghidra.util.exception.AssertException;
|
||||
|
||||
public class VisualGraphJobRunnerTest extends AbstractGenericTest {
|
||||
public class VisualGraphJobRunnerTest extends AbstractGuiTest {
|
||||
|
||||
// something reasonable: too large makes the test slower; too small, then the test can timeout
|
||||
private static final int RUN_TIME_MILLIS_JOB_THREAD_MAX = 1000;
|
||||
|
@ -32,7 +32,6 @@ import org.junit.Before;
|
||||
|
||||
import docking.test.AbstractDockingTest;
|
||||
import edu.uci.ics.jung.algorithms.layout.Layout;
|
||||
import generic.test.AbstractGenericTest;
|
||||
import ghidra.graph.graphs.AbstractTestVertex;
|
||||
import ghidra.graph.graphs.TestEdge;
|
||||
import ghidra.graph.support.*;
|
||||
@ -123,11 +122,11 @@ public abstract class AbstractVisualGraphTest extends AbstractDockingTest {
|
||||
}
|
||||
|
||||
protected void swing(Runnable r) {
|
||||
AbstractGenericTest.runSwing(r);
|
||||
runSwing(r);
|
||||
}
|
||||
|
||||
protected <T> T swing(Supplier<T> s) {
|
||||
return AbstractGenericTest.runSwing(s);
|
||||
return runSwing(s);
|
||||
}
|
||||
|
||||
protected void waitForAnimation() {
|
||||
@ -258,7 +257,7 @@ public abstract class AbstractVisualGraphTest extends AbstractDockingTest {
|
||||
|
||||
protected void clickViewer(int x, int y) {
|
||||
GraphViewer<AbstractTestVertex, TestEdge> viewer = graphComponent.getPrimaryViewer();
|
||||
AbstractGenericTest.clickMouse(viewer, MouseEvent.BUTTON1, x, y, 1, 0);
|
||||
clickMouse(viewer, MouseEvent.BUTTON1, x, y, 1, 0);
|
||||
waitForSwing();
|
||||
}
|
||||
|
||||
@ -276,7 +275,7 @@ public abstract class AbstractVisualGraphTest extends AbstractDockingTest {
|
||||
Point p = getViewLocation(v);
|
||||
int x = p.x + xOffset;
|
||||
int y = p.y + yOffset;
|
||||
AbstractGenericTest.clickMouse(viewer, MouseEvent.BUTTON1, x, y, clickCount, 0);
|
||||
clickMouse(viewer, MouseEvent.BUTTON1, x, y, clickCount, 0);
|
||||
waitForSwing();
|
||||
|
||||
AbstractTestVertex focused = swing(() -> graph.getFocusedVertex());
|
||||
@ -318,12 +317,12 @@ public abstract class AbstractVisualGraphTest extends AbstractDockingTest {
|
||||
|
||||
int x = (int) p.getX();
|
||||
int y = (int) p.getY();
|
||||
AbstractGenericTest.moveMouse(viewer, x, y);
|
||||
moveMouse(viewer, x, y);
|
||||
}
|
||||
|
||||
protected void drag(int x1, int y1, int x2, int y2) {
|
||||
GraphViewer<AbstractTestVertex, TestEdge> viewer = graphComponent.getPrimaryViewer();
|
||||
AbstractGenericTest.dragMouse(viewer, MouseEvent.BUTTON1, x1, y1, x2, y2, 0);
|
||||
dragMouse(viewer, MouseEvent.BUTTON1, x1, y1, x2, y2, 0);
|
||||
waitForAnimation();
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,6 @@ import org.junit.Test;
|
||||
|
||||
import docking.test.AbstractDockingTest;
|
||||
import edu.uci.ics.jung.visualization.RenderContext;
|
||||
import generic.test.AbstractGenericTest;
|
||||
import generic.test.TestUtils;
|
||||
import generic.util.WindowUtilities;
|
||||
import ghidra.graph.graphs.*;
|
||||
@ -481,7 +480,7 @@ public class GraphComponentTest extends AbstractVisualGraphTest {
|
||||
}
|
||||
|
||||
private void press(String name) {
|
||||
AbstractGenericTest.pressButtonByName(graphComponent.getComponent(), name, true);
|
||||
pressButtonByName(graphComponent.getComponent(), name, true);
|
||||
}
|
||||
|
||||
private AbstractTestVertex pickNonEditableVertex() {
|
||||
|
@ -15,8 +15,7 @@
|
||||
*/
|
||||
package ghidra.graph;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@ -24,6 +23,7 @@ import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
|
||||
import generic.test.AbstractGenericTest;
|
||||
import generic.test.AbstractGuiTest;
|
||||
import ghidra.graph.algo.ChkDominanceAlgorithm;
|
||||
import ghidra.graph.algo.ChkPostDominanceAlgorithm;
|
||||
import ghidra.util.exception.CancelledException;
|
||||
@ -65,7 +65,7 @@ public abstract class AbstractGraphAlgorithmsTest extends AbstractGenericTest {
|
||||
while (true) {
|
||||
|
||||
sleep(1000);
|
||||
printMemory();
|
||||
AbstractGuiTest.printMemory();
|
||||
}
|
||||
|
||||
}, "Memory Monitor");
|
||||
|
1
Ghidra/Framework/Gui/Module.manifest
Normal file
1
Ghidra/Framework/Gui/Module.manifest
Normal file
@ -0,0 +1 @@
|
||||
MODULE FILE LICENSE: lib/flatlaf-2.6.jar Apache License 2.0
|
39
Ghidra/Framework/Gui/build.gradle
Normal file
39
Ghidra/Framework/Gui/build.gradle
Normal file
@ -0,0 +1,39 @@
|
||||
/* ###
|
||||
* IP: GHIDRA
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import org.gradle.plugins.ide.eclipse.model.Container;
|
||||
|
||||
apply from: "$rootProject.projectDir/gradle/distributableGhidraModule.gradle"
|
||||
apply from: "$rootProject.projectDir/gradle/javaProject.gradle"
|
||||
apply from: "$rootProject.projectDir/gradle/jacocoProject.gradle"
|
||||
apply from: "$rootProject.projectDir/gradle/javaTestProject.gradle"
|
||||
apply from: "$rootProject.projectDir/gradle/javadoc.gradle"
|
||||
apply plugin: 'eclipse'
|
||||
|
||||
eclipse.project.name = 'Framework Gui'
|
||||
|
||||
dependencies {
|
||||
api project(':Generic')
|
||||
api 'com.formdev:flatlaf:2.6'
|
||||
|
||||
compileOnly "junit:junit:4.12"
|
||||
|
||||
testImplementation project(path: ':Generic', configuration: 'testArtifacts')
|
||||
}
|
||||
|
||||
ext.addExports([
|
||||
'java.desktop/sun.awt=ALL-UNNAMED'
|
||||
])
|
||||
|
9
Ghidra/Framework/Gui/certification.manifest
Normal file
9
Ghidra/Framework/Gui/certification.manifest
Normal file
@ -0,0 +1,9 @@
|
||||
##VERSION: 2.0
|
||||
##MODULE IP: Modified Nuvola Icons - LGPL 2.1
|
||||
##MODULE IP: Nuvola Icons - LGPL 2.1
|
||||
##MODULE IP: Oxygen Icons - LGPL 3.0
|
||||
##MODULE IP: Tango Icons - Public Domain
|
||||
.classpath||GHIDRA||||END|
|
||||
Module.manifest||GHIDRA||||END|
|
||||
src/main/java/ghidra/framework/options/package.html||GHIDRA||||END|
|
||||
src/main/java/ghidra/util/layout/package.html||GHIDRA||||END|
|
1305
Ghidra/Framework/Gui/src/main/java/generic/test/AbstractGuiTest.java
Normal file
1305
Ghidra/Framework/Gui/src/main/java/generic/test/AbstractGuiTest.java
Normal file
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user