mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 02:09:44 +02:00
Test fixes
This commit is contained in:
parent
6a818106fd
commit
47500148ce
4 changed files with 34 additions and 20 deletions
|
@ -4,9 +4,9 @@
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@ -163,7 +163,12 @@ public abstract class AbstractDataTreeDialog extends DialogComponentProvider
|
||||||
// must have been closed; some kind of timing issue
|
// must have been closed; some kind of timing issue
|
||||||
return super.getActionContext(event);
|
return super.getActionContext(event);
|
||||||
}
|
}
|
||||||
return treePanel.getActionContext(null, event);
|
|
||||||
|
ActionContext actionContext = treePanel.getActionContext(null, event);
|
||||||
|
if (actionContext instanceof DialogActionContext dac) {
|
||||||
|
dac.setDialogComponentProvider(this);
|
||||||
|
}
|
||||||
|
return actionContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void show() {
|
public void show() {
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class DualProgramTest extends DiffTestAdapter {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEscapeOpenSecondProgram() throws Exception {
|
public void testOpenSecondProgram_Escape() throws Exception {
|
||||||
|
|
||||||
restoreProgram(diffTestP2);
|
restoreProgram(diffTestP2);
|
||||||
loadProgram(diffTestP1);
|
loadProgram(diffTestP1);
|
||||||
|
|
|
@ -16,25 +16,30 @@
|
||||||
package docking;
|
package docking;
|
||||||
|
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
|
import java.util.Objects;
|
||||||
import ghidra.util.Msg;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action context for {@link DialogComponentProvider}s.
|
* Action context for {@link DialogComponentProvider}s.
|
||||||
*/
|
*/
|
||||||
public class DialogActionContext extends DefaultActionContext {
|
public class DialogActionContext extends DefaultActionContext {
|
||||||
|
|
||||||
|
private DialogComponentProvider dialogProvider;
|
||||||
|
|
||||||
public DialogActionContext(DialogComponentProvider dialogProvider, Component sourceComponent) {
|
public DialogActionContext(DialogComponentProvider dialogProvider, Component sourceComponent) {
|
||||||
super(null, dialogProvider, sourceComponent);
|
super(null, dialogProvider, sourceComponent);
|
||||||
|
this.dialogProvider = Objects.requireNonNull(dialogProvider);
|
||||||
|
}
|
||||||
|
|
||||||
|
// this constructor allows clients to set the dialog later
|
||||||
|
public DialogActionContext(Object contextObject, Component sourceComponent) {
|
||||||
|
super(null, contextObject, sourceComponent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDialogComponentProvider(DialogComponentProvider dialogProvider) {
|
||||||
|
this.dialogProvider = dialogProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DialogComponentProvider getDialogComponentProvider() {
|
public DialogComponentProvider getDialogComponentProvider() {
|
||||||
Object contextObject = getContextObject();
|
return dialogProvider;
|
||||||
if (contextObject instanceof DialogComponentProvider dcp) {
|
|
||||||
return dcp;
|
|
||||||
}
|
|
||||||
|
|
||||||
Msg.warn(this, "Found dialog context without a DialogComponentProvider context object");
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@ -20,15 +20,19 @@ import java.util.List;
|
||||||
|
|
||||||
import javax.swing.tree.TreePath;
|
import javax.swing.tree.TreePath;
|
||||||
|
|
||||||
import docking.DefaultActionContext;
|
import docking.DialogActionContext;
|
||||||
import docking.widgets.tree.GTreeNode;
|
import docking.widgets.tree.GTreeNode;
|
||||||
import ghidra.framework.main.datatable.ProjectTreeContext;
|
import ghidra.framework.main.datatable.ProjectTreeContext;
|
||||||
import ghidra.framework.model.*;
|
import ghidra.framework.model.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Context specific to the DataTreeDialog.
|
* Context specific to the DataTreeDialog.
|
||||||
|
*
|
||||||
|
* Note: this context is used from by the {@link ProjectDataTreePanel}. This class may or may not
|
||||||
|
* be in a dialog. For convenience, this class extends a dialog action context, but may not always
|
||||||
|
* be associated with a dialog.
|
||||||
*/
|
*/
|
||||||
public class DialogProjectTreeContext extends DefaultActionContext implements ProjectTreeContext {
|
public class DialogProjectTreeContext extends DialogActionContext implements ProjectTreeContext {
|
||||||
|
|
||||||
private TreePath[] selectionPaths;
|
private TreePath[] selectionPaths;
|
||||||
private DataTree tree;
|
private DataTree tree;
|
||||||
|
@ -36,9 +40,9 @@ public class DialogProjectTreeContext extends DefaultActionContext implements Pr
|
||||||
private List<DomainFile> selectedFiles;
|
private List<DomainFile> selectedFiles;
|
||||||
|
|
||||||
public DialogProjectTreeContext(ProjectData projectData,
|
public DialogProjectTreeContext(ProjectData projectData,
|
||||||
TreePath[] selectionPaths,
|
TreePath[] selectionPaths, List<DomainFolder> folderList, List<DomainFile> fileList,
|
||||||
List<DomainFolder> folderList, List<DomainFile> fileList, DataTree tree) {
|
DataTree tree) {
|
||||||
super(null, getContextObject(selectionPaths), tree);
|
super(getContextObject(selectionPaths), tree);
|
||||||
this.selectionPaths = selectionPaths;
|
this.selectionPaths = selectionPaths;
|
||||||
this.selectedFolders = folderList;
|
this.selectedFolders = folderList;
|
||||||
this.selectedFiles = fileList;
|
this.selectedFiles = fileList;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue