mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 17:59:46 +02:00
GT-2960 - Docking Actions - review fixes; test fixes
This commit is contained in:
parent
d8c234d5d0
commit
e6a85f9b1b
7 changed files with 26 additions and 14 deletions
|
@ -15,9 +15,6 @@
|
||||||
*/
|
*/
|
||||||
package ghidra.app.merge.tool;
|
package ghidra.app.merge.tool;
|
||||||
|
|
||||||
import ghidra.app.util.viewer.listingpanel.ListingPanel;
|
|
||||||
import ghidra.framework.plugintool.*;
|
|
||||||
|
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -26,8 +23,11 @@ import javax.swing.JComponent;
|
||||||
import docking.*;
|
import docking.*;
|
||||||
import docking.action.DockingActionIf;
|
import docking.action.DockingActionIf;
|
||||||
import docking.actions.PopupActionProvider;
|
import docking.actions.PopupActionProvider;
|
||||||
|
import ghidra.app.util.viewer.listingpanel.ListingPanel;
|
||||||
|
import ghidra.framework.plugintool.*;
|
||||||
|
|
||||||
public class ListingMergePanelProvider extends ComponentProviderAdapter implements PopupActionProvider {
|
public class ListingMergePanelProvider extends ComponentProviderAdapter
|
||||||
|
implements PopupActionProvider {
|
||||||
private ListingMergePanel mergePanel;
|
private ListingMergePanel mergePanel;
|
||||||
|
|
||||||
public ListingMergePanelProvider(PluginTool tool, Plugin plugin, String owner,
|
public ListingMergePanelProvider(PluginTool tool, Plugin plugin, String owner,
|
||||||
|
@ -51,6 +51,7 @@ public class ListingMergePanelProvider extends ComponentProviderAdapter implemen
|
||||||
}
|
}
|
||||||
|
|
||||||
void dispose() {
|
void dispose() {
|
||||||
|
tool.removePopupActionProvider(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -48,7 +48,8 @@ import ghidra.app.util.viewer.listingpanel.*;
|
||||||
import ghidra.app.util.viewer.multilisting.MultiListingLayoutModel;
|
import ghidra.app.util.viewer.multilisting.MultiListingLayoutModel;
|
||||||
import ghidra.app.util.viewer.util.FieldNavigator;
|
import ghidra.app.util.viewer.util.FieldNavigator;
|
||||||
import ghidra.framework.options.SaveState;
|
import ghidra.framework.options.SaveState;
|
||||||
import ghidra.framework.plugintool.*;
|
import ghidra.framework.plugintool.NavigatableComponentProviderAdapter;
|
||||||
|
import ghidra.framework.plugintool.PluginTool;
|
||||||
import ghidra.program.model.address.*;
|
import ghidra.program.model.address.*;
|
||||||
import ghidra.program.model.listing.*;
|
import ghidra.program.model.listing.*;
|
||||||
import ghidra.program.util.*;
|
import ghidra.program.util.*;
|
||||||
|
@ -227,6 +228,8 @@ public class CodeViewerProvider extends NavigatableComponentProviderAdapter
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
super.dispose();
|
super.dispose();
|
||||||
|
|
||||||
|
tool.removePopupActionProvider(this);
|
||||||
|
|
||||||
if (clipboardService != null) {
|
if (clipboardService != null) {
|
||||||
clipboardService.deRegisterClipboardContentProvider(codeViewerClipboardProvider);
|
clipboardService.deRegisterClipboardContentProvider(codeViewerClipboardProvider);
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class ComponentProviderActionsTest extends AbstractGhidraHeadedIntegratio
|
||||||
private final Icon ICON = ResourceManager.loadImage("images/refresh.png");
|
private final Icon ICON = ResourceManager.loadImage("images/refresh.png");
|
||||||
private static final String PROVIDER_NAME = "Test Action Provider";
|
private static final String PROVIDER_NAME = "Test Action Provider";
|
||||||
private static final KeyStroke CONTROL_T =
|
private static final KeyStroke CONTROL_T =
|
||||||
KeyStroke.getKeyStroke(Character.valueOf('T'), DockingUtils.CONTROL_KEY_MODIFIER_MASK);
|
KeyStroke.getKeyStroke(KeyEvent.VK_T, DockingUtils.CONTROL_KEY_MODIFIER_MASK);
|
||||||
|
|
||||||
private TestEnv env;
|
private TestEnv env;
|
||||||
private PluginTool tool;
|
private PluginTool tool;
|
||||||
|
@ -453,8 +453,12 @@ public class ComponentProviderActionsTest extends AbstractGhidraHeadedIntegratio
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertProviderIsActive() {
|
private void assertProviderIsActive() {
|
||||||
assertTrue("The test provider is not showing and focused",
|
|
||||||
runSwing(() -> tool.isActive(provider)));
|
assertTrue("Component provider is not showing", runSwing(() -> tool.isVisible(provider)));
|
||||||
|
|
||||||
|
// note: we can't call 'isActive()' due to focus issues in parallel testing
|
||||||
|
//assertTrue("The test provider is not showing and focused",
|
||||||
|
// runSwing(() -> tool.isActive(provider)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertProviderIsHidden() {
|
private void assertProviderIsHidden() {
|
||||||
|
|
|
@ -97,7 +97,12 @@ public class KeyBindingsTest extends AbstractGhidraHeadedIntegrationTest {
|
||||||
// verify that the description is displayed for the selected action
|
// verify that the description is displayed for the selected action
|
||||||
|
|
||||||
selectRowForAction(action1);
|
selectRowForAction(action1);
|
||||||
assertTrue(statusPane.getText().indexOf(action1.getDescription()) != -1);
|
|
||||||
|
String actualText = statusPane.getText();
|
||||||
|
assertTrue(
|
||||||
|
"Description is not updated for action '" + action1.getName() + "'; instead the " +
|
||||||
|
"description is '" + actualText + "'",
|
||||||
|
actualText.indexOf(action1.getDescription()) != -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -807,7 +807,7 @@ public abstract class ComponentProvider implements HelpDescriptor, ActionContext
|
||||||
|
|
||||||
DockingWindowManager myDwm = DockingWindowManager.getInstance(getComponent());
|
DockingWindowManager myDwm = DockingWindowManager.getInstance(getComponent());
|
||||||
if (myDwm == null) {
|
if (myDwm == null) {
|
||||||
// don't think this can happen
|
// this can happen when the tool loses focus
|
||||||
dockingTool.showComponentProvider(ComponentProvider.this, true);
|
dockingTool.showComponentProvider(ComponentProvider.this, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -845,9 +845,9 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder
|
||||||
}
|
}
|
||||||
|
|
||||||
placeholder.show(visibleState);
|
placeholder.show(visibleState);
|
||||||
movePlaceholderToFront(placeholder, false);
|
|
||||||
|
|
||||||
if (visibleState) {
|
if (visibleState) {
|
||||||
|
movePlaceholderToFront(placeholder, false);
|
||||||
if (placeholder.getNode() == null) {
|
if (placeholder.getNode() == null) {
|
||||||
root.add(placeholder);
|
root.add(placeholder);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,8 +28,6 @@ import ghidra.framework.plugintool.Plugin;
|
||||||
*/
|
*/
|
||||||
public class VersionControlShowHistoryAction extends VersionControlAction {
|
public class VersionControlShowHistoryAction extends VersionControlAction {
|
||||||
|
|
||||||
private VersionHistoryDialog dialog;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an action to show the version history for a single version controlled
|
* Creates an action to show the version history for a single version controlled
|
||||||
* domain file in the repository.
|
* domain file in the repository.
|
||||||
|
@ -71,11 +69,12 @@ public class VersionControlShowHistoryAction extends VersionControlAction {
|
||||||
if (!checkRepositoryConnected()) {
|
if (!checkRepositoryConnected()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (domainFiles.size() != 1) {
|
if (domainFiles.size() != 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog = new VersionHistoryDialog(domainFiles.get(0));
|
VersionHistoryDialog dialog = new VersionHistoryDialog(domainFiles.get(0));
|
||||||
tool.showDialog(dialog, tool.getToolFrame());
|
tool.showDialog(dialog, tool.getToolFrame());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue