Skip to content

Ghidra is a software reverse engineering (SRE) framework

Table Service accessibility update

dragonmacher7aa170faf0d9
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/FindPossibleReferencesPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/FindPossibleReferencesPlugin.java
index 34d4af39f7..eb32dbd118 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/FindPossibleReferencesPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/FindPossibleReferencesPlugin.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.
@@ -231,8 +231,8 @@ public class FindPossibleReferencesPlugin extends Plugin {
TableService service = tool.getService(TableService.class);
TableComponentProvider<ReferenceAddressPair> p =
- service.showTable("Find References to" + title, getName(), model, "Possible References",
- context.getNavigatable());
+ service.showTable("Find References to" + title, "Possible References", model,
+ "References", context.getNavigatable());
p.installRemoveItemsAction();
p.setHelpLocation(new HelpLocation(HelpTopics.SEARCH, "Search for Direct References"));
createLocalActions(context, p, model);
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/CodeBrowserSelectionPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/CodeBrowserSelectionPlugin.java
index f9e332dd81..9e5996aa9e 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/CodeBrowserSelectionPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/CodeBrowserSelectionPlugin.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.
@@ -148,7 +148,7 @@ public class CodeBrowserSelectionPlugin extends Plugin {
Icon markerIcon = new GIcon("icon.plugin.codebrowser.cursor.marker");
String title = "Selected Ranges in " + program.getName();
TableComponentProvider<AddressRangeInfo> tableProvider =
- tableService.showTableWithMarkers(title, "Selected Ranges", model,
+ tableService.showTableWithMarkers(title, "Address Ranges", model,
SearchConstants.SEARCH_HIGHLIGHT_COLOR, markerIcon, title, null);
tableProvider.installRemoveItemsAction();
@@ -184,7 +184,7 @@ public class CodeBrowserSelectionPlugin extends Plugin {
String title = "Selection Table";
Icon markerIcon = new GIcon("icon.plugin.codebrowser.cursor.marker");
TableComponentProvider<Address> tableProvider =
- tableService.showTableWithMarkers(title + " " + model.getName(), "Selection", model,
+ tableService.showTableWithMarkers(title + " " + model.getName(), "Selections", model,
SearchConstants.SEARCH_HIGHLIGHT_COLOR, markerIcon, title, null);
tableProvider.installRemoveItemsAction();
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/gotoquery/GoToHelper.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/gotoquery/GoToHelper.java
index 927f6311ea..9bdea6975e 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/gotoquery/GoToHelper.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/gotoquery/GoToHelper.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.
@@ -214,8 +214,8 @@ public class GoToHelper {
AddressArrayTableModel model = new AddressArrayTableModel("Goto: ", tool, program,
externalLinkageAddresses, null);
TableService service = tool.getService(TableService.class);
- service.showTable("Goto " + externalSym.getName(true) + " linkage location", "Goto",
- model, "Go To", nav);
+ service.showTable("Goto " + externalSym.getName(true) + " linkage location",
+ "Go To Results", model, "Go To", nav);
return true;
}
tool.setStatusInfo(
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/instructionsearch/ui/InstructionSearchDialog.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/instructionsearch/ui/InstructionSearchDialog.java
index 2599bcf382..6448d2d3f7 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/instructionsearch/ui/InstructionSearchDialog.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/instructionsearch/ui/InstructionSearchDialog.java
@@ -535,8 +535,9 @@ public class InstructionSearchDialog extends ReusableDialogComponentProvider imp
model.setSelectionSize(matchSize);
TableComponentProvider<Address> tableProvider =
- table.showTableWithMarkers(title + " " + model.getName(), "InstructionSearch",
- model, BG_COLOR_MARKERS, null, "Instruction Search Results", null);
+ table.showTableWithMarkers(title + " " + model.getName(),
+ "Instruction Search Results", model, BG_COLOR_MARKERS, null,
+ "Search", null);
tableProvider.installRemoveItemsAction();
};
SystemUtilities.runSwingLater(runnable);
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/searchtext/SearchTextPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/searchtext/SearchTextPlugin.java
index 2f78643573..6acf86e9f1 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/searchtext/SearchTextPlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/searchtext/SearchTextPlugin.java
@@ -335,13 +335,15 @@ public class SearchTextPlugin extends ProgramPlugin implements OptionsChangeList
private TableComponentProvider<ProgramLocation> getTableResultsProvider(
GhidraProgramTableModel<ProgramLocation> model, Program searchProgram,
TableService query, String matchType, String searchString) {
+ String tableType = "Search Results";
if (navigatable.supportsMarkers()) {
return query.showTableWithMarkers(
- "Search Text - \"" + searchString + "\" [" + matchType + "]", "Search", model,
+ "Search Text - \"" + searchString + "\" [" + matchType + "]", tableType,
+ model,
SearchConstants.SEARCH_HIGHLIGHT_COLOR, SEARCH_MARKER_ICON, "Search", navigatable);
}
return query.showTable("Search Text - \"" + searchString + "\" [" + matchType + "]",
- "Search", model, "Search", navigatable);
+ tableType, model, "Search", navigatable);
}
@Override
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/table/TableComponentProvider.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/table/TableComponentProvider.java
index 8a15d0def3..0bf3c6aad9 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/table/TableComponentProvider.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/table/TableComponentProvider.java
@@ -160,6 +160,13 @@ public class TableComponentProvider<T> extends ComponentProviderAdapter
private void createActions(Plugin plugin) {
GhidraTable table = threadedPanel.getTable();
+
+ // The name of this provider is specified by the clients of the service and it is expected
+ // to be something like 'Search Results'. The title is also from the client and is expected
+ // to be something like 'Search Text "foo"'
+ table.setAccessibleNamePrefix(getName());
+ table.getAccessibleContext().setAccessibleDescription("Provider title: " + getTitle());
+
if (navigatable != null) {
selectAction =
new MakeProgramSelectionAction(navigatable, tableServicePlugin.getName(), table);
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/table/TableServicePlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/table/TableServicePlugin.java
index d01dd76b30..f58bceb15c 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/table/TableServicePlugin.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/table/TableServicePlugin.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.
@@ -183,7 +183,7 @@ public class TableServicePlugin extends ProgramPlugin
}
}
- void removeDialog(MyTableChooserDialog dialog) {
+ void removeDialog(TableServiceTableChooserDialog dialog) {
Iterator<Program> iter = programToDialogMap.keySet().iterator();
while (iter.hasNext()) {
Program p = iter.next();
@@ -247,7 +247,7 @@ public class TableServicePlugin extends ProgramPlugin
Navigatable nav = navigatable;
TableChooserDialog dialog = Swing.runNow(
- () -> new MyTableChooserDialog(this, executor, program, title, nav, isModal));
+ () -> new TableServiceTableChooserDialog(this, executor, program, title, nav, isModal));
List<TableChooserDialog> list =
programToDialogMap.computeIfAbsent(program, p -> new ArrayList<>());
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/table/MyTableChooserDialog.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/table/TableServiceTableChooserDialog.java
similarity index 63%
rename from Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/table/MyTableChooserDialog.java
rename to Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/table/TableServiceTableChooserDialog.java
index 9db3af2b62..44adccd58c 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/table/MyTableChooserDialog.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/table/TableServiceTableChooserDialog.java
@@ -1,13 +1,12 @@
/* ###
* 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.
* 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,21 +20,19 @@ import ghidra.app.tablechooser.TableChooserDialog;
import ghidra.app.tablechooser.TableChooserExecutor;
import ghidra.program.model.listing.Program;
-public class MyTableChooserDialog extends TableChooserDialog {
+public class TableServiceTableChooserDialog extends TableChooserDialog {
private final TableServicePlugin plugin;
- public MyTableChooserDialog(TableServicePlugin plugin, TableChooserExecutor executor,
- Program program, String name, Navigatable navigatable, boolean isModal) {
-
- super(plugin.getTool(), executor, program, name, navigatable, isModal);
+ public TableServiceTableChooserDialog(TableServicePlugin plugin, TableChooserExecutor executor,
+ Program program, String title, Navigatable navigatable, boolean isModal) {
+ super(plugin.getTool(), executor, program, title, navigatable, isModal);
this.plugin = plugin;
}
- public MyTableChooserDialog(TableServicePlugin plugin, TableChooserExecutor executor,
- Program program, String name, Navigatable navigatable) {
-
- this(plugin, executor, program, name, navigatable, false);
+ public TableServiceTableChooserDialog(TableServicePlugin plugin, TableChooserExecutor executor,
+ Program program, String title, Navigatable navigatable) {
+ this(plugin, executor, program, title, navigatable, false);
}
@Override
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/script/GhidraScript.java b/Ghidra/Features/Base/src/main/java/ghidra/app/script/GhidraScript.java
index 2b109d85c3..add559fc85 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/script/GhidraScript.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/script/GhidraScript.java
@@ -3952,7 +3952,7 @@ public abstract class GhidraScript extends FlatProgramAPI {
AddressArrayTableModel model = new AddressArrayTableModel(getScriptName(),
state.getTool(), currentProgram, addresses);
TableComponentProvider<Address> tableProvider =
- table.showTableWithMarkers(title + " " + model.getName(), "GhidraScript", model,
+ table.showTableWithMarkers(title + " " + model.getName(), "Addresses", model,
Palette.GREEN, null, "Script Results", null);
tableProvider.installRemoveItemsAction();
};
@@ -3970,7 +3970,7 @@ public abstract class GhidraScript extends FlatProgramAPI {
AddressSetTableModel model =
new AddressSetTableModel(title, state.getTool(), currentProgram, addresses, null);
TableComponentProvider<Address> tableProvider = table.showTableWithMarkers(title,
- "GhidraScript", model, Palette.GREEN, null, "Script Results", null);
+ "Addresses", model, Palette.GREEN, null, "Script Results", null);
tableProvider.installRemoveItemsAction();
});
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/tablechooser/TableChooserDialog.java b/Ghidra/Features/Base/src/main/java/ghidra/app/tablechooser/TableChooserDialog.java
index 16349141d6..7ae60d069c 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/tablechooser/TableChooserDialog.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/tablechooser/TableChooserDialog.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.
@@ -106,6 +106,9 @@ public class TableChooserDialog extends DialogComponentProvider
TableChooserDialogPanel tablePanel = new TableChooserDialogPanel(model);
table = tablePanel.getTable();
+ table.setAccessibleNamePrefix("Chooser");
+ table.setToolTipText("Table of choices for " + getTitle());
+
GoToService goToService = tool.getService(GoToService.class);
if (goToService != null) {
navigatable = navigatable == null ? goToService.getDefaultNavigatable() : navigatable;
@@ -353,6 +356,10 @@ public class TableChooserDialog extends DialogComponentProvider
setStatusText(message);
}
+ public GhidraTable getTable() {
+ return table;
+ }
+
public int getRowCount() {
return model.getRowCount();
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/navigation/GoToQuery.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/navigation/GoToQuery.java
index 8633016b35..0da0b9e1ca 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/navigation/GoToQuery.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/navigation/GoToQuery.java
@@ -224,7 +224,7 @@ public class GoToQuery {
TableService service = tool.getService(TableService.class);
TableComponentProvider<?> provider = service.showTable(
- "Goto " + queryData.getQueryString(), "Goto", model, "Go To", navigatable);
+ "Goto " + queryData.getQueryString(), "Go To Results", model, "Go To", navigatable);
provider.requestFocus();
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/viewer/field/MnemonicFieldMouseHandler.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/viewer/field/MnemonicFieldMouseHandler.java
index 2385be522b..c29958c661 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/viewer/field/MnemonicFieldMouseHandler.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/viewer/field/MnemonicFieldMouseHandler.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.
@@ -65,7 +65,7 @@ public class MnemonicFieldMouseHandler implements FieldMouseHandlerExtension {
Reference[] refs = codeUnit.getMnemonicReferences();
if (refs.length > 1) {
- List<OutgoingReferenceEndpoint> outgoingReferences = new ArrayList<OutgoingReferenceEndpoint>();
+ List<OutgoingReferenceEndpoint> outgoingReferences = new ArrayList<>();
for (Reference reference : refs) {
outgoingReferences.add(new OutgoingReferenceEndpoint(reference,
ReferenceUtils.isOffcut(codeUnit.getProgram(), reference.getToAddress())));
@@ -78,7 +78,7 @@ public class MnemonicFieldMouseHandler implements FieldMouseHandlerExtension {
TableService service = serviceProvider.getService(TableService.class);
if (service != null) {
Navigatable nav = NavigationUtils.getActiveNavigatable();
- service.showTable("Mnemonic", "Mnemonic", model, "References", nav);
+ service.showTable("Mnemonic References", "Mnemonic", model, "References", nav);
return true;
}
}
diff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/DecompilerFindDialog.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/DecompilerFindDialog.java
index 7936545411..5d0eb9efb2 100644
--- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/DecompilerFindDialog.java
+++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/DecompilerFindDialog.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.
@@ -88,7 +88,7 @@ public class DecompilerFindDialog extends FindDialog {
DecompilerFindResultsModel model = new DecompilerFindResultsModel(tool, program, results);
String title = "Decompiler Search '%s'".formatted(getSearchText());
- String type = "Decompiler Search ";
+ String type = "Decompiler Search Results";
String subMenuName = "Search";
TableComponentProvider<DecompilerSearchLocation> provider =
tableService.showTable(title, type, model, subMenuName, null);
diff --git a/Ghidra/Features/DecompilerDependent/src/main/java/ghidra/app/plugin/core/search/DecompilerTextFinderPlugin.java b/Ghidra/Features/DecompilerDependent/src/main/java/ghidra/app/plugin/core/search/DecompilerTextFinderPlugin.java
index 9fffe608be..45d914165c 100644
--- a/Ghidra/Features/DecompilerDependent/src/main/java/ghidra/app/plugin/core/search/DecompilerTextFinderPlugin.java
+++ b/Ghidra/Features/DecompilerDependent/src/main/java/ghidra/app/plugin/core/search/DecompilerTextFinderPlugin.java
@@ -107,8 +107,6 @@ public class DecompilerTextFinderPlugin extends ProgramPlugin {
String searchText = searchDialog.getSearchText();
boolean isRegex = searchDialog.isRegex();
- String title = "Decompiler Search Text - '" + searchText + "'";
- String tableTypeName = "Decompiler Search";
DecompilerTextFinderTableModel model =
new DecompilerTextFinderTableModel(tool, program, searchText, isRegex);
if (searchDialog.isSearchSelection()) {
@@ -120,6 +118,8 @@ public class DecompilerTextFinderPlugin extends ProgramPlugin {
Color markerColor = SearchConstants.SEARCH_HIGHLIGHT_COLOR;
Icon markerIcon = new GIcon("icon.base.search.marker");
+ String title = "Decompiler Search Text - '" + searchText + "'";
+ String tableTypeName = "Decompiler Search Results";
String windowSubMenu = "Search";
TableService tableService = tool.getService(TableService.class);
TableComponentProvider<TextMatch> provider = tableService.showTableWithMarkers(title,