Merge remote-tracking branch 'origin/GT-2869-dragonmacher-shared-action-keybindings'
|
@ -113,7 +113,6 @@ src/main/help/help/topics/BookmarkPlugin/images/BookmarksFilter.png||GHIDRA||||E
|
|||
src/main/help/help/topics/BookmarkPlugin/images/MarkerForBookmark.png||GHIDRA||||END|
|
||||
src/main/help/help/topics/BookmarkPlugin/images/NextSelectionBlock16.gif||GHIDRA||||END|
|
||||
src/main/help/help/topics/BookmarkPlugin/images/PreviousSelectionBlock16.gif||GHIDRA||||END|
|
||||
src/main/help/help/topics/BookmarkPlugin/images/text_align_justify.png||FAMFAMFAM Icons - CC 2.5|||famfamfam silk icon set|END|
|
||||
src/main/help/help/topics/CParserPlugin/CParser.htm||GHIDRA||||END|
|
||||
src/main/help/help/topics/CParserPlugin/images/ParseCSource.png||GHIDRA||||END|
|
||||
src/main/help/help/topics/CParserPlugin/images/ParseError.png||GHIDRA||||END|
|
||||
|
@ -167,7 +166,6 @@ src/main/help/help/topics/CodeBrowserPlugin/images/hoverOff.gif||GHIDRA||||END|
|
|||
src/main/help/help/topics/CodeBrowserPlugin/images/hoverOn.gif||GHIDRA||||END|
|
||||
src/main/help/help/topics/CommentWindowPlugin/comment_window.htm||GHIDRA||||END|
|
||||
src/main/help/help/topics/CommentWindowPlugin/images/CommentsWindow.png||GHIDRA||||END|
|
||||
src/main/help/help/topics/CommentWindowPlugin/images/text_align_justify.png||FAMFAMFAM Icons - CC 2.5|||famfamfam silk icon set|END|
|
||||
src/main/help/help/topics/CommentsPlugin/Comments.htm||GHIDRA||||END|
|
||||
src/main/help/help/topics/CommentsPlugin/images/Comment.png||GHIDRA||||END|
|
||||
src/main/help/help/topics/CommentsPlugin/images/ShowCommentHistory.png||GHIDRA||||END|
|
||||
|
@ -264,7 +262,6 @@ src/main/help/help/topics/DataTypePreviewPlugin/images/edit-delete.png||Oxygen I
|
|||
src/main/help/help/topics/DataWindowPlugin/data_window.htm||GHIDRA||||END|
|
||||
src/main/help/help/topics/DataWindowPlugin/images/DataWindow.png||GHIDRA||||END|
|
||||
src/main/help/help/topics/DataWindowPlugin/images/DataWindowFilter.png||GHIDRA||||END|
|
||||
src/main/help/help/topics/DataWindowPlugin/images/text_align_justify.png||FAMFAMFAM Icons - CC 2.5|||famfamfam silk icon set|END|
|
||||
src/main/help/help/topics/DbViewerPlugin/DbViewer.htm||GHIDRA||reviewed||END|
|
||||
src/main/help/help/topics/DbViewerPlugin/images/DatabaseViewer.png||GHIDRA||||END|
|
||||
src/main/help/help/topics/DisassembledViewPlugin/DisassembledViewPlugin.htm||GHIDRA||||END|
|
||||
|
@ -404,7 +401,6 @@ src/main/help/help/topics/FunctionTagPlugin/images/InputField.png||GHIDRA||||END
|
|||
src/main/help/help/topics/FunctionWindowPlugin/function_window.htm||GHIDRA||||END|
|
||||
src/main/help/help/topics/FunctionWindowPlugin/images/FunctionWindow.png||GHIDRA||||END|
|
||||
src/main/help/help/topics/FunctionWindowPlugin/images/page_white_c.png||FAMFAMFAM Icons - CC 2.5|||famfamfam silk icon set|END|
|
||||
src/main/help/help/topics/FunctionWindowPlugin/images/text_align_justify.png||FAMFAMFAM Icons - CC 2.5|||famfamfam silk icon set|END|
|
||||
src/main/help/help/topics/GhidraScriptMgrPlugin/GhidraScriptMgrPlugin.htm||GHIDRA||||END|
|
||||
src/main/help/help/topics/GhidraScriptMgrPlugin/ScriptDevelopment.htm||GHIDRA||||END|
|
||||
src/main/help/help/topics/GhidraScriptMgrPlugin/images/Assign_Key_Binding.png||GHIDRA||||END|
|
||||
|
@ -470,7 +466,6 @@ src/main/help/help/topics/LocationReferencesPlugin/images/ReferencesToDialog.png
|
|||
src/main/help/help/topics/LocationReferencesPlugin/images/XRefLabelReferencesSample.png||GHIDRA||||END|
|
||||
src/main/help/help/topics/LocationReferencesPlugin/images/go-home.png||Tango Icons - Public Domain|||Tango|END|
|
||||
src/main/help/help/topics/LocationReferencesPlugin/images/tag_yellow.png||FAMFAMFAM Icons - CC 2.5|||famfamfam silk icon set|END|
|
||||
src/main/help/help/topics/LocationReferencesPlugin/images/text_align_justify.png||FAMFAMFAM Icons - CC 2.5|||famfamfam silk icon set|END|
|
||||
src/main/help/help/topics/MemoryMapPlugin/Memory_Map.htm||GHIDRA||||END|
|
||||
src/main/help/help/topics/MemoryMapPlugin/images/AddMappedBlock.png||GHIDRA||||END|
|
||||
src/main/help/help/topics/MemoryMapPlugin/images/AddMemoryBlock.png||GHIDRA||||END|
|
||||
|
@ -598,7 +593,6 @@ src/main/help/help/topics/ReferencesPlugin/images/erase16.png||GHIDRA||||END|
|
|||
src/main/help/help/topics/ReferencesPlugin/images/go-home.png||Tango Icons - Public Domain|||Tango|END|
|
||||
src/main/help/help/topics/ReferencesPlugin/images/locationIn.gif||GHIDRA||||END|
|
||||
src/main/help/help/topics/ReferencesPlugin/images/locationOut.gif||GHIDRA||||END|
|
||||
src/main/help/help/topics/ReferencesPlugin/images/text_align_justify.png||FAMFAMFAM Icons - CC 2.5|||famfamfam silk icon set|END|
|
||||
src/main/help/help/topics/ReferencesPlugin/images/unchecked.png||GHIDRA||||END|
|
||||
src/main/help/help/topics/RegisterPlugin/Registers.htm||GHIDRA||||END|
|
||||
src/main/help/help/topics/RegisterPlugin/images/ClearRegisterValues.png||GHIDRA||||END|
|
||||
|
@ -609,7 +603,6 @@ src/main/help/help/topics/RegisterPlugin/images/edit-delete.png||Oxygen Icons -
|
|||
src/main/help/help/topics/RegisterPlugin/images/locationIn.gif||GHIDRA||||END|
|
||||
src/main/help/help/topics/RegisterPlugin/images/registerGroup.png||GHIDRA||||END|
|
||||
src/main/help/help/topics/RegisterPlugin/images/registerIcon.png||GHIDRA||||END|
|
||||
src/main/help/help/topics/RegisterPlugin/images/text_align_justify.png||FAMFAMFAM Icons - CC 2.5|||famfamfam silk icon set|END|
|
||||
src/main/help/help/topics/RegisterPlugin/images/view-filter.png||Oxygen Icons - LGPL 3.0|||Oxygen icon theme (dual license; LGPL or CC-SA-3.0)|END|
|
||||
src/main/help/help/topics/RelocationTablePlugin/images/Relocation_Table.png||GHIDRA||||END|
|
||||
src/main/help/help/topics/RelocationTablePlugin/relocation_table.htm||GHIDRA||||END|
|
||||
|
@ -712,7 +705,6 @@ src/main/help/help/topics/Search/images/page_white_copy.png||FAMFAMFAM Icons - C
|
|||
src/main/help/help/topics/Search/images/reload.png||Nuvola Icons - LGPL 2.1||||END|
|
||||
src/main/help/help/topics/Search/images/searchm_obj.gif||GHIDRA||||END|
|
||||
src/main/help/help/topics/Search/images/table_delete.png||FAMFAMFAM Icons - CC 2.5|||famfamfam silk icon set|END|
|
||||
src/main/help/help/topics/Search/images/text_align_justify.png||FAMFAMFAM Icons - CC 2.5|||famfamfam silk icon set|END|
|
||||
src/main/help/help/topics/Search/images/view-filter.png||Oxygen Icons - LGPL 3.0|||Oxygen icon theme (dual license; LGPL or CC-SA-3.0)|END|
|
||||
src/main/help/help/topics/SelectBlockPlugin/Select_Block_Help.html||GHIDRA||||END|
|
||||
src/main/help/help/topics/SelectBlockPlugin/images/Dialog.png||GHIDRA||||END|
|
||||
|
@ -749,7 +741,6 @@ src/main/help/help/topics/SymbolTablePlugin/images/edit-delete.png||Oxygen Icons
|
|||
src/main/help/help/topics/SymbolTablePlugin/images/references_to.gif||GHIDRA||||END|
|
||||
src/main/help/help/topics/SymbolTablePlugin/images/table.png||FAMFAMFAM Icons - CC 2.5|||silk|END|
|
||||
src/main/help/help/topics/SymbolTablePlugin/images/table_go.png||FAMFAMFAM Icons - CC 2.5|||famfamfam silk icon set|END|
|
||||
src/main/help/help/topics/SymbolTablePlugin/images/text_align_justify.png||FAMFAMFAM Icons - CC 2.5|||famfamfam silk icon set|END|
|
||||
src/main/help/help/topics/SymbolTablePlugin/images/view-filter.png||Oxygen Icons - LGPL 3.0|||Oxygen icon theme (dual license; LGPL or CC-SA-3.0)|END|
|
||||
src/main/help/help/topics/SymbolTablePlugin/symbol_references.htm||GHIDRA||||END|
|
||||
src/main/help/help/topics/SymbolTablePlugin/symbol_table.htm||GHIDRA||||END|
|
||||
|
@ -830,7 +821,6 @@ src/main/help/help/topics/VersionControl/images/vcUndoCheckOut.png||GHIDRA||||EN
|
|||
src/main/help/help/topics/VersionControl/project_repository.htm||GHIDRA||||END|
|
||||
src/main/help/help/topics/ViewStringsPlugin/ViewStringsPlugin.htm||GHIDRA||||END|
|
||||
src/main/help/help/topics/ViewStringsPlugin/images/Defined_String_Table.png||GHIDRA||||END|
|
||||
src/main/help/help/topics/ViewStringsPlugin/images/text_align_justify.png||FAMFAMFAM Icons - CC 2.5|||famfamfam silk icon set|END|
|
||||
src/main/java/ghidra/app/cmd/comments/package.html||GHIDRA||reviewed||END|
|
||||
src/main/java/ghidra/app/cmd/data/package.html||GHIDRA||||END|
|
||||
src/main/java/ghidra/app/cmd/disassemble/package.html||GHIDRA||||END|
|
||||
|
@ -1162,7 +1152,6 @@ src/main/resources/images/table_delete.png||FAMFAMFAM Icons - CC 2.5|||famfamfam
|
|||
src/main/resources/images/table_go.png||FAMFAMFAM Icons - CC 2.5|||famfamfam silk icon set|END|
|
||||
src/main/resources/images/table_row_delete.png||FAMFAMFAM Icons - CC 2.5|||silk|END|
|
||||
src/main/resources/images/tag_yellow.png||FAMFAMFAM Icons - CC 2.5|||famfamfam silk icon set|END|
|
||||
src/main/resources/images/text_align_justify.png||FAMFAMFAM Icons - CC 2.5|||famfamfam silk icon set|END|
|
||||
src/main/resources/images/text_list_bullets.png||FAMFAMFAM Icons - CC 2.5|||famfamfam silk icon set|END|
|
||||
src/main/resources/images/text_lowercase.png||FAMFAMFAM Icons - CC 2.5|||famfamfam silk icon set|END|
|
||||
src/main/resources/images/textfield.png||FAMFAMFAM Icons - CC 2.5|||famfamfam silk icon set|END|
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.io.*;
|
|||
import java.util.*;
|
||||
|
||||
import docking.action.DockingActionIf;
|
||||
import docking.actions.KeyBindingUtils;
|
||||
import ghidra.app.script.GhidraScript;
|
||||
import ghidra.framework.plugintool.Plugin;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
|
@ -30,9 +31,9 @@ public class CreateHelpTemplateScript extends GhidraScript {
|
|||
@Override
|
||||
protected void run() throws Exception {
|
||||
PluginTool tool = state.getTool();
|
||||
Plugin[] plugins = getSortedPlugins(tool);
|
||||
List<Plugin> plugins = getSortedPlugins(tool);
|
||||
Plugin selectedPlugin =
|
||||
askChoice("Select Plugin To Use To Generate Help", "Plugin", plugins, plugins[0]);
|
||||
askChoice("Select Plugin To Use To Generate Help", "Plugin", plugins, plugins.get(0));
|
||||
if (selectedPlugin == null) {
|
||||
printerr("no plugin selected, no help template created.");
|
||||
return;
|
||||
|
@ -101,7 +102,8 @@ public class CreateHelpTemplateScript extends GhidraScript {
|
|||
}
|
||||
|
||||
private List<DockingActionIf> getActions(PluginTool tool, Plugin plugin) {
|
||||
List<DockingActionIf> actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
Set<DockingActionIf> actions = KeyBindingUtils.getKeyBindingActionsForOwner(tool, plugin.getName());
|
||||
List<DockingActionIf> list = new ArrayList<>(actions);
|
||||
Comparator<DockingActionIf> comparator = (action1, action2) -> {
|
||||
try {
|
||||
return action1.getName().compareTo(action2.getName());
|
||||
|
@ -110,14 +112,12 @@ public class CreateHelpTemplateScript extends GhidraScript {
|
|||
return 0;
|
||||
}
|
||||
};
|
||||
Collections.sort(actions, comparator);
|
||||
return actions;
|
||||
Collections.sort(list, comparator);
|
||||
return list;
|
||||
}
|
||||
|
||||
private Plugin[] getSortedPlugins(PluginTool tool) {
|
||||
private List<Plugin> getSortedPlugins(PluginTool tool) {
|
||||
List<Plugin> list = tool.getManagedPlugins();
|
||||
Plugin[] plugins = new Plugin[list.size()];
|
||||
list.toArray(plugins);
|
||||
Comparator<Plugin> comparator = (plugin1, plugin2) -> {
|
||||
try {
|
||||
return plugin1.getName().compareTo(plugin2.getName());
|
||||
|
@ -126,8 +126,9 @@ public class CreateHelpTemplateScript extends GhidraScript {
|
|||
return 0;
|
||||
}
|
||||
};
|
||||
Arrays.sort(plugins, comparator);
|
||||
return plugins;
|
||||
|
||||
Collections.sort(list, comparator);
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -305,7 +305,7 @@
|
|||
<OL>
|
||||
<LI>Select one or more rows in the Bookmarks table.</LI>
|
||||
|
||||
<LI>Click the Select Bookmark Locations <IMG src="images/text_align_justify.png" alt="">
|
||||
<LI>Click the Select Bookmark Locations <IMG src="Icons.MAKE_SELECTION_ICON" alt="">
|
||||
button in the local toolbar.</LI>
|
||||
|
||||
<LI>The corresponding addresses are selected in the browser.</LI>
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
"help/topics/Selection/Selecting.htm">select</A> all of the code units in the Code Browser
|
||||
display corresponding to the selected rows in the table. Since the table allows for
|
||||
multiple selections, any number of comment items may be selected. To make the selection, either
|
||||
click on <IMG src="images/text_align_justify.png">, or right mouse click in the table and choose
|
||||
click on <IMG src="Icons.MAKE_SELECTION_ICON">, or right mouse click in the table and choose
|
||||
<B>Make Selection</B>.</P>
|
||||
</BLOCKQUOTE>
|
||||
|
||||
|
|
Before Width: | Height: | Size: 209 B |
|
@ -36,13 +36,13 @@
|
|||
<H3><A name="Make_Selection"></A>Make Selection</H3>
|
||||
|
||||
<BLOCKQUOTE>
|
||||
<P><IMG src="images/text_align_justify.png"></P>
|
||||
<P><IMG src="Icons.MAKE_SELECTION_ICON"></P>
|
||||
|
||||
<P>The data window's tool bar has a button that will <A href=
|
||||
"help/topics/Selection/Selecting.htm">select</A> all of the code units in the Code Browser
|
||||
display corresponding to the selected rows in the table. Since the table allows for
|
||||
multiple selections, any number of data items may be selected. To make the selection, either
|
||||
click on <IMG src="images/text_align_justify.png">, or right mouse click in the table and choose
|
||||
click on <IMG src="Icons.MAKE_SELECTION_ICON">, or right mouse click in the table and choose
|
||||
<B>Make Selection</B>.</P>
|
||||
</BLOCKQUOTE>
|
||||
|
||||
|
|
Before Width: | Height: | Size: 209 B |
|
@ -30,12 +30,12 @@ function's signature. Click on the top of a column to sort the list by that col
|
|||
|
||||
<h3><a name="Make_Selection"></a>Make Selection</h3>
|
||||
<blockquote>
|
||||
<p>The Functions window has an icon (<img src="images/text_align_justify.png">)
|
||||
<p>The Functions window has an icon (<img src="Icons.MAKE_SELECTION_ICON">)
|
||||
on the tool bar to make a selection in the Code Browser. To make a selection,</p>
|
||||
<ol>
|
||||
<li> Select the functions in the <b>Functions</b> window.</li>
|
||||
<li>Right mouse click and select the <img src="images/text_align_justify.png"> <b>Make
|
||||
Selection</b> option, OR select the <img src="images/text_align_justify.png">button on
|
||||
<li>Right mouse click and select the <img src="Icons.MAKE_SELECTION_ICON"> <b>Make
|
||||
Selection</b> option, OR select the <img src="Icons.MAKE_SELECTION_ICON">button on
|
||||
the tool bar.</li>
|
||||
</ol>
|
||||
</blockquote>
|
||||
|
|
Before Width: | Height: | Size: 209 B |
|
@ -121,7 +121,7 @@
|
|||
become color filled, as it is here. You may push the button for a refresh in either
|
||||
state.</P>
|
||||
|
||||
<P align="left"><A name="Select"></A>The <IMG alt="" src="images/text_align_justify.png"> button
|
||||
<P align="left"><A name="Select"></A>The <IMG alt="" src="Icons.MAKE_SELECTION_ICON"> button
|
||||
will create a selection in the code browser with the reference entries selected in the
|
||||
table. You may also access this feature by right-clicking an item in the table and
|
||||
selecting <B>Make Selection</B>.</P>
|
||||
|
|
Before Width: | Height: | Size: 209 B |
|
@ -924,7 +924,7 @@
|
|||
single reference row is selected.<BR>
|
||||
</P>
|
||||
|
||||
<P><A name="Select_Destinations"></A><IMG src="images/text_align_justify.png" alt=""> <I><B>Select
|
||||
<P><A name="Select_Destinations"></A><IMG src="Icons.MAKE_SELECTION_ICON" alt=""> <I><B>Select
|
||||
Memory Reference Destination</B></I> - With one or more memory references selected in the
|
||||
table, invoking this action will cause the corresponding locations within the <A href=
|
||||
"help/topics/CodeBrowserPlugin/CodeBrowser.htm">Listing</A> to become selected.<BR>
|
||||
|
|
Before Width: | Height: | Size: 209 B |
|
@ -85,7 +85,7 @@
|
|||
<P><IMG src="images/edit-delete.png">Deletes the register value associations for all the
|
||||
selected ranges in the table.</P>
|
||||
|
||||
<P><IMG src="images/text_align_justify.png">Creates a selection in the browser for all the address
|
||||
<P><IMG src="Icons.MAKE_SELECTION_ICON">Creates a selection in the browser for all the address
|
||||
ranges selected in the register values table.</P>
|
||||
|
||||
<P><IMG src="images/view-filter.png">Filters out all registers in the register tree that
|
||||
|
|
Before Width: | Height: | Size: 209 B |
|
@ -129,7 +129,7 @@
|
|||
|
||||
<BLOCKQUOTE>
|
||||
<H3><A NAME="Make_Selection"></A>Make Selection
|
||||
<IMG border="0" src="images/text_align_justify.png"></H3>
|
||||
<IMG border="0" src="Icons.MAKE_SELECTION_ICON"></H3>
|
||||
|
||||
<BLOCKQUOTE>
|
||||
<P>
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
were found.</P>
|
||||
</BLOCKQUOTE>
|
||||
|
||||
<H3><A name="Make_Selection"></A>Make Selection <IMG border="0" src="images/text_align_justify.png"></H3>
|
||||
<H3><A name="Make_Selection"></A>Make Selection <IMG border="0" src="Icons.MAKE_SELECTION_ICON"></H3>
|
||||
|
||||
<BLOCKQUOTE>
|
||||
<P>A selection in the Listing can be created from the entries in the results table.
|
||||
|
@ -79,7 +79,7 @@
|
|||
<OL>
|
||||
<LI>Click in the results table and press <TT><B>Ctrl+A</B></TT>.</LI>
|
||||
|
||||
<LI>Click on the <IMG border="0" src="images/text_align_justify.png" > in
|
||||
<LI>Click on the <IMG border="0" src="Icons.MAKE_SELECTION_ICON" > in
|
||||
the tool bar, or right mouse click and choose <B>Make Selection</B>.</LI>
|
||||
|
||||
<LI>The current selection will be set to the address of each result item.</LI>
|
||||
|
@ -93,7 +93,7 @@
|
|||
|
||||
<LI>Press and hold the right mouse button over the results table.</LI>
|
||||
|
||||
<LI>Click on the <IMG border="0" src="images/text_align_justify.png" > in
|
||||
<LI>Click on the <IMG border="0" src="Icons.MAKE_SELECTION_ICON" > in
|
||||
the tool bar, or right mouse click and choose <B>Make Selection</B>.</LI>
|
||||
|
||||
<LI>The current selection will be set to the address of all the highlighted items.</LI>
|
||||
|
|
|
@ -145,7 +145,7 @@
|
|||
|
||||
|
||||
<BLOCKQUOTE>
|
||||
<H3></A>Make Selection <IMG border="0" src="images/text_align_justify.png"></H3>
|
||||
<H3></A>Make Selection <IMG border="0" src="Icons.MAKE_SELECTION_ICON"></H3>
|
||||
|
||||
<BLOCKQUOTE>
|
||||
<P>
|
||||
|
|
|
@ -133,7 +133,7 @@
|
|||
|
||||
|
||||
<BLOCKQUOTE>
|
||||
<H3></A>Make Selection <IMG border="0" src="images/text_align_justify.png"></H3>
|
||||
<H3></A>Make Selection <IMG border="0" src="Icons.MAKE_SELECTION_ICON"></H3>
|
||||
|
||||
<BLOCKQUOTE>
|
||||
<P>
|
||||
|
|
|
@ -206,7 +206,7 @@
|
|||
results.</P>
|
||||
</BLOCKQUOTE>
|
||||
|
||||
<H3>Make Selection <IMG alt="" border="0" src="images/text_align_justify.png"></H3>
|
||||
<H3>Make Selection <IMG alt="" border="0" src="Icons.MAKE_SELECTION_ICON"></H3>
|
||||
|
||||
<BLOCKQUOTE>
|
||||
<P><I>See <A href="help/topics/Search/Query_Results_Dialog.htm#Make_Selection">Make
|
||||
|
|
Before Width: | Height: | Size: 209 B |
Before Width: | Height: | Size: 209 B |
|
@ -189,7 +189,7 @@
|
|||
for more discussion on the use of the edit dialog).
|
||||
</BLOCKQUOTE>
|
||||
|
||||
<H2><A name="Make_Selection"></A>Making a Selection <IMG src="images/text_align_justify.png"></H2>
|
||||
<H2><A name="Make_Selection"></A>Making a Selection <IMG src="Icons.MAKE_SELECTION_ICON"></H2>
|
||||
|
||||
<BLOCKQUOTE>
|
||||
<P>You can make a selection that corresponds to the symbol addresses that are selected in the
|
||||
|
@ -205,7 +205,7 @@
|
|||
Right-mouse-click and select "Make Selection" from the popup menu.
|
||||
|
||||
<UL>
|
||||
<LI>Or, click the <IMG src="images/text_align_justify.png"> button in the <I>Symbol
|
||||
<LI>Or, click the <IMG src="Icons.MAKE_SELECTION_ICON"> button in the <I>Symbol
|
||||
Table</I> toolbar.</LI>
|
||||
</UL>
|
||||
</LI>
|
||||
|
|
|
@ -53,12 +53,12 @@
|
|||
<blockquote>
|
||||
<h3><a name="Make_Selection"></a>Make Selection</h3>
|
||||
<blockquote>
|
||||
<p>The Defined Strings window has an icon (<img src="images/text_align_justify.png">)
|
||||
<p>The Defined Strings window has an icon (<img src="Icons.MAKE_SELECTION_ICON">)
|
||||
on the tool bar to make a selection in the Code Browser. To make a selection,</p>
|
||||
<ol>
|
||||
<li> Select the rows containing the desired strings in the table.</li>
|
||||
<li>Right mouse click and select the <img src="images/text_align_justify.png"> <b>Make
|
||||
Selection</b> option, OR select the <img src="images/text_align_justify.png">button on
|
||||
<li>Right mouse click and select the <img src="Icons.MAKE_SELECTION_ICON"> <b>Make
|
||||
Selection</b> option, OR select the <img src="Icons.MAKE_SELECTION_ICON">button on
|
||||
the tool bar.</li>
|
||||
</ol>
|
||||
</blockquote>
|
||||
|
|
Before Width: | Height: | Size: 209 B |
|
@ -22,6 +22,8 @@ import javax.swing.KeyStroke;
|
|||
|
||||
import docking.ActionContext;
|
||||
import docking.DockingUtils;
|
||||
import docking.action.DockingAction;
|
||||
import docking.action.KeyBindingData;
|
||||
import ghidra.app.plugin.core.navigation.FindAppliedDataTypesService;
|
||||
import ghidra.app.plugin.core.navigation.locationreferences.ReferenceUtils;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
|
@ -29,11 +31,12 @@ import ghidra.program.model.data.Composite;
|
|||
import ghidra.program.model.data.DataType;
|
||||
import ghidra.util.*;
|
||||
|
||||
public abstract class AbstractFindReferencesDataTypeAction extends AbstractSharedKeybindingAction {
|
||||
public abstract class AbstractFindReferencesDataTypeAction extends DockingAction {
|
||||
|
||||
public static final String NAME = "Find References To";
|
||||
public static final KeyStroke DEFAULT_KEY_STROKE = KeyStroke.getKeyStroke(KeyEvent.VK_F,
|
||||
DockingUtils.CONTROL_KEY_MODIFIER_MASK | InputEvent.SHIFT_DOWN_MASK);
|
||||
private PluginTool tool;
|
||||
|
||||
protected AbstractFindReferencesDataTypeAction(PluginTool tool, String name, String owner) {
|
||||
this(tool, name, owner, null);
|
||||
|
@ -41,10 +44,13 @@ public abstract class AbstractFindReferencesDataTypeAction extends AbstractShare
|
|||
|
||||
protected AbstractFindReferencesDataTypeAction(PluginTool tool, String name, String owner,
|
||||
KeyStroke defaultKeyStroke) {
|
||||
super(tool, name, owner, defaultKeyStroke);
|
||||
super(name, owner);
|
||||
this.tool = tool;
|
||||
|
||||
setHelpLocation(new HelpLocation("LocationReferencesPlugin", "Data_Types"));
|
||||
setDescription("Shows all uses of the selected data type");
|
||||
|
||||
initKeyStroke(defaultKeyStroke);
|
||||
}
|
||||
|
||||
protected abstract DataType getDataType(ActionContext context);
|
||||
|
@ -55,6 +61,19 @@ public abstract class AbstractFindReferencesDataTypeAction extends AbstractShare
|
|||
return null;
|
||||
}
|
||||
|
||||
private void initKeyStroke(KeyStroke keyStroke) {
|
||||
if (keyStroke == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
setKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean usesSharedKeyBinding() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabledForContext(ActionContext context) {
|
||||
DataType dataType = getDataType(context);
|
||||
|
@ -80,17 +99,15 @@ public abstract class AbstractFindReferencesDataTypeAction extends AbstractShare
|
|||
if (field != null && !(baseDataType instanceof Composite)) {
|
||||
Msg.error(this, "Somehow have a field without a Composite parent--searching " +
|
||||
"only for the parent type '" + dataType + "'; field '" + field + "'");
|
||||
SystemUtilities.runSwingLater(
|
||||
() -> service.findAndDisplayAppliedDataTypeAddresses(dataType));
|
||||
Swing.runLater(() -> service.findAndDisplayAppliedDataTypeAddresses(dataType));
|
||||
return;
|
||||
}
|
||||
|
||||
if (field == null) {
|
||||
SystemUtilities.runSwingLater(
|
||||
() -> service.findAndDisplayAppliedDataTypeAddresses(dataType));
|
||||
Swing.runLater(() -> service.findAndDisplayAppliedDataTypeAddresses(dataType));
|
||||
}
|
||||
else {
|
||||
SystemUtilities.runSwingLater(() -> service.findAndDisplayAppliedDataTypeAddresses(
|
||||
Swing.runLater(() -> service.findAndDisplayAppliedDataTypeAddresses(
|
||||
(Composite) baseDataType, field));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,83 +0,0 @@
|
|||
/* ###
|
||||
* 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.actions;
|
||||
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import docking.action.DockingAction;
|
||||
import docking.action.KeyBindingData;
|
||||
import ghidra.framework.options.*;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.framework.plugintool.util.ToolConstants;
|
||||
|
||||
/**
|
||||
* An action that can be extended in order to share keybindings.
|
||||
* <p>
|
||||
* Any group of actions that wish to share a keybinding must all use the same <tt>name</tt> and
|
||||
* default <tt>keystroke</tt> value.
|
||||
* <p>
|
||||
* As the end-user assigns keybindings, each subclass will update accordingly.
|
||||
*
|
||||
* @see DummyKeyBindingsOptionsAction
|
||||
*/
|
||||
public abstract class AbstractSharedKeybindingAction extends DockingAction
|
||||
implements OptionsChangeListener {
|
||||
|
||||
protected PluginTool tool;
|
||||
|
||||
protected AbstractSharedKeybindingAction(PluginTool tool, String name, String owner,
|
||||
KeyStroke defaultkeyStroke) {
|
||||
|
||||
super(name, owner, false /* not keybinding managed--the dummy handles that */);
|
||||
this.tool = tool;
|
||||
|
||||
DockingAction action = new DummyKeyBindingsOptionsAction(name, defaultkeyStroke);
|
||||
tool.addAction(action);
|
||||
|
||||
// setup options to know when the dummy key binding is changed
|
||||
ToolOptions options = tool.getOptions(ToolConstants.KEY_BINDINGS);
|
||||
KeyStroke optionsKeyStroke = options.getKeyStroke(action.getFullName(), defaultkeyStroke);
|
||||
|
||||
if (defaultkeyStroke != null) {
|
||||
if (!defaultkeyStroke.equals(optionsKeyStroke)) {
|
||||
// user-defined keystroke
|
||||
setUnvalidatedKeyBindingData(new KeyBindingData(optionsKeyStroke));
|
||||
}
|
||||
else {
|
||||
setKeyBindingData(new KeyBindingData(optionsKeyStroke));
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (optionsKeyStroke != null) {
|
||||
// user-defined keystroke
|
||||
setUnvalidatedKeyBindingData(new KeyBindingData(optionsKeyStroke));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
options.addOptionsChangeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void optionsChanged(ToolOptions options, String name, Object oldValue, Object newValue) {
|
||||
KeyStroke keyStroke = (KeyStroke) newValue;
|
||||
String actionName = getName();
|
||||
if (name.startsWith(actionName)) {
|
||||
setUnvalidatedKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -834,12 +834,6 @@ public class CallTreeProvider extends ComponentProviderAdapter implements Domain
|
|||
currentProgram = null;
|
||||
}
|
||||
|
||||
tool.removeLocalAction(this, recurseDepthAction);
|
||||
tool.removeLocalAction(this, refreshAction);
|
||||
tool.removeLocalAction(this, filterDuplicates);
|
||||
tool.removeLocalAction(this, navigationOutgoingAction);
|
||||
tool.removeLocalAction(this, navigateIncomingToggleAction);
|
||||
|
||||
recurseDepthAction.dispose();
|
||||
refreshAction.dispose();
|
||||
filterDuplicates.dispose();
|
||||
|
|
|
@ -15,28 +15,24 @@
|
|||
*/
|
||||
package ghidra.app.plugin.core.commentwindow;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import docking.ActionContext;
|
||||
import docking.action.*;
|
||||
import docking.action.DockingAction;
|
||||
import ghidra.app.CorePluginPackage;
|
||||
import ghidra.app.events.ProgramSelectionPluginEvent;
|
||||
import ghidra.app.plugin.PluginCategoryNames;
|
||||
import ghidra.app.plugin.ProgramPlugin;
|
||||
import ghidra.app.services.GoToService;
|
||||
import ghidra.framework.model.*;
|
||||
import ghidra.framework.options.*;
|
||||
import ghidra.framework.plugintool.*;
|
||||
import ghidra.framework.plugintool.util.*;
|
||||
import ghidra.framework.plugintool.PluginInfo;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.framework.plugintool.util.PluginStatus;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.model.listing.CodeUnit;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.program.util.*;
|
||||
import ghidra.util.table.GhidraTable;
|
||||
import ghidra.util.table.SelectionNavigationAction;
|
||||
import ghidra.util.table.actions.MakeProgramSelectionAction;
|
||||
import ghidra.util.task.SwingUpdateManager;
|
||||
import resources.ResourceManager;
|
||||
|
||||
/*
|
||||
* This plugin shows a filterable Ghidra table containing all the comments in the active program
|
||||
|
@ -53,8 +49,7 @@ import resources.ResourceManager;
|
|||
servicesRequired = { GoToService.class }
|
||||
)
|
||||
//@formatter:on
|
||||
public class CommentWindowPlugin extends ProgramPlugin
|
||||
implements DomainObjectListener, OptionsChangeListener {
|
||||
public class CommentWindowPlugin extends ProgramPlugin implements DomainObjectListener {
|
||||
|
||||
private DockingAction selectAction;
|
||||
private CommentWindowProvider provider;
|
||||
|
@ -63,12 +58,7 @@ public class CommentWindowPlugin extends ProgramPlugin
|
|||
public CommentWindowPlugin(PluginTool tool) {
|
||||
super(tool, true, true);
|
||||
|
||||
reloadUpdateMgr = new SwingUpdateManager(1000, 60000, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
doReload();
|
||||
}
|
||||
});
|
||||
reloadUpdateMgr = new SwingUpdateManager(1000, 60000, () -> doReload());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -89,12 +79,6 @@ public class CommentWindowPlugin extends ProgramPlugin
|
|||
super.dispose();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Implementation of DomainObjectListener
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private int getCommentType(int type) {
|
||||
if (type == ChangeManager.DOCR_PRE_COMMENT_CHANGED) {
|
||||
return CodeUnit.PRE_COMMENT;
|
||||
|
@ -169,9 +153,7 @@ public class CommentWindowPlugin extends ProgramPlugin
|
|||
provider.getComponent().repaint();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void reload() {
|
||||
|
@ -198,39 +180,18 @@ public class CommentWindowPlugin extends ProgramPlugin
|
|||
return currentProgram;
|
||||
}
|
||||
|
||||
// Junit access
|
||||
CommentWindowProvider getProvider() {
|
||||
return provider;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the action objects for this plugin.
|
||||
*/
|
||||
private void createActions() {
|
||||
|
||||
selectAction = new DockingAction("Make Selection", getName(), false) {
|
||||
selectAction = new MakeProgramSelectionAction(getName(), provider.getTable()) {
|
||||
@Override
|
||||
public void actionPerformed(ActionContext context) {
|
||||
protected void makeSelection(ActionContext context) {
|
||||
selectComment(provider.selectComment());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabledForContext(ActionContext context) {
|
||||
if (!(context instanceof CommentWindowContext)) {
|
||||
return false;
|
||||
}
|
||||
CommentWindowContext commentWindowContext = (CommentWindowContext) context;
|
||||
GhidraTable table = commentWindowContext.getCommentTable();
|
||||
return table.getSelectedRows().length > 0;
|
||||
}
|
||||
};
|
||||
selectAction.setEnabled(false);
|
||||
ImageIcon icon = ResourceManager.loadImage("images/text_align_justify.png");
|
||||
selectAction.setPopupMenuData(new MenuData(new String[] { "Make Selection" }, icon));
|
||||
selectAction.setDescription("Selects currently selected comment in table");
|
||||
selectAction.setToolBarData(new ToolBarData(icon));
|
||||
|
||||
installDummyAction(selectAction);
|
||||
|
||||
tool.addLocalAction(provider, selectAction);
|
||||
|
||||
|
@ -238,34 +199,10 @@ public class CommentWindowPlugin extends ProgramPlugin
|
|||
tool.addLocalAction(provider, selectionAction);
|
||||
}
|
||||
|
||||
private void installDummyAction(DockingAction action) {
|
||||
DummyKeyBindingsOptionsAction dummyAction =
|
||||
new DummyKeyBindingsOptionsAction(action.getName(), null);
|
||||
tool.addAction(dummyAction);
|
||||
|
||||
ToolOptions options = tool.getOptions(ToolConstants.KEY_BINDINGS);
|
||||
options.addOptionsChangeListener(this);
|
||||
|
||||
KeyStroke keyStroke = options.getKeyStroke(dummyAction.getFullName(), null);
|
||||
if (keyStroke != null) {
|
||||
action.setUnvalidatedKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void optionsChanged(ToolOptions options, String optionName, Object oldValue,
|
||||
Object newValue) {
|
||||
if (optionName.startsWith(selectAction.getName())) {
|
||||
KeyStroke keyStroke = (KeyStroke) newValue;
|
||||
selectAction.setUnvalidatedKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
}
|
||||
|
||||
void selectComment(ProgramSelection selection) {
|
||||
private void selectComment(ProgramSelection selection) {
|
||||
ProgramSelectionPluginEvent pspe =
|
||||
new ProgramSelectionPluginEvent("Selection", selection, currentProgram);
|
||||
firePluginEvent(pspe);
|
||||
processEvent(pspe);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,9 +21,7 @@ import java.awt.datatransfer.Transferable;
|
|||
import java.awt.dnd.*;
|
||||
import java.awt.event.*;
|
||||
import java.math.BigInteger;
|
||||
import java.util.Arrays;
|
||||
import java.util.EventObject;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.Border;
|
||||
|
@ -33,10 +31,10 @@ import javax.swing.table.*;
|
|||
import javax.swing.text.JTextComponent;
|
||||
|
||||
import docking.action.DockingActionIf;
|
||||
import docking.actions.KeyBindingUtils;
|
||||
import docking.dnd.*;
|
||||
import docking.help.Help;
|
||||
import docking.help.HelpService;
|
||||
import docking.util.KeyBindingUtils;
|
||||
import docking.widgets.DropDownSelectionTextField;
|
||||
import docking.widgets.OptionDialog;
|
||||
import docking.widgets.fieldpanel.support.FieldRange;
|
||||
|
@ -1519,17 +1517,18 @@ public abstract class CompositeEditorPanel extends JPanel
|
|||
@Override
|
||||
public boolean isKeyConsumed(KeyStroke keyStroke) {
|
||||
if (isEditing()) {
|
||||
// don't let actions through when editing our table
|
||||
return true;
|
||||
}
|
||||
|
||||
// don't let actions through when editing our table
|
||||
// TODO this should no longer be needed
|
||||
return !hasLocalActionForKeyStroke(keyStroke);
|
||||
}
|
||||
|
||||
private boolean hasLocalActionForKeyStroke(KeyStroke keyStroke) {
|
||||
Plugin plugin = provider.getPlugin();
|
||||
PluginTool tool = plugin.getTool();
|
||||
List<DockingActionIf> actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
Set<DockingActionIf> actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
for (DockingActionIf action : actions) {
|
||||
if (!(action instanceof CompositeEditorTableAction)) {
|
||||
continue;
|
||||
|
|
|
@ -206,11 +206,6 @@ public abstract class CompositeEditorProvider extends ComponentProviderAdapter
|
|||
|
||||
@Override
|
||||
public void dispose() {
|
||||
CompositeEditorTableAction[] allActions = actionMgr.getAllActions();
|
||||
for (CompositeEditorTableAction allAction : allActions) {
|
||||
tool.removeLocalAction(this, allAction);
|
||||
}
|
||||
tool.showComponentProvider(this, false);
|
||||
tool.removeComponentProvider(this);
|
||||
for (EditorListener el : listeners) {
|
||||
el.closed(this);
|
||||
|
|
|
@ -18,56 +18,39 @@ package ghidra.app.plugin.core.compositeeditor;
|
|||
import javax.swing.KeyStroke;
|
||||
|
||||
import docking.ActionContext;
|
||||
import docking.action.DockingAction;
|
||||
import docking.action.KeyBindingData;
|
||||
import ghidra.framework.options.*;
|
||||
import ghidra.framework.plugintool.util.ToolConstants;
|
||||
import ghidra.program.model.data.CycleGroup;
|
||||
|
||||
/**
|
||||
* Action to apply a data type cycle group.
|
||||
* For use in the composite data type editor.
|
||||
* This action has help associated with it.
|
||||
* Action to apply a data type cycle group. For use in the composite data type editor.
|
||||
*/
|
||||
public class CycleGroupAction extends CompositeEditorTableAction implements OptionsChangeListener {
|
||||
public class CycleGroupAction extends CompositeEditorTableAction {
|
||||
|
||||
private final static String GROUP_NAME = CYCLE_ACTION_GROUP;
|
||||
private CycleGroup cycleGroup;
|
||||
|
||||
/**
|
||||
* Creates an action for applying a data type cycle group.
|
||||
* @param owner the plugin that owns this action
|
||||
* @param cycleGroup the data type cycle group
|
||||
*/
|
||||
public CycleGroupAction(CompositeEditorProvider provider, CycleGroup cycleGroup) {
|
||||
super(provider, cycleGroup.getName(), GROUP_NAME,
|
||||
new String[] { "Cycle", cycleGroup.getName() },
|
||||
new String[] { "Cycle", cycleGroup.getName() }, null);
|
||||
this.cycleGroup = cycleGroup;
|
||||
|
||||
// register an action that allows users to edit keystrokes
|
||||
DockingAction action = new DummyKeyBindingsOptionsAction(cycleGroup.getName(),
|
||||
cycleGroup.getDefaultKeyStroke());
|
||||
tool.addAction(action);
|
||||
ToolOptions options = tool.getOptions(ToolConstants.KEY_BINDINGS);
|
||||
KeyStroke defaultKeyStroke = cycleGroup.getDefaultKeyStroke();
|
||||
KeyStroke keyStroke = options.getKeyStroke(action.getFullName(), defaultKeyStroke);
|
||||
options.addOptionsChangeListener(this);
|
||||
|
||||
if (!defaultKeyStroke.equals(keyStroke)) {
|
||||
// user-defined keystroke
|
||||
setUnvalidatedKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
else {
|
||||
setKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
|
||||
adjustEnablement();
|
||||
initKeyStroke(cycleGroup.getDefaultKeyStroke());
|
||||
}
|
||||
|
||||
private void initKeyStroke(KeyStroke keyStroke) {
|
||||
if (keyStroke == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
setKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean usesSharedKeyBinding() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the data type cycle group for this action.
|
||||
*/
|
||||
public CycleGroup getCycleGroup() {
|
||||
return cycleGroup;
|
||||
}
|
||||
|
@ -87,12 +70,4 @@ public class CycleGroupAction extends CompositeEditorTableAction implements Opti
|
|||
public String getHelpName() {
|
||||
return "Cycle";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void optionsChanged(ToolOptions options, String name, Object oldValue, Object newValue) {
|
||||
KeyStroke keyStroke = (KeyStroke) newValue;
|
||||
if (name.startsWith(cycleGroup.getName())) {
|
||||
setUnvalidatedKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
/* ###
|
||||
* 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.
|
||||
|
@ -16,11 +15,16 @@
|
|||
*/
|
||||
package ghidra.app.plugin.core.data;
|
||||
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import docking.ActionContext;
|
||||
import docking.action.DockingAction;
|
||||
import docking.action.KeyBindingData;
|
||||
import ghidra.app.context.ListingActionContext;
|
||||
import ghidra.app.util.datatype.DataTypeSelectionDialog;
|
||||
import ghidra.framework.options.*;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.framework.plugintool.util.ToolConstants;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.model.address.AddressRange;
|
||||
import ghidra.program.model.data.*;
|
||||
|
@ -29,18 +33,10 @@ import ghidra.program.util.*;
|
|||
import ghidra.util.SystemUtilities;
|
||||
import ghidra.util.data.DataTypeParser.AllowedDataTypes;
|
||||
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import docking.ActionContext;
|
||||
import docking.action.DockingAction;
|
||||
import docking.action.KeyBindingData;
|
||||
|
||||
/**
|
||||
* An action that allows the user to change or select a data type.
|
||||
*/
|
||||
public class ChooseDataTypeAction extends DockingAction implements OptionsChangeListener {
|
||||
public class ChooseDataTypeAction extends DockingAction {
|
||||
|
||||
private DataPlugin plugin;
|
||||
private static final KeyStroke KEY_BINDING = KeyStroke.getKeyStroke(KeyEvent.VK_T, 0);
|
||||
|
@ -48,34 +44,22 @@ public class ChooseDataTypeAction extends DockingAction implements OptionsChange
|
|||
|
||||
public ChooseDataTypeAction(DataPlugin plugin) {
|
||||
super(ACTION_NAME, plugin.getName(), false);
|
||||
|
||||
this.plugin = plugin;
|
||||
|
||||
PluginTool tool = plugin.getTool();
|
||||
DockingAction action = new DummyKeyBindingsOptionsAction(ACTION_NAME, KEY_BINDING);
|
||||
tool.addAction(action);
|
||||
initKeyStroke(KEY_BINDING);
|
||||
}
|
||||
|
||||
// setup options to know when the dummy key binding is changed
|
||||
ToolOptions options = tool.getOptions(ToolConstants.KEY_BINDINGS);
|
||||
KeyStroke keyStroke = options.getKeyStroke(action.getFullName(), KEY_BINDING);
|
||||
|
||||
if (!KEY_BINDING.equals(keyStroke)) {
|
||||
// user-defined keystroke
|
||||
setUnvalidatedKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
else {
|
||||
setKeyBindingData(new KeyBindingData(keyStroke));
|
||||
private void initKeyStroke(KeyStroke keyStroke) {
|
||||
if (keyStroke == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
options.addOptionsChangeListener(this);
|
||||
setKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void optionsChanged(ToolOptions options, String name, Object oldValue, Object newValue) {
|
||||
KeyStroke keyStroke = (KeyStroke) newValue;
|
||||
if (name.startsWith(ACTION_NAME)) {
|
||||
setUnvalidatedKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
public boolean usesSharedKeyBinding() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -191,9 +175,8 @@ public class ChooseDataTypeAction extends DockingAction implements OptionsChange
|
|||
int defaultPointerSize) {
|
||||
PluginTool tool = plugin.getTool();
|
||||
Data data = plugin.getDataUnit(context);
|
||||
DataTypeSelectionDialog selectionDialog =
|
||||
new DataTypeSelectionDialog(tool, data.getProgram().getDataTypeManager(), maxElements,
|
||||
AllowedDataTypes.ALL);
|
||||
DataTypeSelectionDialog selectionDialog = new DataTypeSelectionDialog(tool,
|
||||
data.getProgram().getDataTypeManager(), maxElements, AllowedDataTypes.ALL);
|
||||
DataType currentDataType = data.getBaseDataType();
|
||||
selectionDialog.setInitialDataType(currentDataType);
|
||||
tool.showDialog(selectionDialog);
|
||||
|
|
|
@ -27,16 +27,14 @@ import ghidra.app.cmd.data.CreateArrayCmd;
|
|||
import ghidra.app.cmd.data.CreateArrayInStructureCmd;
|
||||
import ghidra.app.context.ListingActionContext;
|
||||
import ghidra.framework.cmd.Command;
|
||||
import ghidra.framework.options.*;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.framework.plugintool.util.ToolConstants;
|
||||
import ghidra.program.model.address.*;
|
||||
import ghidra.program.model.data.*;
|
||||
import ghidra.program.model.listing.*;
|
||||
import ghidra.program.model.mem.MemoryBlock;
|
||||
import ghidra.program.util.*;
|
||||
|
||||
class CreateArrayAction extends DockingAction implements OptionsChangeListener {
|
||||
class CreateArrayAction extends DockingAction {
|
||||
|
||||
private static final KeyStroke DEFAULT_KEY_STROKE =
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_OPEN_BRACKET, 0);
|
||||
|
@ -51,26 +49,21 @@ class CreateArrayAction extends DockingAction implements OptionsChangeListener {
|
|||
|
||||
setPopupMenuData(new MenuData(CREATE_ARRAY_POPUP_MENU, "BasicData"));
|
||||
setEnabled(true);
|
||||
initializeKeybinding();
|
||||
|
||||
initKeyStroke(DEFAULT_KEY_STROKE);
|
||||
}
|
||||
|
||||
private void initializeKeybinding() {
|
||||
PluginTool tool = plugin.getTool();
|
||||
DockingAction dummyKeybindingsAction =
|
||||
new DummyKeyBindingsOptionsAction(getName(), DEFAULT_KEY_STROKE);
|
||||
tool.addAction(dummyKeybindingsAction);
|
||||
ToolOptions options = tool.getOptions(ToolConstants.KEY_BINDINGS);
|
||||
options.addOptionsChangeListener(this);
|
||||
KeyStroke keyStroke =
|
||||
options.getKeyStroke(dummyKeybindingsAction.getFullName(), DEFAULT_KEY_STROKE);
|
||||
private void initKeyStroke(KeyStroke keyStroke) {
|
||||
if (keyStroke == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!DEFAULT_KEY_STROKE.equals(keyStroke)) {
|
||||
// user-defined keystroke
|
||||
setUnvalidatedKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
else {
|
||||
setKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
setKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean usesSharedKeyBinding() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -342,12 +335,4 @@ class CreateArrayAction extends DockingAction implements OptionsChangeListener {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void optionsChanged(ToolOptions options, String optionName, Object oldValue,
|
||||
Object newValue) {
|
||||
KeyStroke keyStroke = (KeyStroke) newValue;
|
||||
if (optionName.startsWith(getName())) {
|
||||
setUnvalidatedKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,13 +18,11 @@ package ghidra.app.plugin.core.data;
|
|||
import javax.swing.KeyStroke;
|
||||
|
||||
import docking.ActionContext;
|
||||
import docking.action.*;
|
||||
import docking.action.DockingAction;
|
||||
import docking.action.KeyBindingData;
|
||||
import ghidra.app.cmd.data.*;
|
||||
import ghidra.app.context.ListingActionContext;
|
||||
import ghidra.framework.cmd.BackgroundCommand;
|
||||
import ghidra.framework.options.*;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.framework.plugintool.util.ToolConstants;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.model.data.CycleGroup;
|
||||
import ghidra.program.model.data.DataType;
|
||||
|
@ -37,48 +35,32 @@ import ghidra.util.Msg;
|
|||
* <code>CycleGroupAction</code> cycles data through a series of data types
|
||||
* defined by a <code>CycleGroup</code>.
|
||||
*/
|
||||
public class CycleGroupAction extends DockingAction implements OptionsChangeListener {
|
||||
public class CycleGroupAction extends DockingAction {
|
||||
|
||||
private DataPlugin plugin;
|
||||
private CycleGroup cycleGroup;
|
||||
|
||||
/**
|
||||
* Creates a new instance of the action.
|
||||
*
|
||||
* @param plugin Data Plugin instance
|
||||
*/
|
||||
CycleGroupAction(CycleGroup group, DataPlugin plugin) {
|
||||
super(group.getName(), plugin.getName(), false);
|
||||
this.plugin = plugin;
|
||||
this.cycleGroup = group;
|
||||
|
||||
// register an action that allows users to edit keystrokes
|
||||
PluginTool tool = plugin.getTool();
|
||||
DockingAction action = new DummyKeyBindingsOptionsAction(cycleGroup.getName(),
|
||||
cycleGroup.getDefaultKeyStroke());
|
||||
tool.addAction(action);
|
||||
ToolOptions options = tool.getOptions(ToolConstants.KEY_BINDINGS);
|
||||
KeyStroke defaultKeyStroke = cycleGroup.getDefaultKeyStroke();
|
||||
KeyStroke keyStroke = options.getKeyStroke(action.getFullName(), defaultKeyStroke);
|
||||
options.addOptionsChangeListener(this);
|
||||
|
||||
setPopupMenuData(
|
||||
new MenuData(new String[] { "Data", "Cycle", group.getName() }, null, null));
|
||||
|
||||
if (!defaultKeyStroke.equals(keyStroke)) {
|
||||
// user-defined keystroke
|
||||
setUnvalidatedKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
else {
|
||||
setKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
|
||||
setEnabled(true);
|
||||
initKeyStroke(cycleGroup.getDefaultKeyStroke());
|
||||
}
|
||||
|
||||
private void initKeyStroke(KeyStroke keyStroke) {
|
||||
if (keyStroke == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
setKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean usesSharedKeyBinding() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.framework.plugintool.DockingAction#dispose()
|
||||
*/
|
||||
@Override
|
||||
public void dispose() {
|
||||
cycleGroup = null;
|
||||
|
@ -86,9 +68,6 @@ public class CycleGroupAction extends DockingAction implements OptionsChangeList
|
|||
super.dispose();
|
||||
}
|
||||
|
||||
/*
|
||||
* @see docking.DockableAction#isValidContext(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean isEnabledForContext(ActionContext context) {
|
||||
Object contextObject = context.getContextObject();
|
||||
|
@ -192,12 +171,4 @@ public class CycleGroupAction extends DockingAction implements OptionsChangeList
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void optionsChanged(ToolOptions options, String name, Object oldValue, Object newValue) {
|
||||
KeyStroke keyStroke = (KeyStroke) newValue;
|
||||
if (name.startsWith(cycleGroup.getName())) {
|
||||
setUnvalidatedKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,51 +17,46 @@ package ghidra.app.plugin.core.data;
|
|||
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import docking.action.*;
|
||||
import docking.tool.util.DockingToolConstants;
|
||||
import docking.action.KeyBindingData;
|
||||
import docking.action.MenuData;
|
||||
import ghidra.app.context.ListingActionContext;
|
||||
import ghidra.app.context.ListingContextAction;
|
||||
import ghidra.framework.options.*;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.program.model.data.*;
|
||||
import ghidra.util.HelpLocation;
|
||||
|
||||
/**
|
||||
* Base class for actions to create data types
|
||||
*/
|
||||
class DataAction extends ListingContextAction implements OptionsChangeListener {
|
||||
class DataAction extends ListingContextAction {
|
||||
|
||||
protected DataType dataType;
|
||||
protected DataPlugin plugin;
|
||||
private String actionName;
|
||||
private DummyKeyBindingsOptionsAction dummyKeybindingsAction;
|
||||
|
||||
public DataAction(DataType dataType, DataPlugin plugin) {
|
||||
this("Define " + dataType.getDisplayName(), "Data", dataType, plugin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param name action name
|
||||
* @param group the action's group
|
||||
* @param dataType the data type used by this action
|
||||
* @param plugin the plugin that owns this action
|
||||
*/
|
||||
public DataAction(String name, String group, DataType dataType, DataPlugin plugin) {
|
||||
super(name, plugin.getName(), false);
|
||||
this.actionName = name;
|
||||
this.plugin = plugin;
|
||||
this.dataType = dataType;
|
||||
|
||||
setPopupMenuData(new MenuData(new String[] { "Data", dataType.getDisplayName() }, group));
|
||||
assignHelpID(dataType);
|
||||
|
||||
initializeKeybinding();
|
||||
initKeyStroke(getDefaultKeyStroke());
|
||||
}
|
||||
|
||||
private void initializeKeybinding() {
|
||||
PluginTool tool = plugin.getTool();
|
||||
dummyKeybindingsAction =
|
||||
new DummyKeyBindingsOptionsAction(actionName, getDefaultKeyStroke());
|
||||
tool.addAction(dummyKeybindingsAction);
|
||||
ToolOptions options = tool.getOptions(DockingToolConstants.KEY_BINDINGS);
|
||||
options.addOptionsChangeListener(this);
|
||||
KeyStroke keyStroke =
|
||||
options.getKeyStroke(dummyKeybindingsAction.getFullName(), getDefaultKeyStroke());
|
||||
initKeyStroke(keyStroke);
|
||||
@Override
|
||||
public boolean usesSharedKeyBinding() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected KeyStroke getDefaultKeyStroke() {
|
||||
|
@ -73,12 +68,11 @@ class DataAction extends ListingContextAction implements OptionsChangeListener {
|
|||
return;
|
||||
}
|
||||
|
||||
// we don't have a default keybinding, so any value implies user-defined
|
||||
setUnvalidatedKeyBindingData(new KeyBindingData(keyStroke));
|
||||
setKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
|
||||
protected DockingAction getDummyKeyBindingAction() {
|
||||
return dummyKeybindingsAction;
|
||||
DataType getDataType() {
|
||||
return dataType;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -99,19 +93,6 @@ class DataAction extends ListingContextAction implements OptionsChangeListener {
|
|||
return plugin.isCreateDataAllowed(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void optionsChanged(ToolOptions options, String optionName, Object oldValue,
|
||||
Object newValue) {
|
||||
KeyStroke keyStroke = (KeyStroke) newValue;
|
||||
if (optionName.startsWith(actionName)) {
|
||||
setUnvalidatedKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
}
|
||||
|
||||
DataType getDataType() {
|
||||
return dataType;
|
||||
}
|
||||
|
||||
// Set the help ID according to the data type
|
||||
private void assignHelpID(DataType dt) {
|
||||
String helpID = "Favorites";
|
||||
|
|
|
@ -15,13 +15,9 @@
|
|||
*/
|
||||
package ghidra.app.plugin.core.datamgr.actions;
|
||||
|
||||
import java.awt.event.InputEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
import javax.swing.tree.TreePath;
|
||||
|
||||
import docking.ActionContext;
|
||||
import docking.action.KeyBindingData;
|
||||
import docking.action.MenuData;
|
||||
import docking.widgets.tree.GTree;
|
||||
import docking.widgets.tree.GTreeNode;
|
||||
|
@ -38,8 +34,6 @@ public class FindReferencesToDataTypeAction extends AbstractFindReferencesDataTy
|
|||
|
||||
String menuGroup = "ZVeryLast"; // it's own group; on the bottom
|
||||
setPopupMenuData(new MenuData(new String[] { "Find Uses of" }, null, menuGroup));
|
||||
setKeyBindingData(new KeyBindingData(KeyEvent.VK_F,
|
||||
InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -18,11 +18,8 @@ package ghidra.app.plugin.core.datawindow;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import docking.ActionContext;
|
||||
import docking.action.*;
|
||||
import docking.action.DockingAction;
|
||||
import ghidra.app.CorePluginPackage;
|
||||
import ghidra.app.events.ProgramSelectionPluginEvent;
|
||||
import ghidra.app.events.ViewChangedPluginEvent;
|
||||
|
@ -31,10 +28,9 @@ import ghidra.app.plugin.ProgramPlugin;
|
|||
import ghidra.app.services.GoToService;
|
||||
import ghidra.app.services.ProgramTreeService;
|
||||
import ghidra.framework.model.*;
|
||||
import ghidra.framework.options.*;
|
||||
import ghidra.framework.options.SaveState;
|
||||
import ghidra.framework.plugintool.*;
|
||||
import ghidra.framework.plugintool.util.PluginStatus;
|
||||
import ghidra.framework.plugintool.util.ToolConstants;
|
||||
import ghidra.program.model.address.AddressRangeIterator;
|
||||
import ghidra.program.model.address.AddressSet;
|
||||
import ghidra.program.model.data.DataType;
|
||||
|
@ -42,10 +38,9 @@ import ghidra.program.model.data.DataTypeManager;
|
|||
import ghidra.program.model.listing.Data;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.program.util.*;
|
||||
import ghidra.util.table.GhidraTable;
|
||||
import ghidra.util.table.SelectionNavigationAction;
|
||||
import ghidra.util.table.actions.MakeProgramSelectionAction;
|
||||
import ghidra.util.task.SwingUpdateManager;
|
||||
import resources.ResourceManager;
|
||||
|
||||
//@formatter:off
|
||||
@PluginInfo(
|
||||
|
@ -60,10 +55,7 @@ import resources.ResourceManager;
|
|||
eventsConsumed = { ViewChangedPluginEvent.class }
|
||||
)
|
||||
//@formatter:on
|
||||
public class DataWindowPlugin extends ProgramPlugin
|
||||
implements DomainObjectListener, OptionsChangeListener {
|
||||
|
||||
// private final static String[] DISPLAY_MENU_PATH = { ToolConstants.MENU_VIEW, "Defined Data..." };
|
||||
public class DataWindowPlugin extends ProgramPlugin implements DomainObjectListener {
|
||||
|
||||
private DockingAction selectAction;
|
||||
private FilterAction filterAction;
|
||||
|
@ -73,24 +65,12 @@ public class DataWindowPlugin extends ProgramPlugin
|
|||
private SwingUpdateManager reloadUpdateMgr;
|
||||
private boolean resetTypesNeeded;
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
public DataWindowPlugin(PluginTool tool) {
|
||||
super(tool, true, true);
|
||||
|
||||
resetUpdateMgr = new SwingUpdateManager(100, 60000, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
doReset();
|
||||
}
|
||||
});
|
||||
resetUpdateMgr = new SwingUpdateManager(100, 60000, () -> doReset());
|
||||
|
||||
reloadUpdateMgr = new SwingUpdateManager(100, 60000, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
doReload();
|
||||
}
|
||||
});
|
||||
reloadUpdateMgr = new SwingUpdateManager(100, 60000, () -> doReload());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -112,12 +92,6 @@ public class DataWindowPlugin extends ProgramPlugin
|
|||
super.dispose();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Implementation of DomainObjectListener
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void domainObjectChanged(DomainObjectChangedEvent ev) {
|
||||
if (ev.containsEvent(DomainObject.DO_OBJECT_RESTORED)) {
|
||||
|
@ -153,8 +127,6 @@ public class DataWindowPlugin extends ProgramPlugin
|
|||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void reload() {
|
||||
reloadUpdateMgr.update();
|
||||
}
|
||||
|
@ -163,9 +135,6 @@ public class DataWindowPlugin extends ProgramPlugin
|
|||
provider.reload();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ghidra.framework.plugintool.Plugin#processEvent(ghidra.framework.plugintool.PluginEvent)
|
||||
*/
|
||||
@Override
|
||||
public void processEvent(PluginEvent event) {
|
||||
if (event instanceof ViewChangedPluginEvent) {
|
||||
|
@ -193,8 +162,6 @@ public class DataWindowPlugin extends ProgramPlugin
|
|||
filterAction.programClosed();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Program getProgram() {
|
||||
return currentProgram;
|
||||
}
|
||||
|
@ -208,36 +175,17 @@ public class DataWindowPlugin extends ProgramPlugin
|
|||
return provider;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Create the action objects for this plugin.
|
||||
*/
|
||||
private void createActions() {
|
||||
|
||||
selectAction = new DockingAction("Make Selection", getName(), false) {
|
||||
selectAction = new MakeProgramSelectionAction(getName(), provider.getTable()) {
|
||||
@Override
|
||||
public void actionPerformed(ActionContext context) {
|
||||
protected void makeSelection(ActionContext context) {
|
||||
selectData(provider.selectData());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabledForContext(ActionContext context) {
|
||||
if (!(context instanceof DataWindowContext)) {
|
||||
return false;
|
||||
}
|
||||
DataWindowContext dataWindowContext = (DataWindowContext) context;
|
||||
GhidraTable table = dataWindowContext.getDataTable();
|
||||
return table.getSelectedRows().length > 0;
|
||||
}
|
||||
};
|
||||
selectAction.setEnabled(false);
|
||||
ImageIcon icon = ResourceManager.loadImage("images/text_align_justify.png");
|
||||
selectAction.setPopupMenuData(new MenuData(new String[] { "Make Selection" }, icon));
|
||||
selectAction.setDescription("Selects currently selected data in table");
|
||||
selectAction.setToolBarData(new ToolBarData(icon));
|
||||
|
||||
installDummyAction(selectAction);
|
||||
|
||||
tool.addLocalAction(provider, selectAction);
|
||||
|
||||
|
@ -249,28 +197,6 @@ public class DataWindowPlugin extends ProgramPlugin
|
|||
tool.addLocalAction(provider, selectionAction);
|
||||
}
|
||||
|
||||
private void installDummyAction(DockingAction action) {
|
||||
DummyKeyBindingsOptionsAction dummyAction =
|
||||
new DummyKeyBindingsOptionsAction(action.getName(), null);
|
||||
tool.addAction(dummyAction);
|
||||
|
||||
ToolOptions options = tool.getOptions(ToolConstants.KEY_BINDINGS);
|
||||
options.addOptionsChangeListener(this);
|
||||
|
||||
KeyStroke keyStroke = options.getKeyStroke(dummyAction.getFullName(), null);
|
||||
if (keyStroke != null) {
|
||||
action.setUnvalidatedKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void optionsChanged(ToolOptions options, String optionName, Object oldValue, Object newValue) {
|
||||
if (optionName.startsWith(selectAction.getName())) {
|
||||
KeyStroke keyStroke = (KeyStroke) newValue;
|
||||
selectAction.setUnvalidatedKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
}
|
||||
|
||||
void selectData(ProgramSelection selection) {
|
||||
ProgramSelectionPluginEvent pspe =
|
||||
new ProgramSelectionPluginEvent("Selection", selection, currentProgram);
|
||||
|
|
|
@ -32,8 +32,8 @@ import javax.swing.undo.UndoableEdit;
|
|||
import docking.ActionContext;
|
||||
import docking.ComponentProvider;
|
||||
import docking.action.*;
|
||||
import docking.actions.KeyBindingUtils;
|
||||
import docking.options.editor.FontPropertyEditor;
|
||||
import docking.util.KeyBindingUtils;
|
||||
import docking.widgets.OptionDialog;
|
||||
import docking.widgets.filechooser.GhidraFileChooser;
|
||||
import ghidra.framework.options.SaveState;
|
||||
|
|
|
@ -23,9 +23,7 @@ import docking.ActionContext;
|
|||
import docking.action.*;
|
||||
import ghidra.app.context.ListingActionContext;
|
||||
import ghidra.app.util.datatype.DataTypeSelectionDialog;
|
||||
import ghidra.framework.options.*;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.framework.plugintool.util.ToolConstants;
|
||||
import ghidra.program.model.data.DataType;
|
||||
import ghidra.program.model.data.DataTypeManager;
|
||||
import ghidra.program.model.listing.*;
|
||||
|
@ -36,7 +34,7 @@ import ghidra.util.data.DataTypeParser.AllowedDataTypes;
|
|||
/**
|
||||
* An action that allows the user to change or select a data type.
|
||||
*/
|
||||
public class ChooseDataTypeAction extends DockingAction implements OptionsChangeListener {
|
||||
public class ChooseDataTypeAction extends DockingAction {
|
||||
private static final KeyStroke KEY_BINDING = KeyStroke.getKeyStroke(KeyEvent.VK_T, 0);
|
||||
private final static String ACTION_NAME = "Choose Data Type";
|
||||
|
||||
|
@ -44,37 +42,24 @@ public class ChooseDataTypeAction extends DockingAction implements OptionsChange
|
|||
|
||||
public ChooseDataTypeAction(FunctionPlugin plugin) {
|
||||
super(ACTION_NAME, plugin.getName(), false);
|
||||
|
||||
this.plugin = plugin;
|
||||
|
||||
// setup key binding management
|
||||
PluginTool tool = plugin.getTool();
|
||||
DockingAction action = new DummyKeyBindingsOptionsAction(ACTION_NAME, KEY_BINDING);
|
||||
tool.addAction(action);
|
||||
|
||||
// setup options to know when the dummy key binding is changed
|
||||
ToolOptions options = tool.getOptions(ToolConstants.KEY_BINDINGS);
|
||||
KeyStroke keyStroke = options.getKeyStroke(action.getFullName(), KEY_BINDING);
|
||||
setPopupMenu(plugin.getDataActionMenuName(null), true);
|
||||
|
||||
if (!KEY_BINDING.equals(keyStroke)) {
|
||||
// user-defined keystroke
|
||||
setUnvalidatedKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
else {
|
||||
setKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
|
||||
options.addOptionsChangeListener(this);
|
||||
setHelpLocation(new HelpLocation("DataTypeEditors", "DataTypeSelectionDialog"));
|
||||
|
||||
initKeyStroke(KEY_BINDING);
|
||||
}
|
||||
|
||||
private void initKeyStroke(KeyStroke keyStroke) {
|
||||
if (keyStroke == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
setKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void optionsChanged(ToolOptions options, String name, Object oldValue, Object newValue) {
|
||||
KeyStroke keyStroke = (KeyStroke) newValue;
|
||||
if (name.startsWith(ACTION_NAME)) {
|
||||
setUnvalidatedKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
public boolean usesSharedKeyBinding() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -19,20 +19,18 @@ import java.awt.event.KeyEvent;
|
|||
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import docking.action.*;
|
||||
import docking.action.KeyBindingData;
|
||||
import docking.action.MenuData;
|
||||
import docking.widgets.dialogs.NumberInputDialog;
|
||||
import ghidra.app.context.ListingActionContext;
|
||||
import ghidra.app.context.ListingContextAction;
|
||||
import ghidra.framework.options.*;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.framework.plugintool.util.ToolConstants;
|
||||
import ghidra.program.model.data.*;
|
||||
import ghidra.program.model.listing.Function;
|
||||
import ghidra.program.model.listing.Variable;
|
||||
import ghidra.program.util.*;
|
||||
import ghidra.util.HelpLocation;
|
||||
|
||||
class CreateArrayAction extends ListingContextAction implements OptionsChangeListener {
|
||||
class CreateArrayAction extends ListingContextAction {
|
||||
|
||||
private static final KeyStroke DEFAULT_KEY_STROKE =
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_OPEN_BRACKET, 0);
|
||||
|
@ -44,26 +42,21 @@ class CreateArrayAction extends ListingContextAction implements OptionsChangeLis
|
|||
|
||||
setPopupMenu(plugin.getDataActionMenuName(null));
|
||||
setHelpLocation(new HelpLocation(plugin.getName(), "DataType"));
|
||||
initializeKeybinding();
|
||||
|
||||
initKeyStroke(DEFAULT_KEY_STROKE);
|
||||
}
|
||||
|
||||
private void initializeKeybinding() {
|
||||
PluginTool tool = plugin.getTool();
|
||||
DockingAction dummyKeybindingsAction =
|
||||
new DummyKeyBindingsOptionsAction(getName(), DEFAULT_KEY_STROKE);
|
||||
tool.addAction(dummyKeybindingsAction);
|
||||
ToolOptions options = tool.getOptions(ToolConstants.KEY_BINDINGS);
|
||||
options.addOptionsChangeListener(this);
|
||||
KeyStroke keyStroke =
|
||||
options.getKeyStroke(dummyKeybindingsAction.getFullName(), DEFAULT_KEY_STROKE);
|
||||
private void initKeyStroke(KeyStroke keyStroke) {
|
||||
if (keyStroke == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!DEFAULT_KEY_STROKE.equals(keyStroke)) {
|
||||
// user-defined keystroke
|
||||
setUnvalidatedKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
else {
|
||||
setKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
setKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean usesSharedKeyBinding() {
|
||||
return true;
|
||||
}
|
||||
|
||||
private void setPopupMenu(String name) {
|
||||
|
@ -141,13 +134,4 @@ class CreateArrayAction extends ListingContextAction implements OptionsChangeLis
|
|||
|
||||
return dialog.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void optionsChanged(ToolOptions options, String optionName, Object oldValue,
|
||||
Object newValue) {
|
||||
KeyStroke keyStroke = (KeyStroke) newValue;
|
||||
if (optionName.startsWith(getName())) {
|
||||
setUnvalidatedKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,13 +17,11 @@ package ghidra.app.plugin.core.function;
|
|||
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import docking.action.*;
|
||||
import docking.action.KeyBindingData;
|
||||
import docking.action.MenuData;
|
||||
import ghidra.app.context.ListingActionContext;
|
||||
import ghidra.app.context.ListingContextAction;
|
||||
import ghidra.app.util.HelpTopics;
|
||||
import ghidra.framework.options.*;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.framework.plugintool.util.ToolConstants;
|
||||
import ghidra.program.model.data.CycleGroup;
|
||||
import ghidra.program.model.data.DataType;
|
||||
import ghidra.program.util.ProgramLocation;
|
||||
|
@ -34,42 +32,33 @@ import ghidra.util.HelpLocation;
|
|||
* <code>CycleGroupAction</code> cycles data through a series
|
||||
* of data types defined by a <code>CycleGroup</code>.
|
||||
*/
|
||||
public class CycleGroupAction extends ListingContextAction implements OptionsChangeListener {
|
||||
public class CycleGroupAction extends ListingContextAction {
|
||||
|
||||
private FunctionPlugin plugin;
|
||||
private CycleGroup cycleGroup;
|
||||
|
||||
/**
|
||||
* Creates a new instance of the action.
|
||||
*
|
||||
* @param plugin Data Plugin instance
|
||||
*/
|
||||
CycleGroupAction(CycleGroup group, FunctionPlugin plugin) {
|
||||
super(group.getName(), plugin.getName(), false);
|
||||
this.plugin = plugin;
|
||||
this.cycleGroup = group;
|
||||
|
||||
setPopupMenu(plugin.getDataActionMenuName(null), true);
|
||||
|
||||
// register an action that allows users to edit keystrokes
|
||||
PluginTool tool = plugin.getTool();
|
||||
DockingAction action = new DummyKeyBindingsOptionsAction(cycleGroup.getName(),
|
||||
cycleGroup.getDefaultKeyStroke());
|
||||
tool.addAction(action);
|
||||
ToolOptions options = tool.getOptions(ToolConstants.KEY_BINDINGS);
|
||||
KeyStroke defaultKeyStroke = cycleGroup.getDefaultKeyStroke();
|
||||
KeyStroke keyStroke = options.getKeyStroke(action.getFullName(), defaultKeyStroke);
|
||||
|
||||
if (!defaultKeyStroke.equals(keyStroke)) {
|
||||
// user-defined keystroke
|
||||
setUnvalidatedKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
else {
|
||||
setKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
|
||||
options.addOptionsChangeListener(this);
|
||||
|
||||
setHelpLocation(new HelpLocation(HelpTopics.DATA, group.getName()));
|
||||
|
||||
initKeyStroke(cycleGroup.getDefaultKeyStroke());
|
||||
}
|
||||
|
||||
private void initKeyStroke(KeyStroke keyStroke) {
|
||||
if (keyStroke == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
setKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean usesSharedKeyBinding() {
|
||||
return true;
|
||||
}
|
||||
|
||||
private void setPopupMenu(String name, boolean isSignatureAction) {
|
||||
|
@ -95,9 +84,6 @@ public class CycleGroupAction extends ListingContextAction implements OptionsCha
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ghidra.framework.plugintool.DockingAction#dispose()
|
||||
*/
|
||||
@Override
|
||||
public void dispose() {
|
||||
cycleGroup = null;
|
||||
|
@ -115,12 +101,4 @@ public class CycleGroupAction extends ListingContextAction implements OptionsCha
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void optionsChanged(ToolOptions options, String name, Object oldValue, Object newValue) {
|
||||
KeyStroke keyStroke = (KeyStroke) newValue;
|
||||
if (name.startsWith(cycleGroup.getName())) {
|
||||
setUnvalidatedKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,12 +17,10 @@ package ghidra.app.plugin.core.function;
|
|||
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import docking.action.*;
|
||||
import docking.tool.util.DockingToolConstants;
|
||||
import docking.action.KeyBindingData;
|
||||
import docking.action.MenuData;
|
||||
import ghidra.app.context.ListingActionContext;
|
||||
import ghidra.app.context.ListingContextAction;
|
||||
import ghidra.framework.options.*;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.program.model.data.DataType;
|
||||
import ghidra.program.util.ProgramLocation;
|
||||
import ghidra.program.util.VariableLocation;
|
||||
|
@ -31,13 +29,11 @@ import ghidra.util.HelpLocation;
|
|||
/**
|
||||
* Base class for actions to create data types
|
||||
*/
|
||||
class DataAction extends ListingContextAction implements OptionsChangeListener {
|
||||
class DataAction extends ListingContextAction {
|
||||
|
||||
private final String group;
|
||||
protected DataType dataType;
|
||||
protected FunctionPlugin plugin;
|
||||
private String actionName;
|
||||
private DummyKeyBindingsOptionsAction dummyKeybindingsAction;
|
||||
|
||||
public DataAction(DataType dataType, FunctionPlugin plugin) {
|
||||
this("Define " + dataType.getDisplayName(), "Function", dataType, plugin);
|
||||
|
@ -46,26 +42,19 @@ class DataAction extends ListingContextAction implements OptionsChangeListener {
|
|||
|
||||
public DataAction(String name, String group, DataType dataType, FunctionPlugin plugin) {
|
||||
super(name, plugin.getName(), false);
|
||||
this.actionName = name;
|
||||
this.group = group;
|
||||
this.plugin = plugin;
|
||||
this.dataType = dataType;
|
||||
|
||||
setPopupMenu(plugin.getDataActionMenuName(null), true);
|
||||
setHelpLocation(new HelpLocation(plugin.getName(), "DataType"));
|
||||
initializeKeybinding();
|
||||
|
||||
initKeyStroke(getDefaultKeyStroke());
|
||||
}
|
||||
|
||||
private void initializeKeybinding() {
|
||||
PluginTool tool = plugin.getTool();
|
||||
dummyKeybindingsAction =
|
||||
new DummyKeyBindingsOptionsAction(actionName, getDefaultKeyStroke());
|
||||
tool.addAction(dummyKeybindingsAction);
|
||||
ToolOptions options = tool.getOptions(DockingToolConstants.KEY_BINDINGS);
|
||||
options.addOptionsChangeListener(this);
|
||||
KeyStroke keyStroke =
|
||||
options.getKeyStroke(dummyKeybindingsAction.getFullName(), getDefaultKeyStroke());
|
||||
initKeyStroke(keyStroke);
|
||||
@Override
|
||||
public boolean usesSharedKeyBinding() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected KeyStroke getDefaultKeyStroke() {
|
||||
|
@ -77,12 +66,7 @@ class DataAction extends ListingContextAction implements OptionsChangeListener {
|
|||
return;
|
||||
}
|
||||
|
||||
// we don't have a default keybinding, so any value implies user-defined
|
||||
setUnvalidatedKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
|
||||
protected DockingAction getDummyKeyBindingAction() {
|
||||
return dummyKeybindingsAction;
|
||||
setKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
|
||||
void setPopupMenu(String name, boolean isSignatureAction) {
|
||||
|
@ -98,11 +82,6 @@ class DataAction extends ListingContextAction implements OptionsChangeListener {
|
|||
super.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ListingActionContext context) {
|
||||
plugin.createData(dataType, context, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isEnabledForContext(ListingActionContext context) {
|
||||
if (context.hasSelection() || context.getAddress() == null) {
|
||||
|
@ -121,11 +100,7 @@ class DataAction extends ListingContextAction implements OptionsChangeListener {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void optionsChanged(ToolOptions options, String optionName, Object oldValue,
|
||||
Object newValue) {
|
||||
KeyStroke keyStroke = (KeyStroke) newValue;
|
||||
if (optionName.startsWith(actionName)) {
|
||||
setUnvalidatedKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
public void actionPerformed(ListingActionContext context) {
|
||||
plugin.createData(dataType, context, true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
/* ###
|
||||
* 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.
|
||||
|
@ -28,7 +27,7 @@ import javax.swing.*;
|
|||
import javax.swing.event.*;
|
||||
import javax.swing.text.*;
|
||||
|
||||
import docking.util.KeyBindingUtils;
|
||||
import docking.actions.KeyBindingUtils;
|
||||
|
||||
class FunctionSignatureTextField extends JTextPane {
|
||||
private static final String ENTER_ACTION_NAME = "ENTER";
|
||||
|
|
|
@ -15,13 +15,9 @@
|
|||
*/
|
||||
package ghidra.app.plugin.core.functioncompare;
|
||||
|
||||
import java.awt.event.InputEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import docking.ActionContext;
|
||||
import docking.DockingUtils;
|
||||
import docking.action.KeyBindingData;
|
||||
import docking.action.MenuData;
|
||||
import ghidra.app.context.*;
|
||||
import ghidra.program.model.listing.*;
|
||||
|
@ -52,12 +48,6 @@ public class CompareFunctionsAction extends ProgramContextAction {
|
|||
FunctionComparisonPlugin.FUNCTION_MENU_SUBGROUP, MenuData.NO_MNEMONIC,
|
||||
"Z_End" /* See the FunctionPlugin for this value */));
|
||||
|
||||
// TODO this binding needs to be revisited; probably needs to be more modified, like
|
||||
// Ctrl-Shift-F; it currently interferes with other uses of Ctrl-F, usually when
|
||||
// performing a find function.
|
||||
setKeyBindingData(new KeyBindingData(KeyEvent.VK_F,
|
||||
DockingUtils.CONTROL_KEY_MODIFIER_MASK | InputEvent.SHIFT_DOWN_MASK));
|
||||
|
||||
setHelpLocation(new HelpLocation("FunctionComparison", "Compare_Selected_Functions"));
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ package ghidra.app.plugin.core.functionwindow;
|
|||
import java.util.List;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import docking.ActionContext;
|
||||
import docking.action.*;
|
||||
|
@ -30,11 +29,9 @@ import ghidra.app.plugin.ProgramPlugin;
|
|||
import ghidra.app.plugin.core.functioncompare.FunctionComparisonProvider;
|
||||
import ghidra.app.plugin.core.functioncompare.FunctionComparisonProviderManager;
|
||||
import ghidra.framework.model.*;
|
||||
import ghidra.framework.options.*;
|
||||
import ghidra.framework.plugintool.PluginInfo;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.framework.plugintool.util.PluginStatus;
|
||||
import ghidra.framework.plugintool.util.ToolConstants;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.model.listing.*;
|
||||
import ghidra.program.model.symbol.Symbol;
|
||||
|
@ -42,6 +39,7 @@ import ghidra.program.util.*;
|
|||
import ghidra.util.Msg;
|
||||
import ghidra.util.table.GhidraTable;
|
||||
import ghidra.util.table.SelectionNavigationAction;
|
||||
import ghidra.util.table.actions.MakeProgramSelectionAction;
|
||||
import ghidra.util.task.SwingUpdateManager;
|
||||
import resources.ResourceManager;
|
||||
|
||||
|
@ -55,8 +53,7 @@ import resources.ResourceManager;
|
|||
eventsConsumed = { ProgramClosedPluginEvent.class }
|
||||
)
|
||||
//@formatter:on
|
||||
public class FunctionWindowPlugin extends ProgramPlugin
|
||||
implements DomainObjectListener, OptionsChangeListener {
|
||||
public class FunctionWindowPlugin extends ProgramPlugin implements DomainObjectListener {
|
||||
|
||||
private DockingAction selectAction;
|
||||
private DockingAction compareAction;
|
||||
|
@ -64,19 +61,12 @@ public class FunctionWindowPlugin extends ProgramPlugin
|
|||
private SwingUpdateManager swingMgr;
|
||||
private FunctionComparisonProviderManager functionComparisonManager;
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
public FunctionWindowPlugin(PluginTool tool) {
|
||||
super(tool, true, false);
|
||||
|
||||
functionComparisonManager = new FunctionComparisonProviderManager(this);
|
||||
|
||||
swingMgr = new SwingUpdateManager(1000, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
provider.reload();
|
||||
}
|
||||
});
|
||||
swingMgr = new SwingUpdateManager(1000, () -> provider.reload());
|
||||
|
||||
}
|
||||
|
||||
|
@ -98,12 +88,6 @@ public class FunctionWindowPlugin extends ProgramPlugin
|
|||
super.dispose();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Implementation of DomainObjectListener
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void domainObjectChanged(DomainObjectChangedEvent ev) {
|
||||
if (ev.containsEvent(DomainObject.DO_OBJECT_RESTORED)) {
|
||||
|
@ -168,20 +152,18 @@ public class FunctionWindowPlugin extends ProgramPlugin
|
|||
provider.update(function);
|
||||
}
|
||||
break;
|
||||
/*case ChangeManager.DOCR_SYMBOL_REMOVED:
|
||||
rec = (ProgramChangeRecord)ev.getChangeRecord(i);
|
||||
addr = (Address)rec.getObject();
|
||||
function = currentProgram.getListing().getFunctionAt(addr);
|
||||
if (function != null) {
|
||||
provider.functionChanged(function);
|
||||
}
|
||||
break;*/
|
||||
/*case ChangeManager.DOCR_SYMBOL_REMOVED:
|
||||
rec = (ProgramChangeRecord)ev.getChangeRecord(i);
|
||||
addr = (Address)rec.getObject();
|
||||
function = currentProgram.getListing().getFunctionAt(addr);
|
||||
if (function != null) {
|
||||
provider.functionChanged(function);
|
||||
}
|
||||
break;*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
protected void programActivated(Program program) {
|
||||
program.addListener(this);
|
||||
|
@ -194,17 +176,10 @@ public class FunctionWindowPlugin extends ProgramPlugin
|
|||
provider.programClosed();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Program getProgram() {
|
||||
return currentProgram;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Create the action objects for this plugin.
|
||||
*/
|
||||
private void createActions() {
|
||||
addSelectAction();
|
||||
addCompareAction();
|
||||
|
@ -214,19 +189,13 @@ public class FunctionWindowPlugin extends ProgramPlugin
|
|||
}
|
||||
|
||||
private void addSelectAction() {
|
||||
selectAction = new DockingAction("Make Selection", getName(), false) {
|
||||
|
||||
selectAction = new MakeProgramSelectionAction(getName(), provider.getTable()) {
|
||||
@Override
|
||||
public void actionPerformed(ActionContext context) {
|
||||
protected void makeSelection(ActionContext context) {
|
||||
selectFunctions(provider.selectFunctions());
|
||||
}
|
||||
};
|
||||
selectAction.setEnabled(false);
|
||||
ImageIcon icon = ResourceManager.loadImage("images/text_align_justify.png");
|
||||
selectAction.setPopupMenuData(new MenuData(new String[] { "Make Selection" }, icon));
|
||||
selectAction.setDescription("Selects currently selected function(s) in table");
|
||||
selectAction.setToolBarData(new ToolBarData(icon));
|
||||
|
||||
installDummyAction(selectAction);
|
||||
|
||||
tool.addLocalAction(provider, selectAction);
|
||||
}
|
||||
|
@ -238,43 +207,15 @@ public class FunctionWindowPlugin extends ProgramPlugin
|
|||
compareSelectedFunctions();
|
||||
}
|
||||
};
|
||||
compareAction.setEnabled(false);
|
||||
|
||||
ImageIcon icon = ResourceManager.loadImage("images/page_white_c.png");
|
||||
compareAction.setPopupMenuData(new MenuData(new String[] { "Compare Functions" }, icon));
|
||||
compareAction.setDescription("Compares the currently selected function(s) in the table.");
|
||||
compareAction.setToolBarData(new ToolBarData(icon));
|
||||
|
||||
installDummyAction(compareAction);
|
||||
|
||||
tool.addLocalAction(provider, compareAction);
|
||||
}
|
||||
|
||||
private void installDummyAction(DockingAction action) {
|
||||
DummyKeyBindingsOptionsAction dummyAction =
|
||||
new DummyKeyBindingsOptionsAction(action.getName(), null);
|
||||
tool.addAction(dummyAction);
|
||||
|
||||
ToolOptions options = tool.getOptions(ToolConstants.KEY_BINDINGS);
|
||||
options.addOptionsChangeListener(this);
|
||||
|
||||
KeyStroke keyStroke = options.getKeyStroke(dummyAction.getFullName(), null);
|
||||
if (keyStroke != null) {
|
||||
action.setUnvalidatedKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void optionsChanged(ToolOptions options, String optionName, Object oldValue, Object newValue) {
|
||||
if (optionName.startsWith(selectAction.getName())) {
|
||||
KeyStroke keyStroke = (KeyStroke) newValue;
|
||||
selectAction.setUnvalidatedKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
if (optionName.startsWith(compareAction.getName())) {
|
||||
KeyStroke keyStroke = (KeyStroke) newValue;
|
||||
compareAction.setUnvalidatedKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
}
|
||||
|
||||
void setActionsEnabled(boolean enabled) {
|
||||
selectAction.setEnabled(enabled);
|
||||
compareAction.setEnabled(enabled);
|
||||
|
|
|
@ -17,20 +17,18 @@ package ghidra.app.plugin.core.navigation.locationreferences;
|
|||
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import docking.action.*;
|
||||
import docking.action.KeyBindingData;
|
||||
import docking.action.MenuData;
|
||||
import ghidra.app.actions.AbstractFindReferencesDataTypeAction;
|
||||
import ghidra.app.context.ListingActionContext;
|
||||
import ghidra.app.context.ListingContextAction;
|
||||
import ghidra.framework.options.*;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.framework.plugintool.util.ToolConstants;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.util.ProgramLocation;
|
||||
|
||||
/**
|
||||
* {@link LocationReferencesPlugin}'s action for finding references to a thing.
|
||||
*/
|
||||
public class FindReferencesToAction extends ListingContextAction implements OptionsChangeListener {
|
||||
public class FindReferencesToAction extends ListingContextAction {
|
||||
|
||||
private LocationReferencesPlugin plugin;
|
||||
private int subGroupPosition;
|
||||
|
@ -44,37 +42,21 @@ public class FindReferencesToAction extends ListingContextAction implements Opti
|
|||
|
||||
setDescription("Shows references to the item under the cursor");
|
||||
|
||||
//
|
||||
// Shared keybinding setup
|
||||
//
|
||||
KeyStroke defaultkeyStroke = AbstractFindReferencesDataTypeAction.DEFAULT_KEY_STROKE;
|
||||
PluginTool tool = plugin.getTool();
|
||||
DockingAction action = new DummyKeyBindingsOptionsAction(
|
||||
AbstractFindReferencesDataTypeAction.NAME, defaultkeyStroke);
|
||||
tool.addAction(action);
|
||||
initKeyStroke(defaultkeyStroke);
|
||||
}
|
||||
|
||||
// setup options to know when the dummy key binding is changed
|
||||
ToolOptions options = tool.getOptions(ToolConstants.KEY_BINDINGS);
|
||||
KeyStroke optionsKeyStroke = options.getKeyStroke(action.getFullName(), defaultkeyStroke);
|
||||
|
||||
if (!defaultkeyStroke.equals(optionsKeyStroke)) {
|
||||
// user-defined keystroke
|
||||
setUnvalidatedKeyBindingData(new KeyBindingData(optionsKeyStroke));
|
||||
}
|
||||
else {
|
||||
setKeyBindingData(new KeyBindingData(optionsKeyStroke));
|
||||
private void initKeyStroke(KeyStroke keyStroke) {
|
||||
if (keyStroke == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
options.addOptionsChangeListener(this);
|
||||
setKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void optionsChanged(ToolOptions options, String name, Object oldValue, Object newValue) {
|
||||
KeyStroke keyStroke = (KeyStroke) newValue;
|
||||
String actionName = getName();
|
||||
if (name.startsWith(actionName)) {
|
||||
setUnvalidatedKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
public boolean usesSharedKeyBinding() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -35,7 +35,7 @@ import ghidra.program.model.listing.Program;
|
|||
import ghidra.program.util.ProgramLocation;
|
||||
import ghidra.util.HelpLocation;
|
||||
import ghidra.util.Msg;
|
||||
import ghidra.util.table.DeleteTableRowAction;
|
||||
import ghidra.util.table.actions.DeleteTableRowAction;
|
||||
|
||||
/**
|
||||
* Plugin to show a list of references to the item represented by the location of the cursor.
|
||||
|
|
|
@ -38,7 +38,9 @@ import ghidra.program.model.address.AddressSet;
|
|||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.program.util.ProgramLocation;
|
||||
import ghidra.util.HelpLocation;
|
||||
import ghidra.util.table.*;
|
||||
import ghidra.util.table.GhidraTable;
|
||||
import ghidra.util.table.SelectionNavigationAction;
|
||||
import ghidra.util.table.actions.DeleteTableRowAction;
|
||||
import ghidra.util.task.SwingUpdateManager;
|
||||
import resources.Icons;
|
||||
import resources.ResourceManager;
|
||||
|
@ -207,11 +209,6 @@ public class LocationReferencesProvider extends ComponentProviderAdapter
|
|||
|
||||
tool.removeComponentProvider(this);
|
||||
|
||||
tool.removeLocalAction(this, homeAction);
|
||||
tool.removeLocalAction(this, refreshAction);
|
||||
tool.removeLocalAction(this, selectionAction);
|
||||
tool.removeLocalAction(this, highlightAction);
|
||||
|
||||
homeAction.dispose();
|
||||
refreshAction.dispose();
|
||||
highlightAction.dispose();
|
||||
|
@ -441,7 +438,7 @@ public class LocationReferencesProvider extends ComponentProviderAdapter
|
|||
private class DeleteAction extends DeleteTableRowAction {
|
||||
|
||||
DeleteAction(PluginTool tool, GTable table) {
|
||||
super(tool, table, locationReferencesPlugin.getName());
|
||||
super(table, locationReferencesPlugin.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,7 +24,7 @@ import java.util.Map.Entry;
|
|||
import javax.swing.*;
|
||||
import javax.swing.border.*;
|
||||
|
||||
import docking.util.KeyBindingUtils;
|
||||
import docking.actions.KeyBindingUtils;
|
||||
import docking.widgets.label.GDLabel;
|
||||
import docking.widgets.label.GIconLabel;
|
||||
import generic.util.WindowUtilities;
|
||||
|
|
|
@ -26,8 +26,8 @@ import javax.swing.*;
|
|||
import javax.swing.tree.*;
|
||||
|
||||
import docking.DockingUtils;
|
||||
import docking.actions.KeyBindingUtils;
|
||||
import docking.dnd.*;
|
||||
import docking.util.KeyBindingUtils;
|
||||
import docking.widgets.table.AutoscrollAdapter;
|
||||
|
||||
/**
|
||||
|
|
|
@ -30,8 +30,8 @@ import javax.swing.tree.*;
|
|||
|
||||
import docking.DockingUtils;
|
||||
import docking.action.DockingAction;
|
||||
import docking.actions.KeyBindingUtils;
|
||||
import docking.dnd.DropTgtAdapter;
|
||||
import docking.util.KeyBindingUtils;
|
||||
import docking.widgets.JTreeMouseListenerDelegate;
|
||||
import ghidra.app.util.SelectionTransferData;
|
||||
import ghidra.app.util.SelectionTransferable;
|
||||
|
|
|
@ -28,9 +28,9 @@ import javax.swing.event.ChangeEvent;
|
|||
import javax.swing.event.ChangeListener;
|
||||
|
||||
import docking.action.DockingAction;
|
||||
import docking.actions.KeyBindingUtils;
|
||||
import docking.dnd.DropTgtAdapter;
|
||||
import docking.dnd.Droppable;
|
||||
import docking.util.KeyBindingUtils;
|
||||
import docking.widgets.label.GDLabel;
|
||||
import ghidra.app.util.*;
|
||||
import ghidra.app.util.viewer.field.BrowserCodeUnitFormat;
|
||||
|
|
|
@ -33,7 +33,7 @@ import ghidra.framework.plugintool.util.ToolConstants;
|
|||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.program.util.ChangeManager;
|
||||
import ghidra.util.HelpLocation;
|
||||
import ghidra.util.table.DeleteTableRowAction;
|
||||
import ghidra.util.table.actions.DeleteTableRowAction;
|
||||
import ghidra.util.task.SwingUpdateManager;
|
||||
|
||||
/**
|
||||
|
|
|
@ -23,16 +23,14 @@ import javax.swing.*;
|
|||
import javax.swing.border.Border;
|
||||
|
||||
import docking.*;
|
||||
import docking.action.*;
|
||||
import docking.action.DockingAction;
|
||||
import docking.help.HelpService;
|
||||
import docking.tool.util.DockingToolConstants;
|
||||
import docking.widgets.label.GLabel;
|
||||
import docking.widgets.table.GTableFilterPanel;
|
||||
import docking.widgets.table.TableFilter;
|
||||
import ghidra.app.events.ProgramSelectionPluginEvent;
|
||||
import ghidra.app.plugin.core.scalartable.RangeFilterTextField.FilterType;
|
||||
import ghidra.app.services.GoToService;
|
||||
import ghidra.framework.options.*;
|
||||
import ghidra.framework.plugintool.ComponentProviderAdapter;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.model.listing.Program;
|
||||
|
@ -40,6 +38,8 @@ import ghidra.program.model.scalar.Scalar;
|
|||
import ghidra.program.util.ProgramSelection;
|
||||
import ghidra.util.HelpLocation;
|
||||
import ghidra.util.table.*;
|
||||
import ghidra.util.table.actions.DeleteTableRowAction;
|
||||
import ghidra.util.table.actions.MakeProgramSelectionAction;
|
||||
import resources.ResourceManager;
|
||||
|
||||
/**
|
||||
|
@ -49,8 +49,7 @@ import resources.ResourceManager;
|
|||
* <li>The range filter that allows the user to filter the scalar table via a min and max value.
|
||||
* </ul>
|
||||
*/
|
||||
public class ScalarSearchProvider extends ComponentProviderAdapter
|
||||
implements OptionsChangeListener {
|
||||
public class ScalarSearchProvider extends ComponentProviderAdapter {
|
||||
|
||||
public static final ImageIcon ICON = ResourceManager.loadImage("images/dataW.gif");
|
||||
|
||||
|
@ -143,15 +142,6 @@ public class ScalarSearchProvider extends ComponentProviderAdapter
|
|||
return min.equals(Integer.toString(minValue)) && max.equals(Integer.toString(maxValue));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void optionsChanged(ToolOptions options, String optionName, Object oldValue,
|
||||
Object newValue) {
|
||||
if (optionName.startsWith(selectAction.getName())) {
|
||||
KeyStroke keyStroke = (KeyStroke) newValue;
|
||||
selectAction.setUnvalidatedKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
}
|
||||
|
||||
private void selectDataInProgramFromTable(ProgramSelection selection) {
|
||||
ProgramSelectionPluginEvent pspe =
|
||||
new ProgramSelectionPluginEvent("Selection", selection, plugin.getCurrentProgram());
|
||||
|
@ -268,30 +258,12 @@ public class ScalarSearchProvider extends ComponentProviderAdapter
|
|||
|
||||
private void createActions() {
|
||||
|
||||
selectAction = new DockingAction("Make Selection", getName(), false) {
|
||||
selectAction = new MakeProgramSelectionAction(getName(), getTable()) {
|
||||
@Override
|
||||
public void actionPerformed(ActionContext context) {
|
||||
protected void makeSelection(ActionContext context) {
|
||||
selectDataInProgramFromTable(getSelection());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabledForContext(ActionContext context) {
|
||||
if (!(context instanceof ScalarSearchContext)) {
|
||||
return false;
|
||||
}
|
||||
ScalarSearchContext scalarWindowContext = (ScalarSearchContext) context;
|
||||
GhidraTable table = scalarWindowContext.getScalarTable();
|
||||
return table.getSelectedRows().length > 0;
|
||||
}
|
||||
};
|
||||
selectAction.setEnabled(false);
|
||||
ImageIcon icon = ResourceManager.loadImage("images/text_align_justify.png");
|
||||
selectAction.setPopupMenuData(new MenuData(new String[] { "Make Selection" }, icon));
|
||||
selectAction.setDescription("Selects currently selected scalar(s) in table");
|
||||
selectAction.setToolBarData(new ToolBarData(icon));
|
||||
selectAction.setHelpLocation(new HelpLocation(plugin.getName(), "Make_Selection"));
|
||||
|
||||
installDummyAction(selectAction);
|
||||
|
||||
tool.addLocalAction(this, selectAction);
|
||||
|
||||
|
@ -299,24 +271,10 @@ public class ScalarSearchProvider extends ComponentProviderAdapter
|
|||
tool.addLocalAction(this, selectionAction);
|
||||
|
||||
GhidraTable table = threadedTablePanel.getTable();
|
||||
DockingAction removeItemsAction = new DeleteTableRowAction(tool, table, plugin.getName());
|
||||
DockingAction removeItemsAction = new DeleteTableRowAction(table, plugin.getName());
|
||||
tool.addLocalAction(this, removeItemsAction);
|
||||
}
|
||||
|
||||
private void installDummyAction(DockingAction action) {
|
||||
DummyKeyBindingsOptionsAction dummyAction =
|
||||
new DummyKeyBindingsOptionsAction(action.getName(), null);
|
||||
tool.addAction(dummyAction);
|
||||
|
||||
ToolOptions options = tool.getOptions(DockingToolConstants.KEY_BINDINGS);
|
||||
options.addOptionsChangeListener(this);
|
||||
|
||||
KeyStroke keyStroke = options.getKeyStroke(dummyAction.getFullName(), null);
|
||||
if (keyStroke != null) {
|
||||
action.setUnvalidatedKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
// TODO Delete - the custom filtering code below this line needs to be deleted, as it is now
|
||||
// replaced by the column filtering
|
||||
|
|
|
@ -33,8 +33,7 @@ import generic.jar.ResourceFile;
|
|||
import ghidra.app.script.GhidraScriptUtil;
|
||||
import ghidra.app.script.ScriptInfo;
|
||||
import ghidra.framework.Application;
|
||||
import ghidra.framework.options.*;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.framework.options.SaveState;
|
||||
import ghidra.framework.plugintool.util.ToolConstants;
|
||||
import ghidra.util.*;
|
||||
import ghidra.util.task.*;
|
||||
|
@ -44,7 +43,6 @@ import utilities.util.FileUtilities;
|
|||
|
||||
class GhidraScriptActionManager {
|
||||
public static final String RERUN_LAST_SHARED_ACTION_NAME = "Rerun Last Script";
|
||||
public static final String GLOBAL_RERUN_LAST_SHARED_ACTION_NAME = "Global Rerun Last Script";
|
||||
private static final KeyStroke RERUN_LAST_SCRIPT_KEYSTROKE = KeyStroke.getKeyStroke(
|
||||
KeyEvent.VK_R, DockingUtils.CONTROL_KEY_MODIFIER_MASK | InputEvent.SHIFT_DOWN_MASK);
|
||||
private static final String SCRIPT_ACTIONS_KEY = "Scripts_Actions_Key";
|
||||
|
@ -120,6 +118,7 @@ class GhidraScriptActionManager {
|
|||
/**
|
||||
* This saves bindings that users have changed. These will overwrite those that may
|
||||
* be defined in the script.
|
||||
* @param saveState the state into which bindings are saved
|
||||
*/
|
||||
void saveUserDefinedKeybindings(SaveState saveState) {
|
||||
Collection<ScriptAction> actions = actionMap.values();
|
||||
|
@ -147,6 +146,7 @@ class GhidraScriptActionManager {
|
|||
/**
|
||||
* This saves scripts that not only have keybindings, but that are also marked as "In Tool"
|
||||
* from the GUI.
|
||||
* @param saveState the state into which the script info is saved
|
||||
*/
|
||||
void saveScriptsThatAreInTool(SaveState saveState) {
|
||||
Set<ResourceFile> actionScriptFiles = actionMap.keySet();
|
||||
|
@ -194,10 +194,9 @@ class GhidraScriptActionManager {
|
|||
runAction.setEnabled(false);
|
||||
plugin.getTool().addLocalAction(provider, runAction);
|
||||
|
||||
runLastAction = new RerunLastScriptAction(RERUN_LAST_SHARED_ACTION_NAME, runGroup);
|
||||
runLastAction = new RerunLastScriptAction(runGroup);
|
||||
plugin.getTool().addLocalAction(provider, runLastAction);
|
||||
globalRunLastAction =
|
||||
new RerunLastScriptAction(GLOBAL_RERUN_LAST_SHARED_ACTION_NAME, "Xtra");
|
||||
globalRunLastAction = new RerunLastScriptAction("Xtra");
|
||||
plugin.getTool().addAction(globalRunLastAction);
|
||||
|
||||
//
|
||||
|
@ -626,41 +625,32 @@ class GhidraScriptActionManager {
|
|||
|
||||
}
|
||||
|
||||
private class RerunLastScriptAction extends DockingAction implements OptionsChangeListener {
|
||||
private class RerunLastScriptAction extends DockingAction {
|
||||
|
||||
RerunLastScriptAction(String actionName, String toolbarGroup) {
|
||||
super(actionName, plugin.getName(), false);
|
||||
RerunLastScriptAction(String toolbarGroup) {
|
||||
super(RERUN_LAST_SHARED_ACTION_NAME, plugin.getName(), false);
|
||||
|
||||
setToolBarData(
|
||||
new ToolBarData(ResourceManager.loadImage("images/play_again.png"), toolbarGroup));
|
||||
setDescription("Rerun the last run script");
|
||||
setEnabled(false);
|
||||
|
||||
DockingAction action = new DummyKeyBindingsOptionsAction(RERUN_LAST_SHARED_ACTION_NAME,
|
||||
RERUN_LAST_SCRIPT_KEYSTROKE);
|
||||
PluginTool tool = plugin.getTool();
|
||||
tool.addAction(action);
|
||||
|
||||
// setup options to know when the dummy key binding is changed
|
||||
ToolOptions options = tool.getOptions(ToolConstants.KEY_BINDINGS);
|
||||
KeyStroke keyStroke =
|
||||
options.getKeyStroke(getFullSharedActionName(), RERUN_LAST_SCRIPT_KEYSTROKE);
|
||||
|
||||
if (!RERUN_LAST_SCRIPT_KEYSTROKE.equals(keyStroke)) {
|
||||
// user-defined keystroke
|
||||
setUnvalidatedKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
else {
|
||||
setKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
|
||||
options.addOptionsChangeListener(this);
|
||||
|
||||
setHelpLocation(new HelpLocation(plugin.getName(), "Run_Last"));
|
||||
|
||||
initKeyStroke(RERUN_LAST_SCRIPT_KEYSTROKE);
|
||||
}
|
||||
|
||||
private String getFullSharedActionName() {
|
||||
return RERUN_LAST_SHARED_ACTION_NAME + " (Tool)";
|
||||
private void initKeyStroke(KeyStroke keyStroke) {
|
||||
if (keyStroke == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
setKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean usesSharedKeyBinding() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -672,15 +662,5 @@ class GhidraScriptActionManager {
|
|||
public boolean isEnabledForContext(ActionContext context) {
|
||||
return provider.getLastRunScript() != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void optionsChanged(ToolOptions options, String name, Object oldValue,
|
||||
Object newValue) {
|
||||
KeyStroke keyStroke = (KeyStroke) newValue;
|
||||
if (name.startsWith(RERUN_LAST_SHARED_ACTION_NAME)) {
|
||||
setUnvalidatedKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,8 +29,8 @@ import javax.swing.undo.UndoableEdit;
|
|||
|
||||
import docking.*;
|
||||
import docking.action.*;
|
||||
import docking.actions.KeyBindingUtils;
|
||||
import docking.options.editor.FontPropertyEditor;
|
||||
import docking.util.KeyBindingUtils;
|
||||
import docking.widgets.OptionDialog;
|
||||
import generic.jar.ResourceFile;
|
||||
import ghidra.app.script.GhidraScriptUtil;
|
||||
|
|
|
@ -16,11 +16,9 @@
|
|||
package ghidra.app.plugin.core.strings;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import docking.ActionContext;
|
||||
import docking.action.*;
|
||||
import docking.tool.util.DockingToolConstants;
|
||||
import ghidra.app.CorePluginPackage;
|
||||
import ghidra.app.events.ProgramSelectionPluginEvent;
|
||||
import ghidra.app.plugin.PluginCategoryNames;
|
||||
|
@ -28,7 +26,6 @@ import ghidra.app.plugin.ProgramPlugin;
|
|||
import ghidra.app.plugin.core.data.DataSettingsDialog;
|
||||
import ghidra.app.services.GoToService;
|
||||
import ghidra.framework.model.*;
|
||||
import ghidra.framework.options.*;
|
||||
import ghidra.framework.plugintool.PluginInfo;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.framework.plugintool.util.PluginStatus;
|
||||
|
@ -38,9 +35,9 @@ import ghidra.program.util.*;
|
|||
import ghidra.util.HelpLocation;
|
||||
import ghidra.util.exception.CancelledException;
|
||||
import ghidra.util.table.SelectionNavigationAction;
|
||||
import ghidra.util.table.actions.MakeProgramSelectionAction;
|
||||
import ghidra.util.task.SwingUpdateManager;
|
||||
import resources.Icons;
|
||||
import resources.ResourceManager;
|
||||
|
||||
/**
|
||||
* Plugin that provides the "Defined Strings" table, where all the currently defined
|
||||
|
@ -58,8 +55,7 @@ import resources.ResourceManager;
|
|||
servicesRequired = { GoToService.class }
|
||||
)
|
||||
//@formatter:on
|
||||
public class ViewStringsPlugin extends ProgramPlugin
|
||||
implements DomainObjectListener, OptionsChangeListener {
|
||||
public class ViewStringsPlugin extends ProgramPlugin implements DomainObjectListener {
|
||||
|
||||
private DockingAction selectAction;
|
||||
private DockingAction showSettingsAction;
|
||||
|
@ -104,24 +100,13 @@ public class ViewStringsPlugin extends ProgramPlugin
|
|||
refreshAction.setHelpLocation(new HelpLocation("ViewStringsPlugin", "Refresh"));
|
||||
tool.addLocalAction(provider, refreshAction);
|
||||
|
||||
selectAction = new DockingAction("Make Selection", getName(), false) {
|
||||
selectAction = new MakeProgramSelectionAction(getName(), provider.getTable()) {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionContext context) {
|
||||
protected void makeSelection(ActionContext context) {
|
||||
selectData(provider.selectData());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabledForContext(ActionContext context) {
|
||||
return provider.getSelectedRowCount() > 0;
|
||||
}
|
||||
};
|
||||
ImageIcon selectActionIcon = ResourceManager.loadImage("images/text_align_justify.png");
|
||||
selectAction.setPopupMenuData(
|
||||
new MenuData(new String[] { "Make Selection" }, selectActionIcon));
|
||||
selectAction.setDescription("Selects currently selected data in table");
|
||||
selectAction.setToolBarData(new ToolBarData(selectActionIcon));
|
||||
|
||||
installDummyAction(selectAction);
|
||||
|
||||
tool.addLocalAction(provider, selectAction);
|
||||
|
||||
|
@ -175,29 +160,6 @@ public class ViewStringsPlugin extends ProgramPlugin
|
|||
|
||||
}
|
||||
|
||||
private void installDummyAction(DockingAction action) {
|
||||
DummyKeyBindingsOptionsAction dummyAction =
|
||||
new DummyKeyBindingsOptionsAction(action.getName(), null);
|
||||
tool.addAction(dummyAction);
|
||||
|
||||
ToolOptions options = tool.getOptions(DockingToolConstants.KEY_BINDINGS);
|
||||
options.addOptionsChangeListener(this);
|
||||
|
||||
KeyStroke keyStroke = options.getKeyStroke(dummyAction.getFullName(), null);
|
||||
if (keyStroke != null) {
|
||||
action.setUnvalidatedKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void optionsChanged(ToolOptions options, String optionName, Object oldValue,
|
||||
Object newValue) {
|
||||
if (optionName.startsWith(selectAction.getName())) {
|
||||
KeyStroke keyStroke = (KeyStroke) newValue;
|
||||
selectAction.setUnvalidatedKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
}
|
||||
|
||||
private void selectData(ProgramSelection selection) {
|
||||
ProgramSelectionPluginEvent pspe =
|
||||
new ProgramSelectionPluginEvent("Selection", selection, currentProgram);
|
||||
|
@ -245,7 +207,6 @@ public class ViewStringsPlugin extends ProgramPlugin
|
|||
else if (ev.containsEvent(ChangeManager.DOCR_CODE_ADDED)) {
|
||||
for (int i = 0; i < ev.numRecords(); ++i) {
|
||||
DomainObjectChangeRecord doRecord = ev.getChangeRecord(i);
|
||||
Object oldValue = doRecord.getOldValue();
|
||||
Object newValue = doRecord.getNewValue();
|
||||
switch (doRecord.getEventType()) {
|
||||
case ChangeManager.DOCR_CODE_REMOVED:
|
||||
|
|
|
@ -16,28 +16,26 @@
|
|||
package ghidra.app.plugin.core.symboltree.actions;
|
||||
|
||||
import javax.swing.KeyStroke;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.tree.TreePath;
|
||||
|
||||
import docking.action.*;
|
||||
import docking.action.KeyBindingData;
|
||||
import docking.action.MenuData;
|
||||
import ghidra.app.actions.AbstractFindReferencesDataTypeAction;
|
||||
import ghidra.app.nav.Navigatable;
|
||||
import ghidra.app.plugin.core.navigation.locationreferences.LocationReferencesService;
|
||||
import ghidra.app.plugin.core.symboltree.SymbolTreeActionContext;
|
||||
import ghidra.app.plugin.core.symboltree.nodes.*;
|
||||
import ghidra.app.services.CodeViewerService;
|
||||
import ghidra.framework.options.*;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.framework.plugintool.util.ServiceListener;
|
||||
import ghidra.framework.plugintool.util.ToolConstants;
|
||||
import ghidra.program.database.symbol.FunctionSymbol;
|
||||
import ghidra.program.model.symbol.Symbol;
|
||||
import ghidra.program.util.FunctionSignatureFieldLocation;
|
||||
import ghidra.program.util.ProgramLocation;
|
||||
import ghidra.util.Msg;
|
||||
import ghidra.util.Swing;
|
||||
|
||||
public class ShowSymbolReferencesAction extends SymbolTreeContextAction
|
||||
implements OptionsChangeListener {
|
||||
public class ShowSymbolReferencesAction extends SymbolTreeContextAction {
|
||||
|
||||
private PluginTool tool;
|
||||
|
||||
|
@ -53,7 +51,7 @@ public class ShowSymbolReferencesAction extends SymbolTreeContextAction
|
|||
public void serviceAdded(Class<?> interfaceClass, Object service) {
|
||||
if (interfaceClass.equals(LocationReferencesService.class)) {
|
||||
setHelpLocation(((LocationReferencesService) service).getHelpLocation());
|
||||
SwingUtilities.invokeLater(() -> tool.removeServiceListener(this));
|
||||
Swing.runLater(() -> tool.removeServiceListener(this));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -66,27 +64,21 @@ public class ShowSymbolReferencesAction extends SymbolTreeContextAction
|
|||
|
||||
installHelpLocation();
|
||||
|
||||
//
|
||||
// Shared keybinding setup
|
||||
//
|
||||
KeyStroke defaultkeyStroke = AbstractFindReferencesDataTypeAction.DEFAULT_KEY_STROKE;
|
||||
DockingAction action = new DummyKeyBindingsOptionsAction(
|
||||
AbstractFindReferencesDataTypeAction.NAME, defaultkeyStroke);
|
||||
tool.addAction(action);
|
||||
initKeyStroke(defaultkeyStroke);
|
||||
}
|
||||
|
||||
// setup options to know when the dummy key binding is changed
|
||||
ToolOptions options = tool.getOptions(ToolConstants.KEY_BINDINGS);
|
||||
KeyStroke optionsKeyStroke = options.getKeyStroke(action.getFullName(), defaultkeyStroke);
|
||||
|
||||
if (!defaultkeyStroke.equals(optionsKeyStroke)) {
|
||||
// user-defined keystroke
|
||||
setUnvalidatedKeyBindingData(new KeyBindingData(optionsKeyStroke));
|
||||
}
|
||||
else {
|
||||
setKeyBindingData(new KeyBindingData(optionsKeyStroke));
|
||||
private void initKeyStroke(KeyStroke keyStroke) {
|
||||
if (keyStroke == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
options.addOptionsChangeListener(this);
|
||||
setKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean usesSharedKeyBinding() {
|
||||
return true;
|
||||
}
|
||||
|
||||
private void installHelpLocation() {
|
||||
|
@ -102,15 +94,6 @@ public class ShowSymbolReferencesAction extends SymbolTreeContextAction
|
|||
setHelpLocation(locationReferencesService.getHelpLocation());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void optionsChanged(ToolOptions options, String name, Object oldValue, Object newValue) {
|
||||
KeyStroke keyStroke = (KeyStroke) newValue;
|
||||
String actionName = getName();
|
||||
if (name.startsWith(actionName)) {
|
||||
setUnvalidatedKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isEnabledForContext(SymbolTreeActionContext context) {
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ class SymbolProvider extends ComponentProviderAdapter {
|
|||
for (SymbolRowObject obj : rowObjects) {
|
||||
symbolIDs[index++] = obj.getKey();
|
||||
}
|
||||
return new ProgramSymbolActionContext(this, program, symbolIDs);
|
||||
return new ProgramSymbolActionContext(this, program, symbolIDs, getTable());
|
||||
}
|
||||
|
||||
void deleteSymbols() {
|
||||
|
|
|
@ -20,7 +20,6 @@ import java.awt.event.InputEvent;
|
|||
import java.awt.event.KeyEvent;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import docking.ActionContext;
|
||||
import docking.action.*;
|
||||
|
@ -33,9 +32,9 @@ import ghidra.app.services.BlockModelService;
|
|||
import ghidra.app.services.GoToService;
|
||||
import ghidra.app.util.SymbolInspector;
|
||||
import ghidra.framework.model.*;
|
||||
import ghidra.framework.options.*;
|
||||
import ghidra.framework.options.SaveState;
|
||||
import ghidra.framework.plugintool.*;
|
||||
import ghidra.framework.plugintool.util.*;
|
||||
import ghidra.framework.plugintool.util.PluginStatus;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.model.listing.Data;
|
||||
import ghidra.program.model.listing.Program;
|
||||
|
@ -45,6 +44,7 @@ import ghidra.program.util.ChangeManager;
|
|||
import ghidra.program.util.ProgramChangeRecord;
|
||||
import ghidra.util.table.GhidraTable;
|
||||
import ghidra.util.table.SelectionNavigationAction;
|
||||
import ghidra.util.table.actions.MakeProgramSelectionAction;
|
||||
import ghidra.util.task.SwingUpdateManager;
|
||||
import resources.Icons;
|
||||
import resources.ResourceManager;
|
||||
|
@ -69,10 +69,7 @@ import resources.ResourceManager;
|
|||
eventsConsumed = { ProgramActivatedPluginEvent.class }
|
||||
)
|
||||
//@formatter:on
|
||||
public class SymbolTablePlugin extends Plugin
|
||||
implements DomainObjectListener, OptionsChangeListener {
|
||||
|
||||
private static final String PLUGIN_NAME = "SymbolTablePlugin";
|
||||
public class SymbolTablePlugin extends Plugin implements DomainObjectListener {
|
||||
|
||||
final static Cursor WAIT_CURSOR = new Cursor(Cursor.WAIT_CURSOR);
|
||||
final static Cursor NORM_CURSOR = new Cursor(Cursor.DEFAULT_CURSOR);
|
||||
|
@ -437,32 +434,14 @@ public class SymbolTablePlugin extends Plugin
|
|||
DockingAction editExternalLocationAction = new EditExternalLocationAction(this);
|
||||
tool.addLocalAction(symProvider, editExternalLocationAction);
|
||||
|
||||
makeSelectionAction = new DockingAction("Make Selection", getName(), false) {
|
||||
makeSelectionAction = new MakeProgramSelectionAction(getName(), symProvider.getTable()) {
|
||||
@Override
|
||||
public void actionPerformed(ActionContext context) {
|
||||
protected void makeSelection(ActionContext context) {
|
||||
symProvider.makeSelection();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabledForContext(ActionContext context) {
|
||||
GhidraTable table = symProvider.getTable();
|
||||
return table.getSelectedRowCount() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAddToPopup(ActionContext context) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
icon = ResourceManager.loadImage("images/text_align_justify.png");
|
||||
makeSelectionAction.setPopupMenuData(
|
||||
new MenuData(new String[] { "Make Selection" }, icon, popupGroup));
|
||||
makeSelectionAction.setToolBarData(new ToolBarData(icon));
|
||||
|
||||
makeSelectionAction.setDescription("Make a selection using selected Symbol addresses");
|
||||
makeSelectionAction.setEnabled(false);
|
||||
|
||||
installDummyAction(makeSelectionAction);
|
||||
makeSelectionAction.getPopupMenuData().setMenuGroup(popupGroup);
|
||||
|
||||
tool.addLocalAction(symProvider, makeSelectionAction);
|
||||
|
||||
|
@ -478,8 +457,6 @@ public class SymbolTablePlugin extends Plugin
|
|||
}
|
||||
};
|
||||
icon = Icons.CONFIGURE_FILTER_ICON;
|
||||
setFilterAction.setPopupMenuData(
|
||||
new MenuData(new String[] { "Configure Symbol Filter" }, icon, popupGroup));
|
||||
setFilterAction.setToolBarData(new ToolBarData(icon));
|
||||
|
||||
setFilterAction.setDescription("Configure Symbol Filter");
|
||||
|
@ -505,29 +482,6 @@ public class SymbolTablePlugin extends Plugin
|
|||
tool.addAction(clearPinnedAction);
|
||||
}
|
||||
|
||||
private void installDummyAction(DockingAction action) {
|
||||
DummyKeyBindingsOptionsAction dummyAction =
|
||||
new DummyKeyBindingsOptionsAction(action.getName(), null);
|
||||
tool.addAction(dummyAction);
|
||||
|
||||
ToolOptions options = tool.getOptions(ToolConstants.KEY_BINDINGS);
|
||||
options.addOptionsChangeListener(this);
|
||||
|
||||
KeyStroke keyStroke = options.getKeyStroke(dummyAction.getFullName(), null);
|
||||
if (keyStroke != null) {
|
||||
action.setUnvalidatedKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void optionsChanged(ToolOptions options, String optionName, Object oldValue,
|
||||
Object newValue) {
|
||||
if (optionName.startsWith(makeSelectionAction.getName())) {
|
||||
KeyStroke keyStroke = (KeyStroke) newValue;
|
||||
makeSelectionAction.setUnvalidatedKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
}
|
||||
|
||||
private void createRefActions() {
|
||||
referencesToAction = new ToggleDockingAction("References To", getName()) {
|
||||
@Override
|
||||
|
|
|
@ -27,7 +27,8 @@ import javax.swing.event.TableModelListener;
|
|||
|
||||
import docking.ActionContext;
|
||||
import docking.ComponentProviderActivationListener;
|
||||
import docking.action.*;
|
||||
import docking.action.DockingAction;
|
||||
import docking.action.MenuData;
|
||||
import docking.widgets.table.AbstractSortedTableModel;
|
||||
import docking.widgets.table.GTable;
|
||||
import docking.widgets.table.threaded.GThreadedTablePanel;
|
||||
|
@ -35,21 +36,19 @@ import ghidra.app.nav.Navigatable;
|
|||
import ghidra.app.nav.NavigatableRemovalListener;
|
||||
import ghidra.app.services.*;
|
||||
import ghidra.app.util.HelpTopics;
|
||||
import ghidra.framework.options.OptionsChangeListener;
|
||||
import ghidra.framework.options.ToolOptions;
|
||||
import ghidra.framework.plugintool.ComponentProviderAdapter;
|
||||
import ghidra.framework.plugintool.Plugin;
|
||||
import ghidra.framework.plugintool.util.ToolConstants;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.program.util.*;
|
||||
import ghidra.util.HelpLocation;
|
||||
import ghidra.util.SystemUtilities;
|
||||
import ghidra.util.table.*;
|
||||
import ghidra.util.table.actions.DeleteTableRowAction;
|
||||
import ghidra.util.table.actions.MakeProgramSelectionAction;
|
||||
import resources.ResourceManager;
|
||||
|
||||
public class TableComponentProvider<T> extends ComponentProviderAdapter
|
||||
implements TableModelListener, NavigatableRemovalListener, OptionsChangeListener {
|
||||
implements TableModelListener, NavigatableRemovalListener {
|
||||
|
||||
private JPanel componentPanel;
|
||||
private GhidraThreadedTablePanel<T> threadedPanel;
|
||||
|
@ -158,28 +157,17 @@ public class TableComponentProvider<T> extends ComponentProviderAdapter
|
|||
}
|
||||
|
||||
private void createActions(final Plugin plugin) {
|
||||
selectAction = new DockingAction(TableServicePlugin.MAKE_SELECTION_ACTION_NAME,
|
||||
tableServicePlugin.getName(), false) {
|
||||
@Override
|
||||
public void actionPerformed(ActionContext context) {
|
||||
makeSelection(plugin);
|
||||
}
|
||||
|
||||
GhidraTable table = threadedPanel.getTable();
|
||||
selectAction = new MakeProgramSelectionAction(tableServicePlugin.getName(), table) {
|
||||
@Override
|
||||
public boolean isEnabledForContext(ActionContext context) {
|
||||
GhidraTable table = threadedPanel.getTable();
|
||||
return table.getSelectedRowCount() > 0;
|
||||
protected void makeSelection(ActionContext context) {
|
||||
doMakeSelection(plugin);
|
||||
}
|
||||
};
|
||||
selectAction.setDescription("Make a selection using selected rows");
|
||||
selectAction.setEnabled(false);
|
||||
|
||||
ImageIcon icon = ResourceManager.loadImage("images/text_align_justify.png");
|
||||
selectAction.setToolBarData(new ToolBarData(icon, null));
|
||||
selectAction.setPopupMenuData(new MenuData(new String[] { "Make Selection" }, icon, null));
|
||||
selectAction.setHelpLocation(new HelpLocation(HelpTopics.SEARCH, "Make_Selection"));
|
||||
|
||||
selectionNavigationAction = new SelectionNavigationAction(plugin, threadedPanel.getTable());
|
||||
selectionNavigationAction = new SelectionNavigationAction(plugin, table);
|
||||
selectionNavigationAction.setHelpLocation(
|
||||
new HelpLocation(HelpTopics.SEARCH, "Selection_Navigation"));
|
||||
|
||||
|
@ -187,21 +175,20 @@ public class TableComponentProvider<T> extends ComponentProviderAdapter
|
|||
new DockingAction("Go to External Location", getName(), false) {
|
||||
@Override
|
||||
public void actionPerformed(ActionContext context) {
|
||||
gotoExternalAddress(getSlectedExternalAddress());
|
||||
gotoExternalAddress(getSelectedExternalAddress());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabledForContext(ActionContext context) {
|
||||
return getSlectedExternalAddress() != null &&
|
||||
return getSelectedExternalAddress() != null &&
|
||||
tool.getService(GoToService.class) != null;
|
||||
}
|
||||
|
||||
private Address getSlectedExternalAddress() {
|
||||
GhidraTable table = threadedPanel.getTable();
|
||||
private Address getSelectedExternalAddress() {
|
||||
if (table.getSelectedRowCount() != 1) {
|
||||
return null;
|
||||
}
|
||||
ProgramSelection selection = threadedPanel.getTable().getProgramSelection();
|
||||
ProgramSelection selection = table.getProgramSelection();
|
||||
Program modelProgram = model.getProgram();
|
||||
if (modelProgram == null || selection.getNumAddresses() != 1) {
|
||||
return null;
|
||||
|
@ -213,17 +200,14 @@ public class TableComponentProvider<T> extends ComponentProviderAdapter
|
|||
externalGotoAction.setDescription("Go to an external location");
|
||||
externalGotoAction.setEnabled(false);
|
||||
|
||||
icon = ResourceManager.loadImage("images/searchm_obj.gif");
|
||||
Icon icon = ResourceManager.loadImage("images/searchm_obj.gif");
|
||||
externalGotoAction.setPopupMenuData(
|
||||
new MenuData(new String[] { "GoTo External Location" }, icon, null));
|
||||
externalGotoAction.setHelpLocation(new HelpLocation(HelpTopics.SEARCH, "Navigation"));
|
||||
|
||||
configureKeybinding(selectAction, null);
|
||||
|
||||
plugin.getTool().addLocalAction(this, selectAction);
|
||||
plugin.getTool().addLocalAction(this, selectionNavigationAction);
|
||||
plugin.getTool().addLocalAction(this, externalGotoAction);
|
||||
|
||||
}
|
||||
|
||||
public void installRemoveItemsAction() {
|
||||
|
@ -232,38 +216,11 @@ public class TableComponentProvider<T> extends ComponentProviderAdapter
|
|||
}
|
||||
|
||||
GhidraTable table = threadedPanel.getTable();
|
||||
removeItemsAction = new DeleteTableRowAction(tool, table, tableServicePlugin.getName());
|
||||
removeItemsAction = new DeleteTableRowAction(table, tableServicePlugin.getName());
|
||||
|
||||
tool.addLocalAction(this, removeItemsAction);
|
||||
}
|
||||
|
||||
private void configureKeybinding(DockingAction action, KeyStroke keyBinding) {
|
||||
// setup options to know when the dummy key binding is changed
|
||||
ToolOptions options = tool.getOptions(ToolConstants.KEY_BINDINGS);
|
||||
KeyStroke keyStroke = options.getKeyStroke(
|
||||
action.getName() + TableServicePlugin.SHARED_ACTION_OWNER_SUFFIX, keyBinding);
|
||||
|
||||
if (!SystemUtilities.isEqual(keyBinding, keyStroke)) {
|
||||
// user-defined keystroke
|
||||
action.setUnvalidatedKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
else {
|
||||
action.setKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
|
||||
options.removeOptionsChangeListener(this); // don't double add
|
||||
options.addOptionsChangeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void optionsChanged(ToolOptions options, String optionName, Object oldValue,
|
||||
Object newValue) {
|
||||
if (optionName.startsWith(TableServicePlugin.MAKE_SELECTION_ACTION_NAME)) {
|
||||
KeyStroke keyStroke = (KeyStroke) newValue;
|
||||
selectAction.setUnvalidatedKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
}
|
||||
|
||||
private JPanel createFilterFieldPanel(JTable table, AbstractSortedTableModel<T> sortedModel) {
|
||||
tableFilterPanel = new GhidraTableFilterPanel<>(table, sortedModel);
|
||||
tableFilterPanel.setToolTipText("Filter search results");
|
||||
|
@ -309,7 +266,7 @@ public class TableComponentProvider<T> extends ComponentProviderAdapter
|
|||
}
|
||||
}
|
||||
|
||||
private void makeSelection(Plugin plugin) {
|
||||
private void doMakeSelection(Plugin plugin) {
|
||||
ProgramSelection selection = threadedPanel.getTable().getProgramSelection();
|
||||
Program modelProgram = model.getProgram();
|
||||
if (modelProgram == null || selection.getNumAddresses() == 0) {
|
||||
|
|
|
@ -33,12 +33,11 @@ import ghidra.app.tablechooser.TableChooserExecutor;
|
|||
import ghidra.app.util.query.TableService;
|
||||
import ghidra.framework.model.DomainObjectChangedEvent;
|
||||
import ghidra.framework.model.DomainObjectListener;
|
||||
import ghidra.framework.options.DummyKeyBindingsOptionsAction;
|
||||
import ghidra.framework.plugintool.*;
|
||||
import ghidra.framework.plugintool.util.PluginStatus;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.util.table.DeleteTableRowAction;
|
||||
import ghidra.util.table.GhidraProgramTableModel;
|
||||
import ghidra.util.table.actions.DeleteTableRowAction;
|
||||
import ghidra.util.task.SwingUpdateManager;
|
||||
|
||||
//@formatter:off
|
||||
|
@ -62,21 +61,14 @@ public class TableServicePlugin extends ProgramPlugin
|
|||
static final String SHARED_ACTION_OWNER_SUFFIX = " (Tool)";
|
||||
|
||||
private SwingUpdateManager updateMgr;
|
||||
private Map<Program, List<TableComponentProvider<?>>> programMap =
|
||||
new HashMap<Program, List<TableComponentProvider<?>>>();
|
||||
private Map<Program, List<TableComponentProvider<?>>> programMap = new HashMap<>();
|
||||
|
||||
private Map<Program, List<TableChooserDialog>> programToDialogMap =
|
||||
new HashMap<Program, List<TableChooserDialog>>();
|
||||
private Map<Program, List<TableChooserDialog>> programToDialogMap = new HashMap<>();
|
||||
|
||||
public TableServicePlugin(PluginTool tool) {
|
||||
super(tool, false, false);
|
||||
|
||||
updateMgr = new SwingUpdateManager(1000, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
updateProviders();
|
||||
}
|
||||
});
|
||||
updateMgr = new SwingUpdateManager(1000, () -> updateProviders());
|
||||
|
||||
createActions();
|
||||
}
|
||||
|
@ -89,12 +81,6 @@ public class TableServicePlugin extends ProgramPlugin
|
|||
// providers are created, as they would only appear in the options at
|
||||
// that point.
|
||||
//
|
||||
|
||||
DummyKeyBindingsOptionsAction dummyMakeSelectionAction =
|
||||
new DummyKeyBindingsOptionsAction(MAKE_SELECTION_ACTION_NAME, null);
|
||||
|
||||
tool.addAction(dummyMakeSelectionAction);
|
||||
|
||||
DeleteTableRowAction.registerDummy(tool);
|
||||
}
|
||||
|
||||
|
@ -105,9 +91,6 @@ public class TableServicePlugin extends ProgramPlugin
|
|||
super.dispose();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ghidra.framework.plugintool.Plugin#processEvent(ghidra.framework.plugintool.PluginEvent)
|
||||
*/
|
||||
@Override
|
||||
public void processEvent(PluginEvent event) {
|
||||
if (event instanceof ProgramClosedPluginEvent) {
|
||||
|
@ -140,7 +123,7 @@ public class TableServicePlugin extends ProgramPlugin
|
|||
return;
|
||||
}
|
||||
// make a copy of the list because the provider updates the list
|
||||
List<TableComponentProvider<?>> list = new ArrayList<TableComponentProvider<?>>(plist);
|
||||
List<TableComponentProvider<?>> list = new ArrayList<>(plist);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
ComponentProvider provider = list.get(i);
|
||||
provider.closeComponent();
|
||||
|
@ -154,7 +137,7 @@ public class TableServicePlugin extends ProgramPlugin
|
|||
return;
|
||||
}
|
||||
// make a copy of the list because the dialog updates the list
|
||||
List<TableChooserDialog> list = new ArrayList<TableChooserDialog>(dlist);
|
||||
List<TableChooserDialog> list = new ArrayList<>(dlist);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
TableChooserDialog dialog = list.get(i);
|
||||
dialog.close();
|
||||
|
@ -174,9 +157,8 @@ public class TableServicePlugin extends ProgramPlugin
|
|||
|
||||
Program program = model.getProgram();
|
||||
|
||||
TableComponentProvider<T> cp =
|
||||
new TableComponentProvider<T>(this, title, tableTypeName, model,
|
||||
program.getDomainFile().getName(), gotoService, windowSubMenu, navigatable);
|
||||
TableComponentProvider<T> cp = new TableComponentProvider<>(this, title, tableTypeName,
|
||||
model, program.getDomainFile().getName(), gotoService, windowSubMenu, navigatable);
|
||||
addProvider(program, cp);
|
||||
return cp;
|
||||
}
|
||||
|
@ -195,10 +177,9 @@ public class TableServicePlugin extends ProgramPlugin
|
|||
MarkerService markerService = tool.getService(MarkerService.class);
|
||||
Program program = model.getProgram();
|
||||
|
||||
TableComponentProvider<T> cp =
|
||||
new TableComponentProvider<T>(this, title, tableTypeName, model,
|
||||
program.getDomainFile().getName(), gotoService, markerService, markerColor,
|
||||
markerIcon, windowSubMenu, navigatable);
|
||||
TableComponentProvider<T> cp = new TableComponentProvider<>(this, title, tableTypeName,
|
||||
model, program.getDomainFile().getName(), gotoService, markerService, markerColor,
|
||||
markerIcon, windowSubMenu, navigatable);
|
||||
addProvider(program, cp);
|
||||
return cp;
|
||||
}
|
||||
|
@ -206,7 +187,7 @@ public class TableServicePlugin extends ProgramPlugin
|
|||
private void addProvider(Program program, TableComponentProvider<?> provider) {
|
||||
List<TableComponentProvider<?>> list = programMap.get(program);
|
||||
if (list == null) {
|
||||
list = new ArrayList<TableComponentProvider<?>>();
|
||||
list = new ArrayList<>();
|
||||
programMap.put(program, list);
|
||||
}
|
||||
list.add(provider);
|
||||
|
@ -241,7 +222,7 @@ public class TableServicePlugin extends ProgramPlugin
|
|||
}
|
||||
|
||||
private List<TableComponentProvider<?>> getProviders() {
|
||||
List<TableComponentProvider<?>> clist = new ArrayList<TableComponentProvider<?>>();
|
||||
List<TableComponentProvider<?>> clist = new ArrayList<>();
|
||||
Iterator<List<TableComponentProvider<?>>> iter = programMap.values().iterator();
|
||||
while (iter.hasNext()) {
|
||||
List<TableComponentProvider<?>> list = iter.next();
|
||||
|
@ -280,7 +261,7 @@ public class TableServicePlugin extends ProgramPlugin
|
|||
|
||||
List<TableChooserDialog> list = programToDialogMap.get(program);
|
||||
if (list == null) {
|
||||
list = new ArrayList<TableChooserDialog>();
|
||||
list = new ArrayList<>();
|
||||
programToDialogMap.put(program, list);
|
||||
}
|
||||
list.add(dialog);
|
||||
|
|
|
@ -25,12 +25,12 @@ import javax.swing.JButton;
|
|||
import docking.*;
|
||||
import docking.action.DockingAction;
|
||||
import docking.action.MenuData;
|
||||
import docking.actions.SharedStubKeyBindingAction;
|
||||
import docking.help.*;
|
||||
import ghidra.app.DeveloperPluginPackage;
|
||||
import ghidra.app.plugin.PluginCategoryNames;
|
||||
import ghidra.framework.main.FrontEndable;
|
||||
import ghidra.framework.model.Project;
|
||||
import ghidra.framework.options.DummyKeyBindingsOptionsAction;
|
||||
import ghidra.framework.plugintool.*;
|
||||
import ghidra.framework.plugintool.util.PluginStatus;
|
||||
import ghidra.framework.plugintool.util.ToolConstants;
|
||||
|
@ -191,7 +191,7 @@ public class JavaHelpPlugin extends Plugin implements FrontEndable {
|
|||
|
||||
private boolean shouldSkipHelpCheck(DockingAction action) {
|
||||
String actionName = action.getOwner() + " - " + action.getName();
|
||||
if (action instanceof DummyKeyBindingsOptionsAction) {
|
||||
if (action instanceof SharedStubKeyBindingAction) {
|
||||
return true;
|
||||
}
|
||||
if (noHelpActions.contains(actionName)) {
|
||||
|
|
|
@ -93,7 +93,6 @@ public class PropertyManagerProvider extends ComponentProviderAdapter {
|
|||
}
|
||||
|
||||
void dispose() {
|
||||
tool.removeLocalAction(this, deleteAction);
|
||||
tool.removeComponentProvider(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ import docking.widgets.label.GDLabel;
|
|||
* components (usually icon buttons)
|
||||
*/
|
||||
public class TitledPanel extends JPanel {
|
||||
private JLabel title;
|
||||
private JLabel title; // GDLabel or GHtmlLabel
|
||||
private JPanel titlePanel;
|
||||
private JPanel iconPanel;
|
||||
private JComponent bottomComp;
|
||||
|
@ -37,16 +37,27 @@ public class TitledPanel extends JPanel {
|
|||
/**
|
||||
* Creates a new TitlePanel
|
||||
* @param name the name of the panel
|
||||
* @param panel the component to wrap.
|
||||
* @param margin the size of the margin to use.
|
||||
* @param panel the component to wrap
|
||||
* @param margin the size of the margin to use
|
||||
*/
|
||||
public TitledPanel(String name, JComponent panel, int margin) {
|
||||
this(new GDLabel(name), panel, margin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new TitlePanel
|
||||
*
|
||||
* @param titleLabel the title label for the panel; this allow clients to provide HTML-based
|
||||
* title text. Note: it is up to the client to escape this text as needed for safety
|
||||
* @param panel the component to wrap
|
||||
* @param margin the size of the margin to use
|
||||
*/
|
||||
public TitledPanel(JLabel titleLabel, JComponent panel, int margin) {
|
||||
super(new BorderLayout());
|
||||
titlePanel = new JPanel(new BorderLayout());
|
||||
iconPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 4, 1));
|
||||
iconPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
|
||||
title = new GDLabel(name);
|
||||
title.setToolTipText(name);
|
||||
title = titleLabel;
|
||||
JLabel filler = new GDLabel();
|
||||
filler.setPreferredSize(new Dimension(margin, filler.getPreferredSize().height));
|
||||
titlePanel.add(filler, BorderLayout.WEST);
|
||||
|
|
|
@ -15,21 +15,20 @@
|
|||
*/
|
||||
package ghidra.test;
|
||||
|
||||
import java.awt.Window;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import docking.*;
|
||||
import docking.DialogComponentProvider;
|
||||
import docking.action.DockingActionIf;
|
||||
import docking.widgets.fieldpanel.FieldPanel;
|
||||
import docking.widgets.fieldpanel.field.Field;
|
||||
import docking.widgets.fieldpanel.listener.FieldMouseListener;
|
||||
import docking.widgets.fieldpanel.support.FieldLocation;
|
||||
import ghidra.GhidraTestApplicationLayout;
|
||||
import ghidra.app.plugin.core.analysis.AutoAnalysisManager;
|
||||
import ghidra.app.plugin.core.codebrowser.CodeBrowserPlugin;
|
||||
import ghidra.framework.ApplicationConfiguration;
|
||||
import ghidra.framework.GhidraApplicationConfiguration;
|
||||
|
@ -41,10 +40,10 @@ import ghidra.program.model.listing.Program;
|
|||
import ghidra.util.TaskUtilities;
|
||||
import ghidra.util.exception.AssertException;
|
||||
import junit.framework.AssertionFailedError;
|
||||
import util.CollectionUtils;
|
||||
import utility.application.ApplicationLayout;
|
||||
|
||||
public abstract class AbstractGhidraHeadedIntegrationTest extends AbstractGhidraHeadlessIntegrationTest {
|
||||
public abstract class AbstractGhidraHeadedIntegrationTest
|
||||
extends AbstractGhidraHeadlessIntegrationTest {
|
||||
|
||||
public AbstractGhidraHeadedIntegrationTest() {
|
||||
super();
|
||||
|
@ -113,42 +112,6 @@ public abstract class AbstractGhidraHeadedIntegrationTest extends AbstractGhidra
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the action by the given owner name and action name.
|
||||
* If you do not know the owner name, then use
|
||||
* the call {@link #getActions(DockingTool, String)} instead.
|
||||
*
|
||||
* <P>Note: more specific test case subclasses provide other methods for finding actions
|
||||
* when you have an owner name (which is usually the plugin name).
|
||||
*
|
||||
* @param tool the tool containing all system actions
|
||||
* @param name the name to match
|
||||
* @return the matching action; null if no matching action can be found
|
||||
*/
|
||||
public static DockingActionIf getAction(DockingTool tool, String owner, String name) {
|
||||
String fullName = name + " (" + owner + ")";
|
||||
List<DockingActionIf> actions = tool.getDockingActionsByFullActionName(fullName);
|
||||
if (actions.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (actions.size() > 1) {
|
||||
// This shouldn't happen
|
||||
throw new AssertionFailedError(
|
||||
"Found more than one action for name '" + fullName + "'");
|
||||
}
|
||||
|
||||
return CollectionUtils.any(actions);
|
||||
}
|
||||
|
||||
public static DockingActionIf getAction(Plugin plugin, String actionName) {
|
||||
return getAction(plugin.getTool(), plugin.getName(), actionName);
|
||||
}
|
||||
|
||||
public static DockingActionIf getLocalAction(ComponentProvider provider, String actionName) {
|
||||
return getAction(provider.getTool(), provider.getName(), actionName);
|
||||
}
|
||||
|
||||
public static PluginTool showTool(final PluginTool tool) {
|
||||
runSwing(() -> {
|
||||
boolean wasErrorGUIEnabled = isUseErrorGUI();
|
||||
|
@ -162,9 +125,7 @@ public abstract class AbstractGhidraHeadedIntegrationTest extends AbstractGhidra
|
|||
|
||||
/**
|
||||
* Shows the given DialogComponentProvider using the given tool's
|
||||
* {@link PluginTool#showDialog(DialogComponentProvider)} method. After calling show on a
|
||||
* new thread the method will then wait for the dialog to be shown by calling
|
||||
* {@link TestEnv#waitForDialogComponent(Window, Class, int)}.
|
||||
* {@link PluginTool#showDialog(DialogComponentProvider)} method.
|
||||
*
|
||||
* @param tool The tool used to show the given provider.
|
||||
* @param provider The DialogComponentProvider to show.
|
||||
|
@ -206,22 +167,8 @@ public abstract class AbstractGhidraHeadedIntegrationTest extends AbstractGhidra
|
|||
waitForSwing();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #waitForBusyTool(PluginTool)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public static void waitForAnalysis() {
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<Program, AutoAnalysisManager> programToManagersMap =
|
||||
(Map<Program, AutoAnalysisManager>) getInstanceField("managerMap",
|
||||
AutoAnalysisManager.class);
|
||||
|
||||
Collection<AutoAnalysisManager> managers = programToManagersMap.values();
|
||||
for (AutoAnalysisManager manager : managers) {
|
||||
while (manager.isAnalyzing()) {
|
||||
sleep(DEFAULT_WAIT_DELAY);
|
||||
}
|
||||
}
|
||||
public static DockingActionIf getAction(Plugin plugin, String actionName) {
|
||||
return getAction(plugin.getTool(), plugin.getName(), actionName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -230,6 +177,7 @@ public abstract class AbstractGhidraHeadedIntegrationTest extends AbstractGhidra
|
|||
*
|
||||
* @param project The project which with the tool is associated.
|
||||
* @param tool The tool to be saved
|
||||
* @return the new tool
|
||||
*/
|
||||
public static PluginTool saveTool(final Project project, final PluginTool tool) {
|
||||
AtomicReference<PluginTool> ref = new AtomicReference<>();
|
||||
|
|
|
@ -225,6 +225,10 @@ public class TestEnv {
|
|||
}
|
||||
|
||||
public void closeTool(PluginTool toolToClose, boolean ignoreChanges) {
|
||||
if (toolToClose == tool) {
|
||||
tool = null;
|
||||
}
|
||||
|
||||
extraTools.remove(toolToClose);
|
||||
AbstractGenericTest.executeOnSwingWithoutBlocking(() -> {
|
||||
if (ignoreChanges) {
|
||||
|
|
|
@ -13,27 +13,24 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package ghidra.util.table;
|
||||
package ghidra.util.table.actions;
|
||||
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.KeyStroke;
|
||||
import javax.swing.table.TableModel;
|
||||
|
||||
import docking.ActionContext;
|
||||
import docking.action.MenuData;
|
||||
import docking.action.ToolBarData;
|
||||
import docking.action.*;
|
||||
import docking.widgets.table.GTable;
|
||||
import docking.widgets.table.RowObjectTableModel;
|
||||
import docking.widgets.table.threaded.ThreadedTableModel;
|
||||
import ghidra.app.actions.AbstractSharedKeybindingAction;
|
||||
import ghidra.app.util.HelpTopics;
|
||||
import ghidra.framework.options.DummyKeyBindingsOptionsAction;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.util.HelpLocation;
|
||||
import ghidra.util.Msg;
|
||||
import ghidra.util.*;
|
||||
import ghidra.util.exception.AssertException;
|
||||
import ghidra.util.timer.GTimer;
|
||||
import resources.ResourceManager;
|
||||
|
@ -52,7 +49,7 @@ import resources.ResourceManager;
|
|||
* this action in the Tool's options so that user's can update keybindings, regardless of whether
|
||||
* they have ever shown one of your transient providers.
|
||||
*/
|
||||
public class DeleteTableRowAction extends AbstractSharedKeybindingAction {
|
||||
public class DeleteTableRowAction extends DockingAction {
|
||||
|
||||
private static final KeyStroke DEFAULT_KEYSTROKE =
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0);
|
||||
|
@ -72,28 +69,33 @@ public class DeleteTableRowAction extends AbstractSharedKeybindingAction {
|
|||
new DummyDeleteAction(tool);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for stubs only.
|
||||
*
|
||||
* @param tool the tool needed to access options
|
||||
*/
|
||||
private DeleteTableRowAction(PluginTool tool) {
|
||||
super(tool, NAME, DummyKeyBindingsOptionsAction.DEFAULT_OWNER, DEFAULT_KEYSTROKE);
|
||||
}
|
||||
|
||||
public DeleteTableRowAction(PluginTool tool, GTable table, String owner) {
|
||||
this(tool, NAME, owner, DEFAULT_KEYSTROKE);
|
||||
public DeleteTableRowAction(GTable table, String owner) {
|
||||
this(NAME, owner, DEFAULT_KEYSTROKE);
|
||||
this.table = table;
|
||||
}
|
||||
|
||||
private DeleteTableRowAction(PluginTool tool, String name, String owner,
|
||||
KeyStroke defaultkeyStroke) {
|
||||
super(tool, name, owner, defaultkeyStroke);
|
||||
|
||||
private DeleteTableRowAction(String name, String owner, KeyStroke defaultkeyStroke) {
|
||||
super(name, owner);
|
||||
|
||||
setDescription("Remove the selected rows from the table");
|
||||
setHelpLocation(new HelpLocation(HelpTopics.SEARCH, "Remove_Items"));
|
||||
setToolBarData(new ToolBarData(ICON, null));
|
||||
setPopupMenuData(new MenuData(new String[] { "Remove Items" }, ICON, null));
|
||||
|
||||
initKeyStroke(defaultkeyStroke);
|
||||
}
|
||||
|
||||
private void initKeyStroke(KeyStroke keyStroke) {
|
||||
if (keyStroke == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
setKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean usesSharedKeyBinding() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -122,7 +124,7 @@ public class DeleteTableRowAction extends AbstractSharedKeybindingAction {
|
|||
@SuppressWarnings("unchecked")
|
||||
RowObjectTableModel<Object> rowObjectModel = (RowObjectTableModel<Object>) model;
|
||||
int[] rows = table.getSelectedRows();
|
||||
List<Object> itemsToRemove = new ArrayList<Object>();
|
||||
List<Object> itemsToRemove = new ArrayList<>();
|
||||
for (int row : rows) {
|
||||
itemsToRemove.add(rowObjectModel.getRowObject(row));
|
||||
}
|
||||
|
@ -163,7 +165,7 @@ public class DeleteTableRowAction extends AbstractSharedKeybindingAction {
|
|||
}
|
||||
|
||||
private void selectRow(TableModel model, final int row) {
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
Swing.runLater(() -> {
|
||||
|
||||
if (checkForBusy(model)) {
|
||||
// Selecting rows whilst the model is processing deletes will cause the
|
||||
|
@ -195,13 +197,20 @@ public class DeleteTableRowAction extends AbstractSharedKeybindingAction {
|
|||
//==================================================================================================
|
||||
|
||||
private static class DummyDeleteAction extends DeleteTableRowAction {
|
||||
DummyDeleteAction(PluginTool tool) {
|
||||
super(tool);
|
||||
|
||||
public DummyDeleteAction(PluginTool tool) {
|
||||
super(NAME, "Tool", DEFAULT_KEYSTROKE);
|
||||
tool.addAction(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionContext context) {
|
||||
// stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabledForContext(ActionContext context) {
|
||||
return false; // stub
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
/* ###
|
||||
* 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.util.table.actions;
|
||||
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
import docking.ActionContext;
|
||||
import docking.action.*;
|
||||
import ghidra.util.HelpLocation;
|
||||
import resources.Icons;
|
||||
|
||||
/**
|
||||
* An action to make a program selection based on the given table's selection. The clients
|
||||
* must implement the make selection code, as they know their own data. Also, for the context to
|
||||
* work, the provider using this action must create an {@link ActionContext} that returns a
|
||||
* context object that is the table passed to this action's constructor.
|
||||
*/
|
||||
public abstract class MakeProgramSelectionAction extends DockingAction {
|
||||
|
||||
private JTable table;
|
||||
|
||||
public MakeProgramSelectionAction(String owner, JTable table) {
|
||||
super("Make Selection", owner);
|
||||
this.table = table;
|
||||
|
||||
setPopupMenuData(
|
||||
new MenuData(new String[] { "Make Selection" }, Icons.MAKE_SELECTION_ICON));
|
||||
setToolBarData(new ToolBarData(Icons.MAKE_SELECTION_ICON));
|
||||
setDescription("Make a program selection from the seleted rows");
|
||||
|
||||
// this help location provides generic help; clients can override to point to their help
|
||||
setHelpLocation(new HelpLocation("Search", "Make_Selection"));
|
||||
|
||||
// null for now, but we may want a default binding in the future
|
||||
initKeyStroke(null);
|
||||
}
|
||||
|
||||
private void initKeyStroke(KeyStroke keyStroke) {
|
||||
if (keyStroke == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
setKeyBindingData(new KeyBindingData(keyStroke));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean usesSharedKeyBinding() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAddToPopup(ActionContext context) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabledForContext(ActionContext context) {
|
||||
|
||||
Object contextObject = context.getContextObject();
|
||||
if (contextObject != table) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int n = table.getSelectedRowCount();
|
||||
return n > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionContext context) {
|
||||
makeSelection(context);
|
||||
}
|
||||
|
||||
protected abstract void makeSelection(ActionContext context);
|
||||
}
|
|
@ -212,9 +212,8 @@ public abstract class AbstractScreenShotGenerator extends AbstractGhidraHeadedIn
|
|||
|
||||
public void performAction(String actionName, String owner, ComponentProvider contextProvider,
|
||||
boolean wait) {
|
||||
String fullActionName = actionName + " (" + owner + ")";
|
||||
List<DockingActionIf> action = tool.getDockingActionsByFullActionName(fullActionName);
|
||||
performAction(action.get(0), contextProvider, wait);
|
||||
DockingActionIf action = getAction(tool, owner, actionName);
|
||||
performAction(action, contextProvider, wait);
|
||||
}
|
||||
|
||||
public void showOptions(final String optionsCategoryName) {
|
||||
|
|
|
@ -359,12 +359,11 @@ public abstract class GhidraScreenShotGenerator extends AbstractScreenShotGenera
|
|||
}
|
||||
|
||||
public void performFrontEndAction(String actionName, String owner, boolean wait) {
|
||||
String fullActionName = actionName + " (" + owner + ")";
|
||||
FrontEndTool frontEnd = getFrontEndTool();
|
||||
List<DockingActionIf> action = frontEnd.getDockingActionsByFullActionName(fullActionName);
|
||||
|
||||
DockingActionIf action = getAction(frontEnd, owner, actionName);
|
||||
ComponentProvider compProvider =
|
||||
(ComponentProvider) getInstanceField("compProvider", frontEnd);
|
||||
performAction(action.get(0), compProvider, wait);
|
||||
performAction(action, compProvider, wait);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Before Width: | Height: | Size: 209 B |
|
@ -186,8 +186,8 @@ public class KeyEntryDialogTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
|
||||
public DockingAction getKeyBindingAction() {
|
||||
DockingWindowManager dwm = DockingWindowManager.getInstance(tool.getToolFrame());
|
||||
DockingActionManager dockingActionManager =
|
||||
(DockingActionManager) getInstanceField("actionManager", dwm);
|
||||
ActionToGuiMapper dockingActionManager =
|
||||
(ActionToGuiMapper) getInstanceField("actionManager", dwm);
|
||||
return (DockingAction) getInstanceField("keyBindingsAction", dockingActionManager);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ package ghidra.app.plugin.core.algorithmtree;
|
|||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.junit.*;
|
||||
|
||||
|
@ -33,6 +33,7 @@ import ghidra.program.model.listing.Program;
|
|||
import ghidra.program.model.listing.ProgramModule;
|
||||
import ghidra.program.util.GroupPath;
|
||||
import ghidra.test.*;
|
||||
import util.CollectionUtils;
|
||||
|
||||
/**
|
||||
* Test the module algorithm plugin gui elements.
|
||||
|
@ -43,7 +44,7 @@ public class ModuleAlgorithmPluginTest extends AbstractGhidraHeadedIntegrationTe
|
|||
private PluginTool tool;
|
||||
private Program program;
|
||||
private ModuleAlgorithmPlugin plugin;
|
||||
private List<DockingActionIf> actions;
|
||||
private Set<DockingActionIf> actions;
|
||||
private ProgramTreeService service;
|
||||
private Object context;
|
||||
|
||||
|
@ -58,7 +59,7 @@ public class ModuleAlgorithmPluginTest extends AbstractGhidraHeadedIntegrationTe
|
|||
tool.addPlugin(ProgramTreePlugin.class.getName());
|
||||
tool.addPlugin(ModuleAlgorithmPlugin.class.getName());
|
||||
plugin = env.getPlugin(ModuleAlgorithmPlugin.class);
|
||||
actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
actions = getActionsByOwner(tool, plugin.getName());
|
||||
service = tool.getService(ProgramTreeService.class);
|
||||
|
||||
}
|
||||
|
@ -98,7 +99,7 @@ public class ModuleAlgorithmPluginTest extends AbstractGhidraHeadedIntegrationTe
|
|||
|
||||
getContextObject(vps);
|
||||
|
||||
performAction(actions.get(0), new ActionContext(null, context), true);
|
||||
performAction(CollectionUtils.any(actions), new ActionContext(null, context), true);
|
||||
|
||||
waitForTasks();
|
||||
program.flushEvents();
|
||||
|
|
|
@ -1090,10 +1090,9 @@ public class CallTreePluginTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
private DockingActionIf getAction(String actionName) {
|
||||
// make sure there is a provider from which to get actions
|
||||
getProvider();
|
||||
String fullActionName = actionName + " (CallTreePlugin)";
|
||||
List<DockingActionIf> actions = tool.getDockingActionsByFullActionName(fullActionName);
|
||||
Assert.assertTrue("Could not find action: " + fullActionName, actions.size() > 0);
|
||||
return actions.get(0);
|
||||
|
||||
DockingActionIf action = getAction(tool, "CallTreePlugin", actionName);
|
||||
return action;
|
||||
}
|
||||
|
||||
private void myWaitForTree(GTree gTree, CallTreeProvider treeProvider) {
|
||||
|
|
|
@ -165,7 +165,7 @@ public abstract class AbstractDataActionTest extends AbstractGhidraHeadedIntegra
|
|||
builtInDataTypesManager.setFavorite(root.getDataType("word"), true);
|
||||
}
|
||||
|
||||
protected void checkActions(List<DockingActionIf> actions, boolean enabled, String caseStr) {
|
||||
protected void checkActions(Set<DockingActionIf> actions, boolean enabled, String caseStr) {
|
||||
checkAction(actions, CREATE_STRUCTURE, enabled, caseStr);
|
||||
checkAction(actions, EDIT_DATA_TYPE, enabled, caseStr);
|
||||
checkAction(actions, CREATE_ARRAY, enabled, caseStr);
|
||||
|
@ -1063,7 +1063,7 @@ public abstract class AbstractDataActionTest extends AbstractGhidraHeadedIntegra
|
|||
ProgramSelection sel = getCurrentSelection();
|
||||
boolean useSelection = (sel != null && !sel.isEmpty());
|
||||
|
||||
List<DockingActionIf> actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
Set<DockingActionIf> actions = getActionsByOwner(tool, plugin.getName());
|
||||
|
||||
for (DockingActionIf element : actions) {
|
||||
MenuData menuBarData = element.getMenuBarData();
|
||||
|
@ -1113,31 +1113,6 @@ public abstract class AbstractDataActionTest extends AbstractGhidraHeadedIntegra
|
|||
}
|
||||
}
|
||||
|
||||
// if (useSelection) {
|
||||
//
|
||||
// checkAction(actions, CREATE_STRUCTURE, true, caseName);
|
||||
// checkAction(actions, EDIT_STRUCTURE, false, caseName);
|
||||
// checkAction(actions, CREATE_ARRAY, true, caseName);
|
||||
// checkAction(actions, DEFAULT_DATA_SETTINGS, false, caseName);
|
||||
// checkAction(actions, DATA_SETTINGS, false, caseName);
|
||||
// checkAction(actions, CYCLE_FLOAT_DOUBLE, true, caseName);
|
||||
// checkAction(actions, CYCLE_BYTE_WORD_DWORD_QWORD, true, caseName);
|
||||
// checkAction(actions, CYCLE_CHAR_STRING_UNICODE, true, caseName);
|
||||
// checkAction(actions, DEFINE_BYTE, true, caseName);
|
||||
// checkAction(actions, DEFINE_WORD, true, caseName);
|
||||
// checkAction(actions, DEFINE_DWORD, true, caseName);
|
||||
// checkAction(actions, DEFINE_QWORD, true, caseName);
|
||||
// checkAction(actions, DEFINE_FLOAT, true, caseName);
|
||||
// checkAction(actions, DEFINE_DOUBLE, true, caseName);
|
||||
// checkAction(actions, DEFINE_TERM_CSTRING, true, caseName);
|
||||
// checkAction(actions, DEFINE_POINTER, true, caseName);
|
||||
//
|
||||
// PluginAction recentlyUsedAction = getAction(RECENTLY_USED);
|
||||
// if (recentlyUsedAction != null) {
|
||||
// checkAction(recentlyUsedAction, false, caseName);
|
||||
// }
|
||||
// return;
|
||||
// }
|
||||
if (data != null) {
|
||||
|
||||
DataType dt = data.getDataType();
|
||||
|
@ -1184,10 +1159,10 @@ public abstract class AbstractDataActionTest extends AbstractGhidraHeadedIntegra
|
|||
|
||||
}
|
||||
|
||||
protected void checkOnUndefined(List<DockingActionIf> actions) {
|
||||
protected void checkOnUndefined(Set<DockingActionIf> actions) {
|
||||
|
||||
if (actions == null) {
|
||||
actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
actions = getActionsByOwner(tool, plugin.getName());
|
||||
}
|
||||
|
||||
Data data = getContextData();
|
||||
|
@ -1223,10 +1198,10 @@ public abstract class AbstractDataActionTest extends AbstractGhidraHeadedIntegra
|
|||
|
||||
}
|
||||
|
||||
protected void checkOnDefined(List<DockingActionIf> actions, Class<?> expectedDataType) {
|
||||
protected void checkOnDefined(Set<DockingActionIf> actions, Class<?> expectedDataType) {
|
||||
|
||||
if (actions == null) {
|
||||
actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
actions = getActionsByOwner(tool, plugin.getName());
|
||||
}
|
||||
|
||||
String dtName = expectedDataType.getName();
|
||||
|
@ -1287,10 +1262,10 @@ public abstract class AbstractDataActionTest extends AbstractGhidraHeadedIntegra
|
|||
checkAction(actions, DEFINE_POINTER, true, caseName);
|
||||
}
|
||||
|
||||
protected void checkOnArray(List<DockingActionIf> actions, DataType interiorDt, int arraySize) {
|
||||
protected void checkOnArray(Set<DockingActionIf> actions, DataType interiorDt, int arraySize) {
|
||||
|
||||
if (actions == null) {
|
||||
actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
actions = getActionsByOwner(tool, plugin.getName());
|
||||
}
|
||||
|
||||
Data d = getContextData();
|
||||
|
@ -1356,10 +1331,10 @@ public abstract class AbstractDataActionTest extends AbstractGhidraHeadedIntegra
|
|||
* @param actions
|
||||
* @param structSize structure size or -1 to disable size check
|
||||
*/
|
||||
protected void checkOnStructure(List<DockingActionIf> actions, int structSize) {
|
||||
protected void checkOnStructure(Set<DockingActionIf> actions, int structSize) {
|
||||
|
||||
if (actions == null) {
|
||||
actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
actions = getActionsByOwner(tool, plugin.getName());
|
||||
}
|
||||
|
||||
Data d = getContextData();
|
||||
|
@ -1400,7 +1375,7 @@ public abstract class AbstractDataActionTest extends AbstractGhidraHeadedIntegra
|
|||
}
|
||||
|
||||
protected DockingActionIf getAction(String name) {
|
||||
List<DockingActionIf> actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
Set<DockingActionIf> actions = getActionsByOwner(tool, plugin.getName());
|
||||
for (DockingActionIf element : actions) {
|
||||
String actionName = element.getName();
|
||||
int pos = actionName.indexOf(" (");
|
||||
|
@ -1439,7 +1414,7 @@ public abstract class AbstractDataActionTest extends AbstractGhidraHeadedIntegra
|
|||
|
||||
}
|
||||
|
||||
protected void checkAction(List<DockingActionIf> actions, String name, boolean isEnabled,
|
||||
protected void checkAction(Set<DockingActionIf> actions, String name, boolean isEnabled,
|
||||
String caseName) {
|
||||
for (DockingActionIf element : actions) {
|
||||
String actionName = element.getName();
|
||||
|
|
|
@ -17,7 +17,7 @@ package ghidra.app.plugin.core.data;
|
|||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.experimental.categories.Category;
|
||||
|
@ -39,13 +39,13 @@ public class DataAction4Test extends AbstractDataActionTest {
|
|||
@Test
|
||||
public void testNotepadLocations() {
|
||||
|
||||
List<DockingActionIf> actions;
|
||||
Set<DockingActionIf> actions;
|
||||
|
||||
program.addConsumer(this); // allow program to survive close
|
||||
try {
|
||||
closeProgram();
|
||||
|
||||
actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
actions = getActionsByOwner(tool, plugin.getName());
|
||||
assertEquals(ACTION_COUNT, actions.size());
|
||||
checkActions(actions, false, "Start");
|
||||
|
||||
|
@ -60,7 +60,7 @@ public class DataAction4Test extends AbstractDataActionTest {
|
|||
|
||||
closeProgram();
|
||||
|
||||
actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
actions = getActionsByOwner(tool, plugin.getName());
|
||||
assertEquals(ACTION_COUNT, actions.size());
|
||||
checkActions(actions, false, "Start");
|
||||
}
|
||||
|
@ -73,13 +73,13 @@ public class DataAction4Test extends AbstractDataActionTest {
|
|||
|
||||
doAction(DEFINE_BYTE, true);
|
||||
|
||||
List<DockingActionIf> actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
Set<DockingActionIf> actions = getActionsByOwner(tool, plugin.getName());
|
||||
assertEquals(ACTION_COUNT, actions.size());
|
||||
checkOnDefined(actions, ByteDataType.class);
|
||||
|
||||
undo(program);
|
||||
|
||||
actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
actions = getActionsByOwner(tool, plugin.getName());
|
||||
checkOnUndefined(actions);
|
||||
|
||||
gotoLocation(0x010069f2);
|
||||
|
@ -107,7 +107,7 @@ public class DataAction4Test extends AbstractDataActionTest {
|
|||
|
||||
doAction(DEFINE_WORD, true);
|
||||
|
||||
List<DockingActionIf> actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
Set<DockingActionIf> actions = getActionsByOwner(tool, plugin.getName());
|
||||
assertEquals(ACTION_COUNT, actions.size());
|
||||
checkOnDefined(actions, WordDataType.class);
|
||||
|
||||
|
@ -138,7 +138,7 @@ public class DataAction4Test extends AbstractDataActionTest {
|
|||
|
||||
doAction(DEFINE_DWORD, true);
|
||||
|
||||
List<DockingActionIf> actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
Set<DockingActionIf> actions = getActionsByOwner(tool, plugin.getName());
|
||||
assertEquals(ACTION_COUNT, actions.size());
|
||||
checkOnDefined(actions, DWordDataType.class);
|
||||
|
||||
|
@ -169,7 +169,7 @@ public class DataAction4Test extends AbstractDataActionTest {
|
|||
|
||||
doAction(DEFINE_QWORD, true);
|
||||
|
||||
List<DockingActionIf> actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
Set<DockingActionIf> actions = getActionsByOwner(tool, plugin.getName());
|
||||
assertEquals(ACTION_COUNT, actions.size());
|
||||
checkOnDefined(actions, QWordDataType.class);
|
||||
|
||||
|
@ -200,7 +200,7 @@ public class DataAction4Test extends AbstractDataActionTest {
|
|||
|
||||
doAction(DEFINE_FLOAT, true);
|
||||
|
||||
List<DockingActionIf> actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
Set<DockingActionIf> actions = getActionsByOwner(tool, plugin.getName());
|
||||
assertEquals(ACTION_COUNT, actions.size());
|
||||
checkOnDefined(actions, FloatDataType.class);
|
||||
|
||||
|
@ -231,7 +231,7 @@ public class DataAction4Test extends AbstractDataActionTest {
|
|||
|
||||
doAction(DEFINE_DOUBLE, true);
|
||||
|
||||
List<DockingActionIf> actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
Set<DockingActionIf> actions = getActionsByOwner(tool, plugin.getName());
|
||||
assertEquals(ACTION_COUNT, actions.size());
|
||||
checkOnDefined(actions, DoubleDataType.class);
|
||||
|
||||
|
@ -264,7 +264,7 @@ public class DataAction4Test extends AbstractDataActionTest {
|
|||
|
||||
doAction(CYCLE_CHAR_STRING_UNICODE, true);
|
||||
|
||||
List<DockingActionIf> actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
Set<DockingActionIf> actions = getActionsByOwner(tool, plugin.getName());
|
||||
assertEquals(ACTION_COUNT, actions.size());
|
||||
checkOnDefined(actions, CharDataType.class);
|
||||
|
||||
|
@ -283,15 +283,15 @@ public class DataAction4Test extends AbstractDataActionTest {
|
|||
checkOnDefined(actions, CharDataType.class);
|
||||
|
||||
doAction(CYCLE_CHAR_STRING_UNICODE, true);
|
||||
actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
actions = getActionsByOwner(tool, plugin.getName());
|
||||
checkOnDefined(actions, StringDataType.class);
|
||||
|
||||
doAction(CYCLE_CHAR_STRING_UNICODE, true);
|
||||
actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
actions = getActionsByOwner(tool, plugin.getName());
|
||||
checkOnDefined(actions, UnicodeDataType.class);
|
||||
|
||||
doAction(CYCLE_CHAR_STRING_UNICODE, true);
|
||||
actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
actions = getActionsByOwner(tool, plugin.getName());
|
||||
checkOnDefined(actions, CharDataType.class);
|
||||
|
||||
clearLocation(0x01006a00);
|
||||
|
@ -326,7 +326,7 @@ public class DataAction4Test extends AbstractDataActionTest {
|
|||
|
||||
doAction(CYCLE_BYTE_WORD_DWORD_QWORD, true);
|
||||
|
||||
List<DockingActionIf> actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
Set<DockingActionIf> actions = getActionsByOwner(tool, plugin.getName());
|
||||
assertEquals(ACTION_COUNT, actions.size());
|
||||
checkOnDefined(actions, ByteDataType.class);
|
||||
|
||||
|
@ -345,19 +345,19 @@ public class DataAction4Test extends AbstractDataActionTest {
|
|||
checkOnDefined(actions, ByteDataType.class);
|
||||
|
||||
doAction(CYCLE_BYTE_WORD_DWORD_QWORD, true);
|
||||
actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
actions = getActionsByOwner(tool, plugin.getName());
|
||||
checkOnDefined(actions, WordDataType.class);
|
||||
|
||||
doAction(CYCLE_BYTE_WORD_DWORD_QWORD, true);
|
||||
actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
actions = getActionsByOwner(tool, plugin.getName());
|
||||
checkOnDefined(actions, DWordDataType.class);
|
||||
|
||||
doAction(CYCLE_BYTE_WORD_DWORD_QWORD, true);
|
||||
actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
actions = getActionsByOwner(tool, plugin.getName());
|
||||
checkOnDefined(actions, QWordDataType.class);
|
||||
|
||||
doAction(CYCLE_BYTE_WORD_DWORD_QWORD, true);
|
||||
actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
actions = getActionsByOwner(tool, plugin.getName());
|
||||
checkOnDefined(actions, ByteDataType.class);
|
||||
|
||||
clearLocation(0x01006a00);
|
||||
|
@ -387,19 +387,19 @@ public class DataAction4Test extends AbstractDataActionTest {
|
|||
// Test cycle when it does not fit
|
||||
|
||||
gotoLocation(0x010069f0);
|
||||
actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
actions = getActionsByOwner(tool, plugin.getName());
|
||||
checkOnUndefined(actions);
|
||||
|
||||
doAction(CYCLE_BYTE_WORD_DWORD_QWORD, true);
|
||||
actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
actions = getActionsByOwner(tool, plugin.getName());
|
||||
checkOnDefined(actions, ByteDataType.class);
|
||||
|
||||
doAction(CYCLE_BYTE_WORD_DWORD_QWORD, true);
|
||||
actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
actions = getActionsByOwner(tool, plugin.getName());
|
||||
checkOnDefined(actions, WordDataType.class);
|
||||
|
||||
doAction(CYCLE_BYTE_WORD_DWORD_QWORD, true);
|
||||
actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
actions = getActionsByOwner(tool, plugin.getName());
|
||||
checkOnUndefined(actions);
|
||||
|
||||
}
|
||||
|
@ -414,7 +414,7 @@ public class DataAction4Test extends AbstractDataActionTest {
|
|||
|
||||
doAction(CYCLE_FLOAT_DOUBLE, true);
|
||||
|
||||
List<DockingActionIf> actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
Set<DockingActionIf> actions = getActionsByOwner(tool, plugin.getName());
|
||||
assertEquals(ACTION_COUNT, actions.size());
|
||||
checkOnDefined(actions, FloatDataType.class);
|
||||
|
||||
|
@ -433,11 +433,11 @@ public class DataAction4Test extends AbstractDataActionTest {
|
|||
checkOnDefined(actions, FloatDataType.class);
|
||||
|
||||
doAction(CYCLE_FLOAT_DOUBLE, true);
|
||||
actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
actions = getActionsByOwner(tool, plugin.getName());
|
||||
checkOnDefined(actions, DoubleDataType.class);
|
||||
|
||||
doAction(CYCLE_FLOAT_DOUBLE, true);
|
||||
actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
actions = getActionsByOwner(tool, plugin.getName());
|
||||
checkOnDefined(actions, FloatDataType.class);
|
||||
|
||||
clearLocation(0x01006a00);
|
||||
|
@ -461,15 +461,15 @@ public class DataAction4Test extends AbstractDataActionTest {
|
|||
// Test cycle when it does not fit
|
||||
|
||||
gotoLocation(0x010069ee);
|
||||
actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
actions = getActionsByOwner(tool, plugin.getName());
|
||||
checkOnUndefined(actions);
|
||||
|
||||
doAction(CYCLE_FLOAT_DOUBLE, true);
|
||||
actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
actions = getActionsByOwner(tool, plugin.getName());
|
||||
checkOnDefined(actions, FloatDataType.class);
|
||||
|
||||
doAction(CYCLE_FLOAT_DOUBLE, true);
|
||||
actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
actions = getActionsByOwner(tool, plugin.getName());
|
||||
checkOnUndefined(actions);
|
||||
|
||||
}
|
||||
|
@ -495,7 +495,7 @@ public class DataAction4Test extends AbstractDataActionTest {
|
|||
|
||||
waitForPostedSwingRunnables();
|
||||
|
||||
List<DockingActionIf> actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
Set<DockingActionIf> actions = getActionsByOwner(tool, plugin.getName());
|
||||
checkOnArray(actions, null, 0x20);
|
||||
|
||||
// Test action disablement on array element location
|
||||
|
@ -524,7 +524,7 @@ public class DataAction4Test extends AbstractDataActionTest {
|
|||
|
||||
waitForPostedSwingRunnables();
|
||||
|
||||
actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
actions = getActionsByOwner(tool, plugin.getName());
|
||||
checkOnArray(actions, new ByteDataType(), 0x10);
|
||||
|
||||
}
|
||||
|
@ -541,7 +541,7 @@ public class DataAction4Test extends AbstractDataActionTest {
|
|||
|
||||
clearSelection();// Remove selection to allow array check to work
|
||||
|
||||
List<DockingActionIf> actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
Set<DockingActionIf> actions = getActionsByOwner(tool, plugin.getName());
|
||||
checkOnArray(actions, null, 0x20);
|
||||
|
||||
// Create Byte[0x10] array
|
||||
|
@ -555,7 +555,7 @@ public class DataAction4Test extends AbstractDataActionTest {
|
|||
|
||||
clearSelection();// Remove selection to allow array check to work
|
||||
|
||||
actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
actions = getActionsByOwner(tool, plugin.getName());
|
||||
checkOnArray(actions, new ByteDataType(), 0x10);
|
||||
|
||||
}
|
||||
|
@ -565,10 +565,7 @@ public class DataAction4Test extends AbstractDataActionTest {
|
|||
|
||||
gotoLocation(0x01006c00);
|
||||
|
||||
List<DockingActionIf> actions =
|
||||
tool.getDockingActionsByFullActionName(RECENTLY_USED + " (" + plugin.getName() + ")");
|
||||
assertEquals(1, actions.size());
|
||||
DockingActionIf recentlyUsedAction = actions.get(0);
|
||||
DockingActionIf recentlyUsedAction = getAction(tool, plugin.getName(), RECENTLY_USED);
|
||||
String caseName = "On Structure at: " + getCurrentLocation();
|
||||
checkAction(recentlyUsedAction, false, caseName);
|
||||
|
||||
|
@ -591,7 +588,7 @@ public class DataAction4Test extends AbstractDataActionTest {
|
|||
|
||||
clearSelection();
|
||||
|
||||
List<DockingActionIf> actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
Set<DockingActionIf> actions = getActionsByOwner(tool, plugin.getName());
|
||||
checkOnStructure(actions, 0x20);
|
||||
|
||||
gotoLocation(0x01006c00);
|
||||
|
@ -708,14 +705,14 @@ public class DataAction4Test extends AbstractDataActionTest {
|
|||
|
||||
doAction(DEFINE_BYTE, true);
|
||||
|
||||
List<DockingActionIf> actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
Set<DockingActionIf> actions = getActionsByOwner(tool, plugin.getName());
|
||||
checkOnDefined(actions, ByteDataType.class);
|
||||
|
||||
gotoLocation(0x01006a01, new int[] { 1 });
|
||||
|
||||
doAction(DEFINE_FLOAT, true);
|
||||
|
||||
actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
actions = getActionsByOwner(tool, plugin.getName());
|
||||
checkOnDefined(actions, FloatDataType.class);
|
||||
|
||||
Data pdata = getContextData().getParent();
|
||||
|
@ -757,7 +754,7 @@ public class DataAction4Test extends AbstractDataActionTest {
|
|||
|
||||
waitForPostedSwingRunnables();
|
||||
|
||||
List<DockingActionIf> actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
Set<DockingActionIf> actions = getActionsByOwner(tool, plugin.getName());
|
||||
checkOnArray(actions, structDt, 5);
|
||||
|
||||
// Expand structure
|
||||
|
@ -772,14 +769,14 @@ public class DataAction4Test extends AbstractDataActionTest {
|
|||
|
||||
doAction(DEFINE_BYTE, true);
|
||||
|
||||
actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
actions = getActionsByOwner(tool, plugin.getName());
|
||||
checkOnDefined(actions, ByteDataType.class);
|
||||
|
||||
gotoLocation(0x01006a01, new int[] { 0, 1 });
|
||||
|
||||
doAction(DEFINE_FLOAT, true);
|
||||
|
||||
actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
actions = getActionsByOwner(tool, plugin.getName());
|
||||
checkOnDefined(actions, FloatDataType.class);
|
||||
|
||||
Data pdata = getContextData().getParent();
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.junit.*;
|
|||
import docking.DockingUtils;
|
||||
import docking.action.DockingActionIf;
|
||||
import docking.action.ToggleDockingActionIf;
|
||||
import docking.util.KeyBindingUtils;
|
||||
import docking.actions.KeyBindingUtils;
|
||||
import docking.widgets.OptionDialog;
|
||||
import docking.widgets.combobox.GhidraComboBox;
|
||||
import docking.widgets.dialogs.InputWithChoicesDialog;
|
||||
|
|
|
@ -17,7 +17,7 @@ package ghidra.app.plugin.core.equate;
|
|||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.swing.JTextField;
|
||||
|
||||
|
@ -115,11 +115,10 @@ public abstract class AbstractEquatePluginTest extends AbstractProgramBasedTest
|
|||
|
||||
// for selection containing a function stack address
|
||||
builder.setBytes("0x01004bbd", "c2 08 00"); // return of previous function
|
||||
builder.setBytes("0x01004bc0",
|
||||
"53 8b 5c 24 08 56 8b 35 b8 10 00 01 57 ff 35 78 80 00 01 " +
|
||||
"53 ff d6 8b 3d e0 10 00 01 53 ff d7 8d 5c 43 02 68 9c 13 00 01 53 ff d6 53 ff d7 " +
|
||||
"ff 35 7c 80 00 01 8d 5c 43 02 53 ff d6 53 ff d7 8d 5c 43 02 68 e0 17 00 01 53 ff " +
|
||||
"d6 53 ff d7 66 83 64 43 02 00 8d 44 43 02 5f 5e 5b c2 04 00");
|
||||
builder.setBytes("0x01004bc0", "53 8b 5c 24 08 56 8b 35 b8 10 00 01 57 ff 35 78 80 00 01 " +
|
||||
"53 ff d6 8b 3d e0 10 00 01 53 ff d7 8d 5c 43 02 68 9c 13 00 01 53 ff d6 53 ff d7 " +
|
||||
"ff 35 7c 80 00 01 8d 5c 43 02 53 ff d6 53 ff d7 8d 5c 43 02 68 e0 17 00 01 53 ff " +
|
||||
"d6 53 ff d7 66 83 64 43 02 00 8d 44 43 02 5f 5e 5b c2 04 00");
|
||||
builder.disassemble(new AddressSet(builder.getProgram(), builder.addr("0x01004bc0"),
|
||||
builder.addr("0x01004c1a")), true);
|
||||
builder.createFunction("0x01004bc0");
|
||||
|
@ -203,8 +202,6 @@ public abstract class AbstractEquatePluginTest extends AbstractProgramBasedTest
|
|||
env.dispose();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=================================================================================================
|
||||
// Private Methods
|
||||
//=================================================================================================
|
||||
|
@ -218,8 +215,7 @@ public abstract class AbstractEquatePluginTest extends AbstractProgramBasedTest
|
|||
ComponentProvider provider = tool.getComponentProvider(PluginConstants.CODE_BROWSER);
|
||||
DockingActionIf action = getAction(equatePlugin, "Apply Enum");
|
||||
performAction(action, provider, false);
|
||||
ApplyEnumDialog d =
|
||||
waitForDialogComponent(tool.getToolFrame(), ApplyEnumDialog.class, DEFAULT_WAIT_DELAY);
|
||||
ApplyEnumDialog d = waitForDialogComponent(ApplyEnumDialog.class);
|
||||
return d;
|
||||
}
|
||||
|
||||
|
@ -231,7 +227,7 @@ public abstract class AbstractEquatePluginTest extends AbstractProgramBasedTest
|
|||
}
|
||||
|
||||
protected void assertConvertActionsInPopup(boolean inPopup) {
|
||||
List<DockingActionIf> actions = tool.getDockingActionsByOwnerName("EquatePlugin");
|
||||
Set<DockingActionIf> actions = getActionsByOwner(tool, "EquatePlugin");
|
||||
for (DockingActionIf action : actions) {
|
||||
String actionName = action.getName();
|
||||
if (actionName.startsWith("Convert")) {
|
||||
|
@ -242,7 +238,7 @@ public abstract class AbstractEquatePluginTest extends AbstractProgramBasedTest
|
|||
}
|
||||
|
||||
protected void assertNonFloatConvertActionsInPopup() {
|
||||
List<DockingActionIf> actions = tool.getDockingActionsByOwnerName("EquatePlugin");
|
||||
Set<DockingActionIf> actions = getActionsByOwner(tool, "EquatePlugin");
|
||||
for (DockingActionIf action : actions) {
|
||||
String actionName = action.getName();
|
||||
if (actionName.startsWith("Convert")) {
|
||||
|
@ -255,7 +251,7 @@ public abstract class AbstractEquatePluginTest extends AbstractProgramBasedTest
|
|||
}
|
||||
|
||||
protected void assertConvertNonCharNonSignedActionsInPopup() {
|
||||
List<DockingActionIf> actions = tool.getDockingActionsByOwnerName("EquatePlugin");
|
||||
Set<DockingActionIf> actions = getActionsByOwner(tool, "EquatePlugin");
|
||||
for (DockingActionIf element : actions) {
|
||||
String name = element.getName();
|
||||
if (name.startsWith("Convert") &&
|
||||
|
@ -266,7 +262,7 @@ public abstract class AbstractEquatePluginTest extends AbstractProgramBasedTest
|
|||
}
|
||||
|
||||
protected void assertConvertNonSignedActionsInPopup() {
|
||||
List<DockingActionIf> actions = tool.getDockingActionsByOwnerName("EquatePlugin");
|
||||
Set<DockingActionIf> actions = getActionsByOwner(tool, "EquatePlugin");
|
||||
for (DockingActionIf action : actions) {
|
||||
String name = action.getName();
|
||||
if (name.startsWith("Convert") && name.indexOf("Signed") < 0) {
|
||||
|
|
|
@ -19,6 +19,7 @@ import static org.junit.Assert.*;
|
|||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.TableModel;
|
||||
|
@ -841,7 +842,7 @@ public class EquatePlugin1Test extends AbstractEquatePluginTest {
|
|||
|
||||
putCursorOnOperand(0x010064ae, 1);
|
||||
|
||||
List<DockingActionIf> actions = tool.getDockingActionsByOwnerName("EquatePlugin");
|
||||
Set<DockingActionIf> actions = getActionsByOwner(tool, "EquatePlugin");
|
||||
int found = 0;
|
||||
for (DockingActionIf action : actions) {
|
||||
String name = action.getName();
|
||||
|
@ -892,7 +893,7 @@ public class EquatePlugin1Test extends AbstractEquatePluginTest {
|
|||
putCursorOnOperand(0x010064a3, 0);
|
||||
|
||||
int found = 0;
|
||||
List<DockingActionIf> actions = tool.getDockingActionsByOwnerName("EquatePlugin");
|
||||
Set<DockingActionIf> actions = getActionsByOwner(tool, "EquatePlugin");
|
||||
for (DockingActionIf action : actions) {
|
||||
String name = action.getName();
|
||||
if (!name.startsWith("Convert") || !action.isAddToPopup(getListingContext())) {
|
||||
|
@ -944,7 +945,7 @@ public class EquatePlugin1Test extends AbstractEquatePluginTest {
|
|||
putCursorOnOperand(0x01003a94, 0);
|
||||
|
||||
int found = 0;
|
||||
List<DockingActionIf> actions = tool.getDockingActionsByOwnerName("EquatePlugin");
|
||||
Set<DockingActionIf> actions = getActionsByOwner(tool, "EquatePlugin");
|
||||
for (DockingActionIf action : actions) {
|
||||
String name = action.getName();
|
||||
if (!name.startsWith("Convert") || !action.isAddToPopup(getListingContext())) {
|
||||
|
|
|
@ -17,7 +17,7 @@ package ghidra.app.plugin.core.fallthrough;
|
|||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.junit.*;
|
||||
|
||||
|
@ -37,7 +37,8 @@ import ghidra.program.util.ProgramLocation;
|
|||
import ghidra.program.util.ProgramSelection;
|
||||
import ghidra.test.*;
|
||||
|
||||
public class FallThroughActionTest extends AbstractGhidraHeadedIntegrationTest implements LocationCallback {
|
||||
public class FallThroughActionTest extends AbstractGhidraHeadedIntegrationTest
|
||||
implements LocationCallback {
|
||||
private Program program;
|
||||
private TestEnv env;
|
||||
private PluginTool tool;
|
||||
|
@ -70,7 +71,7 @@ public class FallThroughActionTest extends AbstractGhidraHeadedIntegrationTest i
|
|||
|
||||
@Test
|
||||
public void testNotepadLocations() {
|
||||
List<DockingActionIf> actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
Set<DockingActionIf> actions = getActionsByOwner(tool, plugin.getName());
|
||||
checkAction(actions, AUTO_OVERRIDE, false, "Start");
|
||||
checkAction(actions, CLEAR_FALLTHROUGH, false, "Start");
|
||||
|
||||
|
@ -96,7 +97,7 @@ public class FallThroughActionTest extends AbstractGhidraHeadedIntegrationTest i
|
|||
new ProgramSelectionPluginEvent("Test", selection, program);
|
||||
tool.firePluginEvent(ev);
|
||||
|
||||
List<DockingActionIf> actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
Set<DockingActionIf> actions = getActionsByOwner(tool, plugin.getName());
|
||||
checkAction(actions, AUTO_OVERRIDE, true, "selection");
|
||||
checkAction(actions, CLEAR_FALLTHROUGH, true, "selection");
|
||||
|
||||
|
@ -110,7 +111,7 @@ public class FallThroughActionTest extends AbstractGhidraHeadedIntegrationTest i
|
|||
@Override
|
||||
public void locationGenerated(ProgramLocation loc) {
|
||||
tool.firePluginEvent(new ProgramLocationPluginEvent("test", loc, program));
|
||||
List<DockingActionIf> actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
Set<DockingActionIf> actions = getActionsByOwner(tool, plugin.getName());
|
||||
|
||||
ListingActionContext actionContext =
|
||||
(ListingActionContext) cb.getProvider().getActionContext(null);
|
||||
|
@ -126,7 +127,7 @@ public class FallThroughActionTest extends AbstractGhidraHeadedIntegrationTest i
|
|||
|
||||
}
|
||||
|
||||
private void checkAction(List<DockingActionIf> actions, String name, boolean isValidContext,
|
||||
private void checkAction(Set<DockingActionIf> actions, String name, boolean isValidContext,
|
||||
String caseName) {
|
||||
for (DockingActionIf action : actions) {
|
||||
String actionName = action.getName();
|
||||
|
|
|
@ -19,7 +19,7 @@ import static org.junit.Assert.*;
|
|||
|
||||
import java.awt.*;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.JTextField;
|
||||
|
@ -96,7 +96,7 @@ public class MemoryMapPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
env.close(program);
|
||||
program = buildProgram("sdk");
|
||||
env.open(program);
|
||||
List<DockingActionIf> actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
Set<DockingActionIf> actions = getActionsByOwner(tool, plugin.getName());
|
||||
for (DockingActionIf action : actions) {
|
||||
if (action.getName().equals("Add Block") || action.getName().equals("Set Image Base") ||
|
||||
action.getName().equals("View Memory Map")) {
|
||||
|
@ -114,7 +114,7 @@ public class MemoryMapPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
env.close(program);
|
||||
JTable table = provider.getTable();
|
||||
assertEquals(0, table.getModel().getRowCount());
|
||||
List<DockingActionIf> actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
Set<DockingActionIf> actions = getActionsByOwner(tool, plugin.getName());
|
||||
for (DockingActionIf action : actions) {
|
||||
if (!action.getName().equals("View Memory Map")) {
|
||||
assertTrue(!action.isEnabledForContext(provider.getActionContext(null)));
|
||||
|
|
|
@ -19,7 +19,6 @@ import static org.junit.Assert.*;
|
|||
|
||||
import java.awt.*;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.JTableHeader;
|
||||
|
@ -117,7 +116,7 @@ public class MemoryMapProvider1Test extends AbstractGhidraHeadedIntegrationTest
|
|||
// select first row
|
||||
// all actions except "merge" should be enabled
|
||||
table.addRowSelectionInterval(0, 0);
|
||||
List<DockingActionIf> actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
Set<DockingActionIf> actions = getActionsByOwner(tool, plugin.getName());
|
||||
for (DockingActionIf action : actions) {
|
||||
if (action.getName().equals("Merge Blocks")) {
|
||||
assertTrue(!action.isEnabled());
|
||||
|
@ -133,7 +132,7 @@ public class MemoryMapProvider1Test extends AbstractGhidraHeadedIntegrationTest
|
|||
|
||||
table.addRowSelectionInterval(0, 1);
|
||||
assertEquals(2, table.getSelectedRowCount());
|
||||
List<DockingActionIf> actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
Set<DockingActionIf> actions = getActionsByOwner(tool, plugin.getName());
|
||||
for (DockingActionIf action : actions) {
|
||||
String name = action.getName();
|
||||
if (name.equals("Add Block") || name.equals("Merge Blocks") ||
|
||||
|
|
|
@ -18,8 +18,7 @@ package ghidra.app.plugin.core.module;
|
|||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
import org.junit.*;
|
||||
|
||||
|
@ -42,7 +41,7 @@ public class ModuleSortPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
private PluginTool tool;
|
||||
private Program program;
|
||||
private ModuleSortPlugin plugin;
|
||||
private List<DockingActionIf> actions;
|
||||
private Set<DockingActionIf> actions;
|
||||
private ProgramTreeService service;
|
||||
|
||||
public ModuleSortPluginTest() {
|
||||
|
@ -63,7 +62,7 @@ public class ModuleSortPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
break;
|
||||
}
|
||||
}
|
||||
actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
actions = getActionsByOwner(tool, plugin.getName());
|
||||
service = tool.getService(ProgramTreeService.class);
|
||||
|
||||
ProgramBuilder builder = new ProgramBuilder("notepad", ProgramBuilder._TOY);
|
||||
|
|
|
@ -17,8 +17,7 @@ package ghidra.app.plugin.core.navigation;
|
|||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
|
@ -65,7 +64,7 @@ import ghidra.util.Msg;
|
|||
import ghidra.util.table.GhidraProgramTableModel;
|
||||
import ghidra.util.table.field.LabelTableColumn;
|
||||
import ghidra.util.task.TaskMonitor;
|
||||
import ghidra.util.task.TaskMonitorAdapter;
|
||||
import util.CollectionUtils;
|
||||
|
||||
public class GoToPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
||||
private TestEnv env;
|
||||
|
@ -104,20 +103,20 @@ public class GoToPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
|
||||
@Test
|
||||
public void testActionEnablement() throws Exception {
|
||||
List<DockingActionIf> actions = tool.getDockingActionsByOwnerName(plugin.getName());
|
||||
Set<DockingActionIf> actions = getActionsByOwner(tool, plugin.getName());
|
||||
assertEquals(1, actions.size());
|
||||
assertEquals("Go To Address/Label", actions.get(0).getName());
|
||||
assertEquals("Go To Address/Label", CollectionUtils.any(actions).getName());
|
||||
ActionContext actionContext = getActionContext();
|
||||
assertTrue(!actions.get(0).isEnabledForContext(actionContext));
|
||||
assertTrue(!CollectionUtils.any(actions).isEnabledForContext(actionContext));
|
||||
|
||||
loadProgram("x86");
|
||||
|
||||
actionContext = getActionContext();
|
||||
assertTrue(actions.get(0).isEnabledForContext(actionContext));
|
||||
assertTrue(CollectionUtils.any(actions).isEnabledForContext(actionContext));
|
||||
final ProgramManager pm = tool.getService(ProgramManager.class);
|
||||
SwingUtilities.invokeAndWait(() -> pm.closeProgram(program, true));
|
||||
runSwing(() -> pm.closeProgram(program, true));
|
||||
actionContext = getActionContext();
|
||||
assertTrue(!actions.get(0).isEnabledForContext(actionContext));
|
||||
assertTrue(!CollectionUtils.any(actions).isEnabledForContext(actionContext));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -476,7 +475,7 @@ public class GoToPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
performOkCallback();
|
||||
|
||||
assertEquals("No results for xyzabc*", dialog.getStatusText());
|
||||
SwingUtilities.invokeAndWait(() -> dialog.close());
|
||||
runSwing(() -> dialog.close());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -561,7 +560,7 @@ public class GoToPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
program.endTransaction(transactionID, true);
|
||||
final JCheckBox cb = findComponent(dialog, JCheckBox.class);
|
||||
|
||||
SwingUtilities.invokeAndWait(() -> {
|
||||
runSwing(() -> {
|
||||
cb.setSelected(false);
|
||||
dialog.setText("COm*");
|
||||
|
||||
|
@ -831,7 +830,7 @@ public class GoToPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
Assert.assertNotNull(program);
|
||||
|
||||
final ProgramManager pm = tool.getService(ProgramManager.class);
|
||||
SwingUtilities.invokeAndWait(() -> pm.openProgram(program.getDomainFile()));
|
||||
runSwing(() -> pm.openProgram(program.getDomainFile()));
|
||||
program.release(this);
|
||||
addrFactory = program.getAddressFactory();
|
||||
}
|
||||
|
@ -965,7 +964,7 @@ public class GoToPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
try {
|
||||
Memory memory = program.getMemory();
|
||||
return memory.createInitializedBlock(name, addr(address), size, (byte) 0,
|
||||
TaskMonitorAdapter.DUMMY_MONITOR, true);
|
||||
TaskMonitor.DUMMY, true);
|
||||
}
|
||||
finally {
|
||||
program.endTransaction(transactionID, true);
|
||||
|
@ -1023,7 +1022,7 @@ public class GoToPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
}
|
||||
|
||||
private void setText(final String text) throws Exception {
|
||||
SwingUtilities.invokeAndWait(() -> dialog.setText(text));
|
||||
runSwing(() -> dialog.setText(text));
|
||||
}
|
||||
|
||||
private void performOkCallback() throws Exception {
|
||||
|
@ -1035,17 +1034,7 @@ public class GoToPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
}
|
||||
|
||||
private void waitForOKCallback() {
|
||||
int numWaits = 0;
|
||||
while (++numWaits < 50 && !okButton.isEnabled()) {
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
// no biggie, will try again
|
||||
}
|
||||
}
|
||||
|
||||
Assert.assertNotEquals("Timed-out waiting for Go To dialog to finish", 50, numWaits);
|
||||
waitForCondition(() -> runSwing(() -> okButton.isEnabled()));
|
||||
}
|
||||
|
||||
private void assumeCurrentAddressSpace(boolean b) {
|
||||
|
|
|
@ -20,8 +20,7 @@ import static org.junit.Assert.*;
|
|||
import java.awt.Window;
|
||||
import java.io.*;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
@ -60,6 +59,7 @@ import ghidra.util.exception.CancelledException;
|
|||
import ghidra.util.table.GhidraTable;
|
||||
import ghidra.util.table.GhidraTableFilterPanel;
|
||||
import ghidra.util.task.*;
|
||||
import util.CollectionUtils;
|
||||
import utilities.util.FileUtilities;
|
||||
|
||||
public abstract class AbstractGhidraScriptMgrPluginTest
|
||||
|
@ -272,10 +272,18 @@ public abstract class AbstractGhidraScriptMgrPluginTest
|
|||
assertTrue(message, fullText.contains(piece));
|
||||
}
|
||||
|
||||
protected void assertRunLastActionEnabled(boolean enabled) {
|
||||
final DockingActionIf runLastAction = getAction(plugin, "Rerun Last Script");
|
||||
assertNotNull(runLastAction);
|
||||
private DockingActionIf getRunLastScriptAction() {
|
||||
// note: this provider adds 2 versions of the same action--pick either
|
||||
Set<DockingActionIf> actions =
|
||||
getActionsByOwnerAndName(plugin.getTool(), plugin.getName(), "Rerun Last Script");
|
||||
assertFalse(actions.isEmpty());
|
||||
DockingActionIf runLastAction = CollectionUtils.any(actions);
|
||||
return runLastAction;
|
||||
}
|
||||
|
||||
protected void assertRunLastActionEnabled(boolean enabled) {
|
||||
|
||||
DockingActionIf runLastAction = getRunLastScriptAction();
|
||||
final AtomicReference<Boolean> ref = new AtomicReference<>();
|
||||
runSwing(() -> ref.set(runLastAction.isEnabledForContext(new ActionContext())));
|
||||
assertEquals("Run Last Action not enabled as expected", enabled, ref.get());
|
||||
|
@ -557,17 +565,15 @@ public abstract class AbstractGhidraScriptMgrPluginTest
|
|||
}
|
||||
|
||||
protected void pressRunLastScriptButton() {
|
||||
DockingActionIf action =
|
||||
getAction(plugin, GhidraScriptActionManager.RERUN_LAST_SHARED_ACTION_NAME);
|
||||
performAction(action, false);
|
||||
DockingActionIf runLastAction = getRunLastScriptAction();
|
||||
performAction(runLastAction, false);
|
||||
waitForSwing();
|
||||
}
|
||||
|
||||
protected void performGlobalRunLastScriptAction() {
|
||||
DockingActionIf action =
|
||||
getAction(plugin, GhidraScriptActionManager.GLOBAL_RERUN_LAST_SHARED_ACTION_NAME);
|
||||
performAction(action, false);
|
||||
waitForSwing();
|
||||
// note: this action used to be different from the 'run last script'; currently they are
|
||||
// the same
|
||||
pressRunLastScriptButton();
|
||||
}
|
||||
|
||||
protected KeyBindingInputDialog pressKeyBindingAction() {
|
||||
|
@ -1293,7 +1299,7 @@ public abstract class AbstractGhidraScriptMgrPluginTest
|
|||
protected void assertToolKeyBinding(KeyStroke ks) {
|
||||
String actionOwner = GhidraScriptMgrPlugin.class.getSimpleName();
|
||||
PluginTool tool = env.getTool();
|
||||
List<DockingActionIf> actions = tool.getDockingActionsByOwnerName(actionOwner);
|
||||
Set<DockingActionIf> actions = getActionsByOwner(tool, actionOwner);
|
||||
for (DockingActionIf action : actions) {
|
||||
KeyStroke keyBinding = action.getKeyBinding();
|
||||
if (keyBinding == null) {
|
||||
|
|
|
@ -684,8 +684,8 @@ public class SearchTextPlugin1Test extends AbstractGhidraHeadedIntegrationTest {
|
|||
final GTable table = threadedTablePanel.getTable();
|
||||
Random random = new Random();
|
||||
final int randomRow = random.nextInt(model.getRowCount());
|
||||
DockingActionIf deleteRowAction =
|
||||
tool.getDockingActionsByFullActionName("Remove Items (TableServicePlugin)").get(0);
|
||||
|
||||
DockingActionIf deleteRowAction = getAction(tool, "TableServicePlugin", "Remove Items");
|
||||
ProgramLocation toBeDeleted = model.getRowObject(randomRow);
|
||||
runSwing(() -> table.setRowSelectionInterval(randomRow, randomRow));
|
||||
performAction(deleteRowAction, true);
|
||||
|
|
|
@ -1306,11 +1306,8 @@ public class SymbolTablePluginTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
|
||||
private void setupSymbolTableFilterToShowParameters() throws Exception {
|
||||
// get the filter action - "Set Filter"
|
||||
List<DockingActionIf> actions =
|
||||
tool.getDockingActionsByFullActionName("Set Filter (SymbolTablePlugin)");
|
||||
assertNotNull(actions);
|
||||
assertTrue(actions.size() > 0);
|
||||
DockingActionIf filterAction = actions.get(0);
|
||||
|
||||
DockingActionIf filterAction = getAction(tool, "SymbolTablePlugin", "Set Filter");
|
||||
|
||||
// execute
|
||||
performAction(filterAction, false);
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.junit.*;
|
|||
|
||||
import docking.ActionContext;
|
||||
import docking.action.DockingActionIf;
|
||||
import docking.test.AbstractDockingTest;
|
||||
import docking.widgets.OptionDialog;
|
||||
import docking.widgets.tree.GTreeNode;
|
||||
import docking.widgets.tree.GTreeRootNode;
|
||||
|
@ -596,10 +597,9 @@ public class ActionManager1Test extends AbstractGhidraHeadedIntegrationTest {
|
|||
}
|
||||
|
||||
private DockingActionIf getAction(String actionName) {
|
||||
List<DockingActionIf> a =
|
||||
frontEndTool.getDockingActionsByFullActionName(actionName + " (FrontEndPlugin)");
|
||||
Assert.assertEquals(1, a.size());
|
||||
return a.get(0);
|
||||
DockingActionIf action =
|
||||
AbstractDockingTest.getAction(frontEndTool, "FrontEndPlugin", actionName);
|
||||
return action;
|
||||
}
|
||||
|
||||
private void expandTreePath(TreePath path) {
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.junit.*;
|
|||
import docking.ActionContext;
|
||||
import docking.action.DockingActionIf;
|
||||
import docking.action.ToggleDockingAction;
|
||||
import docking.test.AbstractDockingTest;
|
||||
import docking.widgets.OptionDialog;
|
||||
import docking.widgets.tree.GTreeNode;
|
||||
import docking.widgets.tree.GTreeRootNode;
|
||||
|
@ -60,10 +61,6 @@ public class ActionManager2Test extends AbstractGhidraHeadedIntegrationTest {
|
|||
private DomainFolder rootFolder;
|
||||
private GTreeRootNode rootNode;
|
||||
|
||||
public ActionManager2Test() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
env = new TestEnv();
|
||||
|
@ -363,10 +360,9 @@ public class ActionManager2Test extends AbstractGhidraHeadedIntegrationTest {
|
|||
}
|
||||
|
||||
private DockingActionIf getAction(String actionName) {
|
||||
List<DockingActionIf> a =
|
||||
frontEndTool.getDockingActionsByFullActionName(actionName + " (FrontEndPlugin)");
|
||||
assertEquals(1, a.size());
|
||||
return a.get(0);
|
||||
DockingActionIf action =
|
||||
AbstractDockingTest.getAction(frontEndTool, "FrontEndPlugin", actionName);
|
||||
return action;
|
||||
}
|
||||
|
||||
private void setSelectionPath(final TreePath path) throws Exception {
|
||||
|
|
|
@ -30,9 +30,10 @@ import javax.swing.tree.TreePath;
|
|||
import org.junit.*;
|
||||
|
||||
import docking.action.DockingActionIf;
|
||||
import docking.actions.KeyBindingUtils;
|
||||
import docking.options.editor.OptionsDialog;
|
||||
import docking.options.editor.OptionsPanel;
|
||||
import docking.util.KeyBindingUtils;
|
||||
import docking.tool.util.DockingToolConstants;
|
||||
import docking.widgets.filechooser.GhidraFileChooser;
|
||||
import docking.widgets.tree.GTree;
|
||||
import generic.io.NullWriter;
|
||||
|
@ -49,7 +50,6 @@ import ghidra.framework.options.Options;
|
|||
import ghidra.framework.options.ToolOptions;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.framework.plugintool.mgr.OptionsManager;
|
||||
import ghidra.framework.plugintool.util.ToolConstants;
|
||||
import ghidra.test.AbstractGhidraHeadedIntegrationTest;
|
||||
import ghidra.test.TestEnv;
|
||||
import ghidra.util.Msg;
|
||||
|
@ -65,7 +65,6 @@ public class KeyBindingUtilsTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
|
||||
private static final String TEST_FILENAME =
|
||||
"KeyBindingUtilsTest_Test_Filename" + KeyBindingUtils.PREFERENCES_FILE_EXTENSION;
|
||||
private static final String TEST_TOOL_NAME = "KeyBindingsUtilsTest_TestTool";
|
||||
|
||||
private Writer debug = new NullWriter();
|
||||
|
||||
|
@ -137,7 +136,7 @@ public class KeyBindingUtilsTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
@Test
|
||||
public void testExportImportKeyBindings() throws Exception {
|
||||
debug("testExportImportKeyBindings()");
|
||||
ToolOptions defaultKeyBindings = tool.getOptions(ToolConstants.KEY_BINDINGS);
|
||||
ToolOptions defaultKeyBindings = tool.getOptions(DockingToolConstants.KEY_BINDINGS);
|
||||
|
||||
debug("a");
|
||||
|
||||
|
@ -195,7 +194,7 @@ public class KeyBindingUtilsTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
@Test
|
||||
public void testImportExportWithGUI() throws Exception {
|
||||
|
||||
setUpDialog();
|
||||
setKeyBindingsUpDialog();
|
||||
|
||||
debug("a");
|
||||
|
||||
|
@ -206,11 +205,11 @@ public class KeyBindingUtilsTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
|
||||
// save and reload them to make sure they are the same
|
||||
File saveFile = exportOptions(toolKeyBindingOptions);
|
||||
ToolOptions savedOptions = importOptions(saveFile);
|
||||
ToolOptions originalOptions = importOptions(saveFile);
|
||||
|
||||
assertOptionsMatch(
|
||||
"The Options objects do not contain different data after " + "changes have been made.",
|
||||
toolKeyBindingOptions, savedOptions);
|
||||
toolKeyBindingOptions, originalOptions);
|
||||
|
||||
debug("c");
|
||||
|
||||
|
@ -222,25 +221,25 @@ public class KeyBindingUtilsTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
// verify the changes are different than the original values
|
||||
assertOptionsDontMatch(
|
||||
"The Options objects do not contain different data after " + "changes have been made.",
|
||||
toolKeyBindingOptions, savedOptions);
|
||||
toolKeyBindingOptions, originalOptions);
|
||||
|
||||
debug("e");
|
||||
|
||||
// import the original values file through the tool
|
||||
importOptionsWithGUI(saveFile, true);
|
||||
// get the updated values that have not been applied
|
||||
Map<?, ?> optionsMap = (Map<?, ?>) getInstanceField("actionMap", panel);
|
||||
Map<String, KeyStroke> keyStrokeMap = panel.getKeyStrokeMap();
|
||||
|
||||
debug("f");
|
||||
|
||||
// verify the data is the same as it was before the changes
|
||||
boolean same = compareOptionsWithKeyStrokeMap(savedOptions, optionsMap);
|
||||
assertTrue("The Options object contains different data than was " + "imported.", same);
|
||||
boolean same = compareOptionsWithKeyStrokeMap(originalOptions, keyStrokeMap);
|
||||
assertTrue("The Options object contains different data than was imported.", same);
|
||||
|
||||
debug("g");
|
||||
|
||||
// close the tool *without* applying the changes
|
||||
closeAllWindowsAndFrames();
|
||||
closeAllWindows();
|
||||
env.dispose();
|
||||
|
||||
debug("h");
|
||||
|
@ -250,7 +249,7 @@ public class KeyBindingUtilsTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
// reload the tool and make sure the values are those of the changes
|
||||
// *before* the last import
|
||||
setUp();
|
||||
setUpDialog();
|
||||
setKeyBindingsUpDialog();
|
||||
|
||||
debug("i");
|
||||
|
||||
|
@ -258,7 +257,7 @@ public class KeyBindingUtilsTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
assertOptionsMatch(
|
||||
"The options from the first tool instance have changed " +
|
||||
"in the second tool instance even though the testing changes were not applied.",
|
||||
savedOptions, newlyLoadedDefaultOptions);
|
||||
originalOptions, newlyLoadedDefaultOptions);
|
||||
|
||||
debug("j");
|
||||
|
||||
|
@ -281,44 +280,54 @@ public class KeyBindingUtilsTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
|
||||
debug("n");
|
||||
|
||||
saveTool();
|
||||
closeAllWindowsAndFrames();
|
||||
env.dispose();
|
||||
|
||||
debug("o");
|
||||
|
||||
saveFile.delete();
|
||||
|
||||
// reload the tool and make sure the values are those of the changes
|
||||
// *after* the last import
|
||||
// reload with our saved tool
|
||||
setUp();
|
||||
runSwing(() -> {
|
||||
ToolServices services = tool.getProject().getToolServices();
|
||||
tool = (PluginTool) services.launchTool(TEST_TOOL_NAME, null);
|
||||
});
|
||||
saveAndCloseTool();
|
||||
reopenTool(tool);
|
||||
|
||||
debug("p");
|
||||
|
||||
setKeyBindingsUpDialog(tool);
|
||||
|
||||
newlyLoadedDefaultOptions = (ToolOptions) getInstanceField("options", panel);
|
||||
assertOptionsDontMatch(
|
||||
"The options are the same after making changes, applying, " + "closing and reloading.",
|
||||
savedOptions, newlyLoadedDefaultOptions);
|
||||
"The options are the same after making changes, applying, closing and reloading.",
|
||||
originalOptions, newlyLoadedDefaultOptions);
|
||||
|
||||
debug("q");
|
||||
closeAllWindows();
|
||||
}
|
||||
|
||||
private void saveTool() {
|
||||
executeOnSwingWithoutBlocking(() -> tool.saveTool());
|
||||
private void reopenTool(PluginTool tool2) {
|
||||
runSwing(() -> {
|
||||
ToolServices services = tool.getProject().getToolServices();
|
||||
tool = (PluginTool) services.launchTool(tool.getName(), null);
|
||||
});
|
||||
assertNotNull(tool);
|
||||
}
|
||||
|
||||
// open the options dialog and show the key bindings editor
|
||||
private void setUpDialog() throws Exception {
|
||||
debug("setUpDialog()");
|
||||
private void saveAndCloseTool() {
|
||||
runSwing(() -> {
|
||||
ToolServices services = tool.getProject().getToolServices();
|
||||
services.saveTool(tool);
|
||||
});
|
||||
env.closeTool(tool);
|
||||
}
|
||||
|
||||
private void setKeyBindingsUpDialog() throws Exception {
|
||||
env.showTool();
|
||||
setKeyBindingsUpDialog(tool);
|
||||
}
|
||||
|
||||
private void setKeyBindingsUpDialog(PluginTool pluginTool) throws Exception {
|
||||
debug("setUpDialog()");
|
||||
debug("aa");
|
||||
|
||||
final OptionsManager optionsManager = (OptionsManager) getInstanceField("optionsMgr", tool);
|
||||
final OptionsManager optionsManager =
|
||||
(OptionsManager) getInstanceField("optionsMgr", pluginTool);
|
||||
|
||||
debug("bb");
|
||||
executeOnSwingWithoutBlocking(() -> {
|
||||
|
@ -396,26 +405,26 @@ public class KeyBindingUtilsTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
}
|
||||
|
||||
private void setKeyBinding(String keyText, int keyCode) throws Exception {
|
||||
List<DockingActionIf> list = tool.getAllActions();
|
||||
DockingActionIf action = null;
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
action = list.get(i);
|
||||
Set<DockingActionIf> list = tool.getAllActions();
|
||||
DockingActionIf arbitraryAction = null;
|
||||
for (DockingActionIf action : list) {
|
||||
if (action.isKeyBindingManaged() && action.getKeyBinding() == null) {
|
||||
arbitraryAction = action;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (action == null) {
|
||||
if (arbitraryAction == null) {
|
||||
Assert.fail("Unable to find an action for which to set a key binding.");
|
||||
}
|
||||
|
||||
selectRowForAction(action);
|
||||
selectRowForAction(arbitraryAction);
|
||||
triggerText(keyField, keyText);
|
||||
|
||||
assertEquals(keyText.toUpperCase(), keyField.getText());
|
||||
|
||||
runSwing(() -> panel.apply());
|
||||
assertEquals(KeyStroke.getKeyStroke(keyCode, 0), action.getKeyBinding());
|
||||
assertEquals(KeyStroke.getKeyStroke(keyCode, 0), arbitraryAction.getKeyBinding());
|
||||
}
|
||||
|
||||
private void selectRowForAction(DockingActionIf action) throws Exception {
|
||||
|
@ -458,7 +467,7 @@ public class KeyBindingUtilsTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
}
|
||||
|
||||
private void closeWarningDialog(boolean proceed) {
|
||||
Window window = waitForWindowByTitleContaining(null, "Continue", DEFAULT_WINDOW_TIMEOUT);
|
||||
Window window = waitForWindowByTitleContaining("Continue");
|
||||
assertNotNull(window);
|
||||
|
||||
String button = proceed ? "Yes" : "No";
|
||||
|
@ -488,7 +497,7 @@ public class KeyBindingUtilsTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
// locates the open file chooser and verifies its state
|
||||
private File findAndTestFileChooser(File path, String filename) throws Exception {
|
||||
// get the file chooser and set the file it will use
|
||||
GhidraFileChooser fileChooser = waitForDialogComponent(null, GhidraFileChooser.class, 5000);
|
||||
GhidraFileChooser fileChooser = waitForDialogComponent(GhidraFileChooser.class);
|
||||
if (fileChooser == null) {
|
||||
Msg.debug(this, "Couldn't find file chooser");
|
||||
printOpenWindows();
|
||||
|
@ -524,20 +533,19 @@ public class KeyBindingUtilsTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
// compares the provided options with the mapping of property names to
|
||||
// keystrokes (the map is obtained from the key bindings panel after an
|
||||
// import is done).
|
||||
private boolean compareOptionsWithKeyStrokeMap(Options options, Map<?, ?> optionsMap) {
|
||||
private boolean compareOptionsWithKeyStrokeMap(Options options,
|
||||
Map<String, KeyStroke> panelKeyStrokeMap) {
|
||||
List<String> propertyNames = options.getOptionNames();
|
||||
for (String element : propertyNames) {
|
||||
boolean match = optionsMap.containsKey(element);
|
||||
boolean match = panelKeyStrokeMap.containsKey(element);
|
||||
|
||||
Object value = invokeInstanceMethod("getKeyStroke", options,
|
||||
new Class[] { String.class, KeyStroke.class }, new Object[] { element, null });
|
||||
Object value2 = optionsMap.get(element);
|
||||
KeyStroke optionsKs = options.getKeyStroke(element, null);
|
||||
KeyStroke panelKs = panelKeyStrokeMap.get(element);
|
||||
|
||||
// if the value is null, then it would not have been placed into the
|
||||
// options map in the key bindings panel, so we only care about
|
||||
// non-null values
|
||||
if (value != null) {
|
||||
match &= (value.equals(value2));
|
||||
// if the value is null, then it would not have been placed into the options map
|
||||
// in the key bindings panel, so we only care about non-null values
|
||||
if (optionsKs != null) {
|
||||
match &= (optionsKs.equals(panelKs));
|
||||
}
|
||||
else {
|
||||
match = true;
|
||||
|
|
|
@ -20,7 +20,7 @@ import static org.junit.Assert.*;
|
|||
import java.awt.Rectangle;
|
||||
import java.awt.event.InputEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.*;
|
||||
|
@ -29,10 +29,10 @@ import org.junit.*;
|
|||
|
||||
import docking.KeyEntryTextField;
|
||||
import docking.action.DockingActionIf;
|
||||
import docking.tool.util.DockingToolConstants;
|
||||
import docking.widgets.MultiLineLabel;
|
||||
import ghidra.app.plugin.core.codebrowser.CodeBrowserPlugin;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.framework.plugintool.util.ToolConstants;
|
||||
import ghidra.test.AbstractGhidraHeadedIntegrationTest;
|
||||
import ghidra.test.TestEnv;
|
||||
import ghidra.util.Msg;
|
||||
|
@ -102,9 +102,8 @@ public class KeyBindingsTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
|
||||
@Test
|
||||
public void testManagedKeyBindings() {
|
||||
List<DockingActionIf> list = tool.getAllActions();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
DockingActionIf action = list.get(i);
|
||||
Set<DockingActionIf> list = tool.getAllActions();
|
||||
for (DockingActionIf action : list) {
|
||||
if (action.isKeyBindingManaged()) {
|
||||
assertTrue(actionInTable(action));
|
||||
}
|
||||
|
@ -128,10 +127,8 @@ public class KeyBindingsTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
@Test
|
||||
public void testActionNotSelected() throws Exception {
|
||||
table.clearSelection();
|
||||
List<DockingActionIf> list = tool.getAllActions();
|
||||
DockingActionIf action = null;
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
action = list.get(i);
|
||||
Set<DockingActionIf> list = tool.getAllActions();
|
||||
for (DockingActionIf action : list) {
|
||||
KeyStroke ks = getKeyStroke(action);
|
||||
if (isKeyBindingManaged(action) && ks != KeyStroke.getKeyStroke(KeyEvent.VK_Z, 0)) {
|
||||
break;
|
||||
|
@ -318,10 +315,8 @@ public class KeyBindingsTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
}
|
||||
|
||||
private DockingActionIf getKeyBindingPluginAction() {
|
||||
List<DockingActionIf> list = tool.getAllActions();
|
||||
DockingActionIf action = null;
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
action = list.get(i);
|
||||
Set<DockingActionIf> list = tool.getAllActions();
|
||||
for (DockingActionIf action : list) {
|
||||
KeyStroke ks = action.getKeyBinding();
|
||||
if (action.isKeyBindingManaged() && ks != null &&
|
||||
ks != KeyStroke.getKeyStroke(KeyEvent.VK_Z, 0)) {
|
||||
|
@ -372,7 +367,7 @@ public class KeyBindingsTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
|
||||
private void setUpDialog() throws Exception {
|
||||
runSwing(() -> {
|
||||
panel = new KeyBindingsPanel(tool, tool.getOptions(ToolConstants.KEY_BINDINGS));
|
||||
panel = new KeyBindingsPanel(tool, tool.getOptions(DockingToolConstants.KEY_BINDINGS));
|
||||
|
||||
dialog = new JDialog(tool.getToolFrame(), "Test KeyBindings", false);
|
||||
dialog.getContentPane().add(panel);
|
||||
|
@ -391,10 +386,8 @@ public class KeyBindingsTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
}
|
||||
|
||||
private void grabActionsWithoutKeybinding() {
|
||||
List<DockingActionIf> list = tool.getAllActions();
|
||||
DockingActionIf action = null;
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
action = list.get(i);
|
||||
Set<DockingActionIf> list = tool.getAllActions();
|
||||
for (DockingActionIf action : list) {
|
||||
if (!action.isKeyBindingManaged()) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -20,8 +20,6 @@ import static org.junit.Assert.*;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import org.junit.*;
|
||||
|
||||
import docking.action.DockingActionIf;
|
||||
|
@ -74,7 +72,7 @@ public class ManageFrontEndToolTest extends AbstractGhidraHeadedIntegrationTest
|
|||
@After
|
||||
public void tearDown() throws Exception {
|
||||
|
||||
SwingUtilities.invokeAndWait(() -> {
|
||||
runSwing(() -> {
|
||||
tool.setConfigChanged(false);
|
||||
provider.close();
|
||||
});
|
||||
|
@ -99,33 +97,27 @@ public class ManageFrontEndToolTest extends AbstractGhidraHeadedIntegrationTest
|
|||
|
||||
final Plugin p = getPlugin(tool, ArchivePlugin.class);
|
||||
assertNotNull(p);
|
||||
SwingUtilities.invokeAndWait(() -> {
|
||||
runSwing(() -> {
|
||||
provider.close();
|
||||
tool.removePlugins(new Plugin[] { p });
|
||||
});
|
||||
|
||||
showProvider();
|
||||
|
||||
List<DockingActionIf> actions =
|
||||
tool.getDockingActionsByFullActionName("Save Project (" + plugin.getName() + ")");
|
||||
assertEquals(1, actions.size());
|
||||
performAction(actions.get(0), true);
|
||||
DockingActionIf action = getAction(tool, plugin.getName(), "Save Project");
|
||||
performAction(action, true);
|
||||
|
||||
actions =
|
||||
tool.getDockingActionsByFullActionName("Close Project (" + plugin.getName() + ")");
|
||||
assertEquals(1, actions.size());
|
||||
performAction(actions.get(0), true);
|
||||
action = getAction(tool, plugin.getName(), "Close Project");
|
||||
performAction(action, true);
|
||||
assertTrue(!provider.isVisible());
|
||||
}
|
||||
|
||||
private void showProvider() throws Exception {
|
||||
List<DockingActionIf> actions =
|
||||
tool.getDockingActionsByFullActionName("Configure Tool (Project Window)");
|
||||
assertEquals(1, actions.size());
|
||||
|
||||
performAction(actions.get(0), true);
|
||||
DockingActionIf action = getAction(tool, "Project Window", "Configure Tool");
|
||||
performAction(action, true);
|
||||
waitForPostedSwingRunnables();
|
||||
SwingUtilities.invokeAndWait(() -> tool.showConfig(false, false));
|
||||
runSwing(() -> tool.showConfig(false, false));
|
||||
|
||||
provider = tool.getManagePluginsDialog();
|
||||
pluginManagerComponent = (PluginManagerComponent) getInstanceField("comp", provider);
|
||||
|
|
|
@ -254,11 +254,9 @@ public class ManagePluginsTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
}
|
||||
|
||||
private void showProvider() {
|
||||
List<DockingActionIf> actions =
|
||||
tool.getDockingActionsByFullActionName("Configure Tool (Tool)");
|
||||
assertEquals(1, actions.size());
|
||||
|
||||
performAction(actions.get(0), true);
|
||||
DockingActionIf action = getAction(tool, "Tool", "Configure Tool");
|
||||
performAction(action, true);
|
||||
waitForSwing();
|
||||
provider = tool.getManagePluginsDialog();
|
||||
pluginManagerComponent = (PluginManagerComponent) getInstanceField("comp", provider);
|
||||
|
|
|
@ -18,7 +18,6 @@ package ghidra.framework.project.tool;
|
|||
import static org.junit.Assert.*;
|
||||
|
||||
import java.awt.Window;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.*;
|
||||
|
||||
|
@ -56,7 +55,7 @@ public class CloseToolTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
public void tearDown() throws Exception {
|
||||
executeOnSwingWithoutBlocking(() -> env.dispose());
|
||||
|
||||
closeAllWindowsAndFrames();
|
||||
closeAllWindows();
|
||||
|
||||
}
|
||||
|
||||
|
@ -138,7 +137,7 @@ public class CloseToolTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
closeTool(tool);
|
||||
|
||||
// check for warning dialog
|
||||
Window window = waitForWindow(tool.getToolFrame(), "Tool Busy", 2000);
|
||||
Window window = waitForWindow("Tool Busy");
|
||||
assertNotNull("Did not get tool busy dialog", window);
|
||||
closeWindow(window);
|
||||
|
||||
|
@ -146,7 +145,7 @@ public class CloseToolTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
closeProgram(tool, program);
|
||||
|
||||
// check for warning dialog
|
||||
window = waitForWindow(tool.getToolFrame(), "Close notepad Failed", 2000);
|
||||
window = waitForWindow("Close notepad Failed");
|
||||
assertNotNull("Did not get \"close failed\" dialog", window);
|
||||
closeWindow(window);
|
||||
|
||||
|
@ -169,11 +168,9 @@ public class CloseToolTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
}
|
||||
|
||||
private void closeProgram(final PluginTool tool, final ProgramDB program) {
|
||||
List<DockingActionIf> actionList =
|
||||
tool.getDockingActionsByFullActionName("Close File (ProgramManagerPlugin)");
|
||||
assertTrue(!actionList.isEmpty());
|
||||
|
||||
performAction(actionList.get(0), new ProgramActionContext(null, program), false);
|
||||
DockingActionIf action = getAction(tool, "ProgramManagerPlugin", "Close File");
|
||||
performAction(action, new ProgramActionContext(null, program), false);
|
||||
|
||||
waitForPostedSwingRunnables();
|
||||
}
|
||||
|
|
|
@ -201,10 +201,9 @@ public class DateEditorTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
}
|
||||
|
||||
private void showProgramOptions() {
|
||||
List<DockingActionIf> list = tool.getAllActions();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
|
||||
DockingActionIf action = list.get(i);
|
||||
// TODO change to getAction("Program Options")
|
||||
Set<DockingActionIf> list = tool.getAllActions();
|
||||
for (DockingActionIf action : list) {
|
||||
if (action.getName().equals("Program Options")) {
|
||||
performAction(action, plugin.getProvider(), false);
|
||||
break;
|
||||
|
|
|
@ -988,10 +988,9 @@ public class OptionsDialogTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
}
|
||||
|
||||
private void showOptionsDialog(PluginTool pluginTool) throws Exception {
|
||||
List<DockingActionIf> list = pluginTool.getAllActions();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
|
||||
DockingActionIf action = list.get(i);
|
||||
// TODO change to getAction("Edit Options")
|
||||
Set<DockingActionIf> list = pluginTool.getAllActions();
|
||||
for (DockingActionIf action : list) {
|
||||
if (action.getName().equals("Edit Options")) {
|
||||
performAction(action, false);
|
||||
break;
|
||||
|
|
|
@ -19,7 +19,7 @@ import java.awt.Window;
|
|||
import java.beans.PropertyChangeListener;
|
||||
import java.beans.PropertyVetoException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
@ -438,18 +438,13 @@ public class DummyTool implements Tool {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<DockingActionIf> getAllActions() {
|
||||
return Collections.emptyList();
|
||||
public Set<DockingActionIf> getAllActions() {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DockingActionIf> getDockingActionsByOwnerName(String owner) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DockingActionIf> getDockingActionsByFullActionName(String fullActionName) {
|
||||
return Collections.emptyList();
|
||||
public Set<DockingActionIf> getDockingActionsByOwnerName(String owner) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -21,7 +21,6 @@ import java.awt.event.ActionListener;
|
|||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
|
@ -97,9 +96,9 @@ public class SaveToolConfigDialogTest extends AbstractGhidraHeadedIntegrationTes
|
|||
tc.remove("MyTestTool");
|
||||
tc.remove("TestTool");
|
||||
|
||||
waitForPostedSwingRunnables();
|
||||
waitForSwing();
|
||||
tool.setConfigChanged(false);
|
||||
SwingUtilities.invokeAndWait(() -> saveDialog.close());
|
||||
runSwing(() -> saveDialog.close());
|
||||
env.dispose();
|
||||
}
|
||||
|
||||
|
@ -125,7 +124,7 @@ public class SaveToolConfigDialogTest extends AbstractGhidraHeadedIntegrationTes
|
|||
pressButtonByText(saveDialog, "Save");
|
||||
|
||||
assertTrue(!tool.hasConfigChanged());
|
||||
waitForPostedSwingRunnables();
|
||||
waitForSwing();
|
||||
assertTrue(!saveDialog.isVisible());
|
||||
ToolChest tc = tool.getProject().getLocalToolChest();
|
||||
ToolTemplate config = tc.getToolTemplate("MyTestTool");
|
||||
|
@ -142,7 +141,7 @@ public class SaveToolConfigDialogTest extends AbstractGhidraHeadedIntegrationTes
|
|||
while (saveDialog.isVisible()) {
|
||||
Thread.sleep(5);
|
||||
}
|
||||
waitForPostedSwingRunnables();
|
||||
waitForSwing();
|
||||
assertEquals("Name cannot have spaces.", msg);
|
||||
}
|
||||
|
||||
|
@ -156,7 +155,7 @@ public class SaveToolConfigDialogTest extends AbstractGhidraHeadedIntegrationTes
|
|||
pressButtonByText(saveDialog, "Save");
|
||||
|
||||
assertTrue(!tool.hasConfigChanged());
|
||||
waitForPostedSwingRunnables();
|
||||
waitForSwing();
|
||||
assertTrue(!saveDialog.isVisible());
|
||||
ToolChest tc = tool.getProject().getLocalToolChest();
|
||||
ToolTemplate template = tc.getToolTemplate("MyTestTool");
|
||||
|
@ -180,7 +179,7 @@ public class SaveToolConfigDialogTest extends AbstractGhidraHeadedIntegrationTes
|
|||
while (saveDialog.isVisible()) {
|
||||
Thread.sleep(5);
|
||||
}
|
||||
waitForPostedSwingRunnables();
|
||||
waitForSwing();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -208,8 +207,7 @@ public class SaveToolConfigDialogTest extends AbstractGhidraHeadedIntegrationTes
|
|||
final JButton browseButton = (JButton) findComponentByName(saveDialog, "BrowseButton");
|
||||
pressButton(browseButton, false);
|
||||
|
||||
final GhidraFileChooser chooser =
|
||||
waitForDialogComponent(GhidraFileChooser.class);
|
||||
final GhidraFileChooser chooser = waitForDialogComponent(GhidraFileChooser.class);
|
||||
|
||||
assertNotNull(chooser);
|
||||
runSwing(() -> chooser.setSelectedFile(destFile));
|
||||
|
@ -240,7 +238,7 @@ public class SaveToolConfigDialogTest extends AbstractGhidraHeadedIntegrationTes
|
|||
while (tc.getToolTemplate("MyTestTool") == null) {
|
||||
Thread.sleep(10);
|
||||
}
|
||||
waitForPostedSwingRunnables();
|
||||
waitForSwing();
|
||||
|
||||
setText(toolNameField, "MyTestTool", false);
|
||||
|
||||
|
@ -256,10 +254,9 @@ public class SaveToolConfigDialogTest extends AbstractGhidraHeadedIntegrationTes
|
|||
JButton saveButton = findButtonByText(saveDialog, "Save");
|
||||
saveButton.getActionListeners()[0].actionPerformed(null);
|
||||
});
|
||||
waitForPostedSwingRunnables();
|
||||
waitForSwing();
|
||||
|
||||
final OptionDialog d =
|
||||
waitForDialogComponent(tool.getToolFrame(), OptionDialog.class, 2000);
|
||||
final OptionDialog d = waitForDialogComponent(OptionDialog.class);
|
||||
assertNotNull(d);
|
||||
assertEquals("Overwrite Tool?", d.getTitle());
|
||||
pressButtonByText(d.getComponent(), "Overwrite");
|
||||
|
@ -267,7 +264,7 @@ public class SaveToolConfigDialogTest extends AbstractGhidraHeadedIntegrationTes
|
|||
while (d.isVisible()) {
|
||||
Thread.sleep(10);
|
||||
}
|
||||
waitForPostedSwingRunnables();
|
||||
waitForSwing();
|
||||
|
||||
assertTrue(!tool.hasConfigChanged());
|
||||
}
|
||||
|
@ -282,11 +279,11 @@ public class SaveToolConfigDialogTest extends AbstractGhidraHeadedIntegrationTes
|
|||
while (tc.getToolTemplate("MyTestTool") == null) {
|
||||
Thread.sleep(10);
|
||||
}
|
||||
waitForPostedSwingRunnables();
|
||||
waitForSwing();
|
||||
|
||||
setText(toolNameField, "MyTestTool", false);
|
||||
|
||||
SwingUtilities.invokeAndWait(() -> {
|
||||
runSwing(() -> {
|
||||
// force a change to the tool config
|
||||
try {
|
||||
tool.addPlugin(ByteViewerPlugin.class.getName());
|
||||
|
@ -301,10 +298,9 @@ public class SaveToolConfigDialogTest extends AbstractGhidraHeadedIntegrationTes
|
|||
JButton saveButton = findButtonByText(saveDialog, "Save");
|
||||
saveButton.getActionListeners()[0].actionPerformed(null);
|
||||
});
|
||||
waitForPostedSwingRunnables();
|
||||
waitForSwing();
|
||||
|
||||
final OptionDialog d =
|
||||
waitForDialogComponent(OptionDialog.class);
|
||||
final OptionDialog d = waitForDialogComponent(OptionDialog.class);
|
||||
assertNotNull(d);
|
||||
assertEquals("Overwrite Tool?", d.getTitle());
|
||||
pressButtonByText(d.getComponent(), "Cancel");
|
||||
|
@ -312,17 +308,16 @@ public class SaveToolConfigDialogTest extends AbstractGhidraHeadedIntegrationTes
|
|||
while (d.isVisible()) {
|
||||
Thread.sleep(10);
|
||||
}
|
||||
waitForPostedSwingRunnables();
|
||||
waitForSwing();
|
||||
|
||||
assertTrue(tool.hasConfigChanged());
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
private void showDialogs() throws Exception {
|
||||
List<DockingActionIf> actions =
|
||||
tool.getDockingActionsByFullActionName("Save Tool As (Tool)");
|
||||
performAction(actions.get(0), false);
|
||||
waitForPostedSwingRunnables();
|
||||
|
||||
DockingActionIf action = getAction(tool, "Tool", "Save Tool As");
|
||||
performAction(action, false);
|
||||
waitForSwing();
|
||||
|
||||
saveDialog = waitForDialogComponent(SaveToolConfigDialog.class);
|
||||
|
||||
|
@ -335,7 +330,7 @@ public class SaveToolConfigDialogTest extends AbstractGhidraHeadedIntegrationTes
|
|||
private void setText(final JTextField field, final String text, final boolean doAction)
|
||||
throws Exception {
|
||||
|
||||
SwingUtilities.invokeAndWait(() -> {
|
||||
runSwing(() -> {
|
||||
field.setText(text);
|
||||
if (doAction) {
|
||||
ActionListener[] listeners = field.getActionListeners();
|
||||
|
@ -344,6 +339,6 @@ public class SaveToolConfigDialogTest extends AbstractGhidraHeadedIntegrationTes
|
|||
}
|
||||
}
|
||||
});
|
||||
waitForPostedSwingRunnables();
|
||||
waitForSwing();
|
||||
}
|
||||
}
|
||||
|
|