GP-3349 added support for mulitple default action context providers. Previously, all default (non-focused) context was provided by the Listing. Now the default provider is registered for each ActionContext class.

This commit is contained in:
ghidragon 2023-05-08 12:30:01 -04:00
parent 8aa9c8be3a
commit 5da5af23fb
149 changed files with 1354 additions and 1232 deletions

View file

@ -21,7 +21,7 @@ import java.awt.Window;
import org.junit.*;
import docking.ActionContext;
import docking.DefaultActionContext;
import docking.action.DockingActionIf;
import docking.action.ToggleDockingAction;
import docking.util.image.ToolIconURL;
@ -47,8 +47,8 @@ public class DiffSaveSettingsTest extends DiffApplyTestAdapter {
private void launchTool() throws Exception {
// Launch our own tool for the Diff so that we can close it and handle "Save Tool?".
runSwing(() -> tool = frontEndTool.getProject()
.getToolServices()
.launchTool("MyDiffTestTool",
.getToolServices()
.launchTool("MyDiffTestTool",
null));
cb = getPlugin(tool, CodeBrowserPlugin.class);
@ -176,8 +176,7 @@ public class DiffSaveSettingsTest extends DiffApplyTestAdapter {
ProgramManagerPlugin pm = getPlugin(tool, ProgramManagerPlugin.class);
DockingActionIf closeAllProgramAction = getAction(pm, "Close All");
assertNotNull(closeAllProgramAction);
ActionContext defaultContext = tool.getDefaultToolContext();
performAction(closeAllProgramAction, defaultContext, true);
performAction(closeAllProgramAction, new DefaultActionContext(), true);
openProgram(p3);

View file

@ -28,7 +28,7 @@ import javax.swing.tree.TreePath;
import org.junit.Test;
import docking.ActionContext;
import docking.DefaultActionContext;
import docking.DialogComponentProvider;
import docking.action.DockingActionIf;
import docking.widgets.fieldpanel.FieldPanel;
@ -456,7 +456,7 @@ public class DiffTest extends DiffTestAdapter {
JTree tree = getProgramTree();
selectTreeNodeByText(tree, ".data");
runSwing(() -> replaceView.actionPerformed(new ActionContext()));
runSwing(() -> replaceView.actionPerformed(new DefaultActionContext()));
topOfFile(fp1);
assertEquals(addr("1008000"), cb.getCurrentAddress());
@ -482,11 +482,11 @@ public class DiffTest extends DiffTestAdapter {
JTree tree = getProgramTree();
selectTreeNodeByText(tree, ".data");
runSwing(() -> replaceView.actionPerformed(new ActionContext()));
runSwing(() -> replaceView.actionPerformed(new DefaultActionContext()));
selectTreeNodeByText(tree, ".rsrc");
runSwing(() -> goToView.actionPerformed(new ActionContext()));
runSwing(() -> goToView.actionPerformed(new DefaultActionContext()));
topOfFile(fp1);
assertEquals(addr("1008000"), cb.getCurrentAddress());
@ -874,7 +874,7 @@ public class DiffTest extends DiffTestAdapter {
private void clickDiffButton() {
runSwing(() -> {
openClosePgm2.setSelected(!openClosePgm2.isSelected());
openClosePgm2.actionPerformed(new ActionContext());
openClosePgm2.actionPerformed(new DefaultActionContext());
}, false);
waitForSwing();
}

View file

@ -720,11 +720,11 @@ public class DiffTestAdapter extends AbstractGhidraHeadedIntegrationTest {
}
void launchDiffByAction() {
setToggleActionSelected(openClosePgm2, new ActionContext(), true, false);
setToggleActionSelected(openClosePgm2, new DefaultActionContext(), true, false);
}
void closeDiffByAction() {
setToggleActionSelected(openClosePgm2, new ActionContext(), false, false);
setToggleActionSelected(openClosePgm2, new DefaultActionContext(), false, false);
}
void invokeAndWait(DockingActionIf action) {

View file

@ -27,7 +27,7 @@ import javax.swing.tree.TreePath;
import org.junit.Test;
import docking.ActionContext;
import docking.DefaultActionContext;
import docking.DialogComponentProvider;
import docking.widgets.MultiLineLabel;
import docking.widgets.fieldpanel.LayoutModel;
@ -305,7 +305,7 @@ public class DualProgramTest extends DiffTestAdapter {
runSwing(() -> {
openClosePgm2.setSelected(true);
openClosePgm2.actionPerformed(new ActionContext());
openClosePgm2.actionPerformed(new DefaultActionContext());
}, false);
waitForSwing();