Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-6101 - Symbol Tree - Added a toolbar toggle action to control outgoing navigations

dragonmachere8f2db974093
diff --git a/Ghidra/Features/Base/src/main/help/help/topics/SymbolTreePlugin/SymbolTree.htm b/Ghidra/Features/Base/src/main/help/help/topics/SymbolTreePlugin/SymbolTree.htm
index 4eefa0ee61..517496dc42 100644
--- a/Ghidra/Features/Base/src/main/help/help/topics/SymbolTreePlugin/SymbolTree.htm
+++ b/Ghidra/Features/Base/src/main/help/help/topics/SymbolTreePlugin/SymbolTree.htm
@@ -311,22 +311,32 @@
<H2><A name="Navigate_To"></A>Navigation <IMG alt="" src="images/locationIn.gif"></H2>
<BLOCKQUOTE>
- <H3><A name="Navigation"></A>Navigating to Locations within the Program</H3>
+
+ <H3><A name="Navigate_on_Incoming"></A>Navigating on Program Location Changes</H3>
<BLOCKQUOTE>
- <P>The <IMG alt="" src="images/locationIn.gif"> &nbsp; button controls whether a symbol is
- selected in the Symbol Tree when you click in the Code Browser.&nbsp; While the <IMG alt=""
- src="images/locationIn.gif"> &nbsp; button is selected, if the location from the Code
+ <P>The <IMG alt="" src="icon.navigate.in"> button controls whether a symbol is
+ selected in the Symbol Tree when you click in the Code Browser. While the <IMG alt=""
+ src="icon.navigate.in"> button is selected, if the location from the Code
Browser can be interpreted as a symbol, the symbol is automatically selected in the Symbol
- Tree.&nbsp; This toggle state is off by default; to turn on this feature, click on the
- icon.&nbsp; The state of the <IMG alt="" src="images/locationIn.gif"> &nbsp; button is
+ Tree. This action is off by default. The state of the
+ <IMG alt="" src="icon.navigate.in"> button is
saved when you close the project or exit Ghidra and restored when you reopen the
project.</P>
-
- <P>The Symbol Tree allows you to navigate within the Code Browser when you mouse click on a
- symbol in the tree. The <IMG alt="" src="images/locationIn.gif"> &nbsp; button applies only
- to locations coming from the Code Browser and has no effect when you click in the tree.</P>
</BLOCKQUOTE>
+
+
+ <H3><A name="Navigate_on_Outgoing"></A>Navigating on Symbol Changes</H3>
+
+ <BLOCKQUOTE>
+ <P>The <IMG alt="" src="icon.navigate.out"> button controls whether a Code Browser
+ navigation happens when symbol is selected. This action is on by default.
+ The state of the <IMG alt="" src="icon.navigate.out"> button is saved when you close the
+ project or exit Ghidra and restored when you reopen the project.</P>
+ </P>
+ </BLOCKQUOTE>
+
+
<H3><A name="Go_To_External_Location"></A>Navigating to External Locations</H3>
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/symboltree/DisconnectedSymbolTreeProvider.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/symboltree/DisconnectedSymbolTreeProvider.java
index 23be76031c..683ecbd730 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/symboltree/DisconnectedSymbolTreeProvider.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/symboltree/DisconnectedSymbolTreeProvider.java
@@ -43,9 +43,10 @@ public class DisconnectedSymbolTreeProvider extends SymbolTreeProvider {
createActions();
- // Snapshots do not usually track events. Turn this off now, but leave the action so
- // clients can turn the action on as desired.
- goToToggleAction.setEnabled(false);
+ // Snapshots do not usually respond to incoming location events. But, it seems to make
+ // sense that users would like to use the snapshot to navigate the tool.
+ tool.removeLocalAction(this, navigateIncomingAction);
+ navigateIncomingAction.setSelected(false);
setHelpLocation(new HelpLocation("SymbolTreePlugin", "Disconnected_Symbol_Tree"));
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/symboltree/SymbolTreeProvider.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/symboltree/SymbolTreeProvider.java
index 2855d4a4a1..190091f6b5 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/symboltree/SymbolTreeProvider.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/symboltree/SymbolTreeProvider.java
@@ -67,7 +67,8 @@ public class SymbolTreeProvider extends ComponentProviderAdapter {
protected SymbolGTree tree;
protected JComponent component;
- protected GoToToggleAction goToToggleAction;
+ protected NavigateOnIncomingAction navigateIncomingAction;
+ protected NavigateOnOutgoingActon navigateOutgoingAction;
/**
* A list into which tasks to be run will accumulated until we put them into the GTree's
@@ -162,6 +163,10 @@ public class SymbolTreeProvider extends ComponentProviderAdapter {
newTree.addGTreeSelectionListener(e -> {
+ if (!navigateOutgoingAction.isSelected()) {
+ return;
+ }
+
EventOrigin origin = e.getEventOrigin();
if (origin != EventOrigin.USER_GENERATED) {
contextChanged();
@@ -177,6 +182,10 @@ public class SymbolTreeProvider extends ComponentProviderAdapter {
@Override
public void mouseClicked(MouseEvent e) {
+ if (!navigateOutgoingAction.isSelected()) {
+ return;
+ }
+
// This code serves to perform navigation in the case that the selection handler
// above does not, as is the case when the clicked node is already selected. This
// code will get called on the mouse clicked, whereas the selection handler gets
@@ -275,7 +284,9 @@ public class SymbolTreeProvider extends ComponentProviderAdapter {
DockingAction selectionAction = new SelectionAction(plugin);
selectionAction.setEnabled(false);
- goToToggleAction = new GoToToggleAction(plugin);
+ navigateIncomingAction = new NavigateOnIncomingAction(plugin);
+ navigateOutgoingAction = new NavigateOnOutgoingActon(plugin);
+
DockingAction goToExternalAction = new GoToExternalLocationAction(plugin);
goToExternalAction.setEnabled(false);
@@ -294,7 +305,8 @@ public class SymbolTreeProvider extends ComponentProviderAdapter {
tool.addLocalAction(this, pasteAction);
tool.addLocalAction(this, deleteAction);
tool.addLocalAction(this, referencesAction);
- tool.addLocalAction(this, goToToggleAction);
+ tool.addLocalAction(this, navigateIncomingAction);
+ tool.addLocalAction(this, navigateOutgoingAction);
tool.addLocalAction(this, selectionAction);
tool.addLocalAction(this, goToExternalAction);
tool.addLocalAction(this, cloneAction);
@@ -528,8 +540,9 @@ public class SymbolTreeProvider extends ComponentProviderAdapter {
domainChangeUpdateManager.update();
}
+ // incoming tool location changes
public void locationChanged(ProgramLocation loc) {
- if (!goToToggleAction.isSelected()) {
+ if (!navigateIncomingAction.isSelected()) {
return;
}
@@ -591,11 +604,13 @@ public class SymbolTreeProvider extends ComponentProviderAdapter {
}
void readConfigState(SaveState saveState) {
- goToToggleAction.setSelected(saveState.getBoolean("GO_TO_TOGGLE_STATE", false));
+ navigateIncomingAction.setSelected(saveState.getBoolean("NAVIGTE_INCOMING", false));
+ navigateOutgoingAction.setSelected(saveState.getBoolean("NAVIGTE_OUTGOING", true));
}
void writeConfigState(SaveState saveState) {
- saveState.putBoolean("GO_TO_TOGGLE_STATE", goToToggleAction.isSelected());
+ saveState.putBoolean("NAVIGTE_INCOMING", navigateIncomingAction.isSelected());
+ saveState.putBoolean("NAVIGTE_OUTGOING", navigateOutgoingAction.isSelected());
}
void dispose() {
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/symboltree/actions/GoToToggleAction.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/symboltree/actions/NavigateOnIncomingAction.java
similarity index 71%
rename from Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/symboltree/actions/GoToToggleAction.java
rename to Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/symboltree/actions/NavigateOnIncomingAction.java
index 0ac6122dcc..2f74597cf6 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/symboltree/actions/GoToToggleAction.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/symboltree/actions/NavigateOnIncomingAction.java
@@ -4,9 +4,9 @@
* 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.
@@ -21,16 +21,20 @@ import ghidra.app.plugin.core.symboltree.SymbolTreePlugin;
import ghidra.util.HTMLUtilities;
import resources.Icons;
-public class GoToToggleAction extends ToggleDockingAction {
+public class NavigateOnIncomingAction extends ToggleDockingAction {
- public GoToToggleAction(SymbolTreePlugin plugin) {
- super("Navigation", plugin.getName());
+ public static final String NAME = "Navigate on Incoming";
+
+ public NavigateOnIncomingAction(SymbolTreePlugin plugin) {
+ super(NAME, plugin.getName());
- setEnabled(true);
this.setToolBarData(new ToolBarData(Icons.NAVIGATE_ON_INCOMING_EVENT_ICON, null));
+ setEnabled(true);
setSelected(false);
- setDescription(HTMLUtilities.toHTML("Toggle <b>On</b> means to select the symbol\n" +
- "that corresponds to the current location."));
+ setDescription(HTMLUtilities.toHTML("""
+ Toggle <b>On</b> means to select the matching tree
+ symbol on program location changes
+ """));
}
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/symboltree/actions/NavigateOnOutgoingActon.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/symboltree/actions/NavigateOnOutgoingActon.java
new file mode 100644
index 0000000000..ce2c662b32
--- /dev/null
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/symboltree/actions/NavigateOnOutgoingActon.java
@@ -0,0 +1,38 @@
+/* ###
+ * 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.
+ */
+package ghidra.app.plugin.core.symboltree.actions;
+
+import docking.action.ToggleDockingAction;
+import docking.action.ToolBarData;
+import ghidra.app.plugin.core.symboltree.SymbolTreePlugin;
+import ghidra.util.HTMLUtilities;
+import resources.Icons;
+
+public class NavigateOnOutgoingActon extends ToggleDockingAction {
+
+ public NavigateOnOutgoingActon(SymbolTreePlugin plugin) {
+ super("Navigate on Outgoing", plugin.getName());
+
+ this.setToolBarData(new ToolBarData(Icons.NAVIGATE_ON_OUTGOING_EVENT_ICON, null));
+
+ setEnabled(true);
+ setSelected(true);
+ setDescription(HTMLUtilities.toHTML("""
+ Toggle <b>on</b> means to navigate to the location
+ in the program as the selected tree symbol changes.
+ """));
+ }
+}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/util/table/AbstractSelectionNavigationAction.java b/Ghidra/Features/Base/src/main/java/ghidra/util/table/AbstractSelectionNavigationAction.java
index 011ba35768..bc4a9e75e5 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/util/table/AbstractSelectionNavigationAction.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/util/table/AbstractSelectionNavigationAction.java
@@ -24,8 +24,7 @@ import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import docking.DockingWindowManager;
-import docking.action.ToggleDockingAction;
-import docking.action.ToolBarData;
+import docking.action.*;
import ghidra.framework.options.PreferenceState;
import ghidra.util.HTMLUtilities;
import ghidra.util.HelpLocation;
@@ -51,14 +50,17 @@ public abstract class AbstractSelectionNavigationAction extends ToggleDockingAct
protected final JTable table;
protected AbstractSelectionNavigationAction(String name, String owner, JTable table) {
- super(name, owner, false);
+ super(name, owner, KeyBindingType.SHARED);
this.table = table;
selectionListener = new SelectionListener();
setToolBarData(new ToolBarData(ICON));
- setDescription(HTMLUtilities.toHTML("Toggle <b>on</b> means to navigate to the location\n" +
- "in the program that corresponds to the selected row,\n as the selection changes."));
+ setDescription(HTMLUtilities.toHTML("""
+ Toggle <b>on</b> means to navigate to the location
+ in the program that corresponds to the selected row,
+ as the selection changes.
+ """));
setHelpLocation(new HelpLocation("Search", "Selection_Navigation"));
setSelected(true); // toggle button; enabled by default
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/symboltree/AbstractSymbolTreePluginExternalsTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/symboltree/AbstractSymbolTreePluginExternalsTest.java
index 8682ca2895..a6ead3ecfe 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/symboltree/AbstractSymbolTreePluginExternalsTest.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/symboltree/AbstractSymbolTreePluginExternalsTest.java
@@ -35,6 +35,7 @@ import ghidra.app.plugin.core.marker.MarkerManagerPlugin;
import ghidra.app.plugin.core.memory.MemoryMapPlugin;
import ghidra.app.plugin.core.navigation.GoToAddressLabelPlugin;
import ghidra.app.plugin.core.programtree.ProgramTreePlugin;
+import ghidra.app.plugin.core.symboltree.actions.NavigateOnIncomingAction;
import ghidra.app.services.ProgramManager;
import ghidra.app.util.AddressInput;
import ghidra.app.util.NamespaceUtils;
@@ -79,7 +80,7 @@ public abstract class AbstractSymbolTreePluginExternalsTest
protected DockingActionIf selectionAction;
protected DockingActionIf createNamespaceAction;
protected DockingActionIf createClassAction;
- protected DockingActionIf goToToggleAction;
+ protected DockingActionIf navigateIncomingAction;
protected DockingActionIf goToExtLocAction;
protected DockingActionIf createLibraryAction;
protected DockingActionIf setExternalProgramAction;
@@ -493,8 +494,8 @@ public abstract class AbstractSymbolTreePluginExternalsTest
editExternalLocationAction = getAction(plugin, "Edit External Location");
assertNotNull(editExternalLocationAction);
- goToToggleAction = getAction(plugin, "Navigation");
- assertNotNull(goToToggleAction);
+ navigateIncomingAction = getAction(plugin, NavigateOnIncomingAction.NAME);
+ assertNotNull(navigateIncomingAction);
goToExtLocAction = getAction(plugin, "Go To External Location");
assertNotNull(goToExtLocAction);
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/symboltree/SymbolTreePlugin1Test.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/symboltree/SymbolTreePlugin1Test.java
index 8ab471bbd0..f9079857c6 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/symboltree/SymbolTreePlugin1Test.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/symboltree/SymbolTreePlugin1Test.java
@@ -39,6 +39,7 @@ import generic.test.AbstractGenericTest;
import ghidra.app.plugin.core.codebrowser.CodeBrowserPlugin;
import ghidra.app.plugin.core.marker.MarkerManagerPlugin;
import ghidra.app.plugin.core.programtree.ProgramTreePlugin;
+import ghidra.app.plugin.core.symboltree.actions.NavigateOnIncomingAction;
import ghidra.app.plugin.core.symboltree.nodes.*;
import ghidra.app.services.ProgramManager;
import ghidra.framework.plugintool.PluginTool;
@@ -73,7 +74,7 @@ public class SymbolTreePlugin1Test extends AbstractGhidraHeadedIntegrationTest {
private DockingActionIf selectionAction;
private DockingActionIf createNamespaceAction;
private DockingActionIf createClassAction;
- private DockingActionIf goToToggleAction;
+ private DockingActionIf navigateIncomingAction;
private DockingActionIf goToExtLocAction;
private DockingActionIf createLibraryAction;
private DockingActionIf setExternalProgramAction;
@@ -915,8 +916,8 @@ public class SymbolTreePlugin1Test extends AbstractGhidraHeadedIntegrationTest {
editExternalLocationAction = getAction(plugin, "Edit External Location");
assertNotNull(editExternalLocationAction);
- goToToggleAction = getAction(plugin, "Navigation");
- assertNotNull(goToToggleAction);
+ navigateIncomingAction = getAction(plugin, NavigateOnIncomingAction.NAME);
+ assertNotNull(navigateIncomingAction);
goToExtLocAction = getAction(plugin, "Go To External Location");
assertNotNull(goToExtLocAction);
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/symboltree/SymbolTreePlugin2Test.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/symboltree/SymbolTreePlugin2Test.java
index 73c627a654..10cb7a4e6d 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/symboltree/SymbolTreePlugin2Test.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/symboltree/SymbolTreePlugin2Test.java
@@ -35,6 +35,7 @@ import ghidra.app.cmd.label.RenameLabelCmd;
import ghidra.app.plugin.core.codebrowser.CodeBrowserPlugin;
import ghidra.app.plugin.core.marker.MarkerManagerPlugin;
import ghidra.app.plugin.core.programtree.ProgramTreePlugin;
+import ghidra.app.plugin.core.symboltree.actions.NavigateOnIncomingAction;
import ghidra.app.plugin.core.symboltree.nodes.SymbolCategoryNode;
import ghidra.app.plugin.core.symboltree.nodes.SymbolNode;
import ghidra.app.util.viewer.field.*;
@@ -65,7 +66,7 @@ public class SymbolTreePlugin2Test extends AbstractGhidraHeadedIntegrationTest {
private DockingActionIf createNamespaceAction;
private DockingActionIf createClassAction;
private DockingActionIf convertToClassAction;
- private ToggleDockingAction goToToggleAction;
+ private ToggleDockingAction navigateIncomingAction;
private SymbolTreeTestUtils util;
private SymbolGTree tree;
@@ -89,7 +90,7 @@ public class SymbolTreePlugin2Test extends AbstractGhidraHeadedIntegrationTest {
getActions();
rootNode = util.getRootNode();
tree = util.getTree();
- SwingUtilities.invokeAndWait(() -> goToToggleAction.setSelected(true));
+ SwingUtilities.invokeAndWait(() -> navigateIncomingAction.setSelected(true));
}
@After
@@ -103,7 +104,7 @@ public class SymbolTreePlugin2Test extends AbstractGhidraHeadedIntegrationTest {
// select a node; code browser should go there
- assertTrue(goToToggleAction.isSelected());
+ assertTrue(navigateIncomingAction.isSelected());
GTreeNode fNode = getFunctionsNode();
util.expandNode(fNode);
@@ -732,8 +733,8 @@ public class SymbolTreePlugin2Test extends AbstractGhidraHeadedIntegrationTest {
convertToClassAction = getAction(plugin, "Convert to Class");
assertNotNull(convertToClassAction);
- goToToggleAction = (ToggleDockingAction) getAction(plugin, "Navigation");
- assertNotNull(goToToggleAction);
+ navigateIncomingAction = (ToggleDockingAction) getAction(plugin, NavigateOnIncomingAction.NAME);
+ assertNotNull(navigateIncomingAction);
}
private void performTreeAction(DockingActionIf action, ActionContext context) {
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/symboltree/SymbolTreePlugin3Test.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/symboltree/SymbolTreePlugin3Test.java
index 9403a1b606..3733786018 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/symboltree/SymbolTreePlugin3Test.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/symboltree/SymbolTreePlugin3Test.java
@@ -4,9 +4,9 @@
* 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.
@@ -36,6 +36,7 @@ import docking.widgets.tree.support.GTreeNodeTransferable;
import ghidra.app.plugin.core.codebrowser.CodeBrowserPlugin;
import ghidra.app.plugin.core.marker.MarkerManagerPlugin;
import ghidra.app.plugin.core.programtree.ProgramTreePlugin;
+import ghidra.app.plugin.core.symboltree.actions.NavigateOnIncomingAction;
import ghidra.app.plugin.core.symboltree.nodes.*;
import ghidra.app.util.viewer.field.LabelFieldFactory;
import ghidra.framework.options.SaveState;
@@ -186,10 +187,10 @@ public class SymbolTreePlugin3Test extends AbstractGhidraHeadedIntegrationTest {
@Test
public void testDragDropLabelOnClass() throws Exception {
- final ToggleDockingAction goToToggleAction =
- (ToggleDockingAction) getAction(plugin, "Navigation");
+ final ToggleDockingAction navigateIncomingAction =
+ (ToggleDockingAction) getAction(plugin, NavigateOnIncomingAction.NAME);
- runSwing(() -> goToToggleAction.setSelected(true));
+ runSwing(() -> navigateIncomingAction.setSelected(true));
GTreeNode cNode = rootNode.getChild(4);
GTreeNode nsNode = util.createObject(cNode, "MyClass", createClassAction);
assertNotNull(nsNode);
@@ -333,10 +334,10 @@ public class SymbolTreePlugin3Test extends AbstractGhidraHeadedIntegrationTest {
@Test
public void testSaveState() throws Exception {
- final ToggleDockingAction goToToggleAction =
- (ToggleDockingAction) getAction(plugin, "Navigation");
- assertNotNull(goToToggleAction);
- runSwing(() -> goToToggleAction.setSelected(true));
+ final ToggleDockingAction navigateIncomingAction =
+ (ToggleDockingAction) getAction(plugin, NavigateOnIncomingAction.NAME);
+ assertNotNull(navigateIncomingAction);
+ runSwing(() -> navigateIncomingAction.setSelected(true));
SaveState saveState = new SaveState("Test");
plugin.writeConfigState(saveState);
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/symboltree/SymbolTreePluginX86Test.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/symboltree/SymbolTreePluginX86Test.java
index 1a830a711b..490c8351b7 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/symboltree/SymbolTreePluginX86Test.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/symboltree/SymbolTreePluginX86Test.java
@@ -4,9 +4,9 @@
* 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.
@@ -28,6 +28,7 @@ import docking.widgets.tree.GTreeNode;
import ghidra.app.plugin.core.codebrowser.CodeBrowserPlugin;
import ghidra.app.plugin.core.marker.MarkerManagerPlugin;
import ghidra.app.plugin.core.programtree.ProgramTreePlugin;
+import ghidra.app.plugin.core.symboltree.actions.NavigateOnIncomingAction;
import ghidra.app.plugin.core.symboltree.nodes.SymbolNode;
import ghidra.app.util.viewer.field.LabelFieldFactory;
import ghidra.app.util.viewer.field.OperandFieldFactory;
@@ -52,7 +53,7 @@ public class SymbolTreePluginX86Test extends AbstractGhidraHeadedIntegrationTest
private DockingActionIf selectionAction;
private DockingActionIf createNamespaceAction;
private DockingActionIf createClassAction;
- private ToggleDockingAction goToToggleAction;
+ private ToggleDockingAction navigateIncomingAction;
private SymbolTreeTestUtils util;
private SymbolGTree tree;
@@ -76,7 +77,7 @@ public class SymbolTreePluginX86Test extends AbstractGhidraHeadedIntegrationTest
getActions();
rootNode = util.getRootNode();
tree = util.getTree();
- runSwing(() -> goToToggleAction.setSelected(true));
+ runSwing(() -> navigateIncomingAction.setSelected(true));
}
@After
@@ -107,8 +108,8 @@ public class SymbolTreePluginX86Test extends AbstractGhidraHeadedIntegrationTest
@Test
public void testGoToNotSelected() throws Exception {
- goToToggleAction.setSelected(false);
- performAction(goToToggleAction, getContext(), true);
+ navigateIncomingAction.setSelected(false);
+ performAction(navigateIncomingAction, getContext(), true);
GTreeNode node = rootNode.getChild(0);
util.selectNode(node);
@@ -209,8 +210,8 @@ public class SymbolTreePluginX86Test extends AbstractGhidraHeadedIntegrationTest
createNamespaceAction = getAction(plugin, "Create Namespace");
assertNotNull(createNamespaceAction);
- goToToggleAction = (ToggleDockingAction) getAction(plugin, "Navigation");
- assertNotNull(goToToggleAction);
+ navigateIncomingAction = (ToggleDockingAction) getAction(plugin, NavigateOnIncomingAction.NAME);
+ assertNotNull(navigateIncomingAction);
}
private ActionContext getContext() {
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/symboltree/SymbolTreeTestUtils.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/symboltree/SymbolTreeTestUtils.java
index 9563089fa1..7a0e173d12 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/symboltree/SymbolTreeTestUtils.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/symboltree/SymbolTreeTestUtils.java
@@ -41,6 +41,7 @@ import docking.test.AbstractDockingTest;
import docking.widgets.tree.GTree;
import docking.widgets.tree.GTreeNode;
import docking.widgets.tree.support.GTreeNodeTransferable;
+import ghidra.app.plugin.core.symboltree.actions.NavigateOnIncomingAction;
import ghidra.app.plugin.core.symboltree.nodes.*;
import ghidra.app.services.ProgramManager;
import ghidra.program.model.address.Address;
@@ -68,7 +69,7 @@ class SymbolTreeTestUtils {
private DockingActionIf selectionAction;
private DockingActionIf createNamespaceAction;
private DockingActionIf createClassAction;
- private ToggleDockingAction goToToggleAction;
+ private ToggleDockingAction navigateIncomingAction;
/** A comparator to sort Symbols the same way as the SymbolNode sorts */
// Note: a bit of guilty knowledge: the SymbolNodes will sort first on name, then on
@@ -399,12 +400,12 @@ class SymbolTreeTestUtils {
createNamespaceAction = getAction(plugin, "Create Namespace");
assertNotNull(createNamespaceAction);
- goToToggleAction = (ToggleDockingAction) getAction(plugin, "Navigation");
- assertNotNull(goToToggleAction);
+ navigateIncomingAction = (ToggleDockingAction) getAction(plugin, NavigateOnIncomingAction.NAME);
+ assertNotNull(navigateIncomingAction);
}
void setGoToNavigationSelected(boolean selected) {
- runSwing(() -> goToToggleAction.setSelected(true));
+ runSwing(() -> navigateIncomingAction.setSelected(true));
}
void closeProgram() throws Exception {
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/EmptyBorderToggleButton.java b/Ghidra/Framework/Docking/src/main/java/docking/EmptyBorderToggleButton.java
index d136a32a1b..398ccdbecb 100644
--- a/Ghidra/Framework/Docking/src/main/java/docking/EmptyBorderToggleButton.java
+++ b/Ghidra/Framework/Docking/src/main/java/docking/EmptyBorderToggleButton.java
@@ -4,9 +4,9 @@
* 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.
@@ -150,10 +150,14 @@ public class EmptyBorderToggleButton extends EmptyBorderButton {
}
@Override
- public void setSelected(boolean b) {
+ public void setEnabled(boolean b) {
+ super.setEnabled(b);
+ updateBorder();
+ }
+ @Override
+ public void setSelected(boolean b) {
boolean state = updateStateFromButtonGroup(b);
-
super.setSelected(state);
updateBorder();
}