Merge remote-tracking branch

'origin/GP-1451_Dan_syncSelToggle--SQUASHED'

 Conflicts:
	Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/listing/DebuggerListingProviderTest.java
This commit is contained in:
Ryan Kurtz 2022-05-20 10:24:35 -04:00
commit a1e57f1f7a
31 changed files with 1063 additions and 421 deletions

View file

@ -171,6 +171,7 @@ public class DecompilerPanel extends JPanel implements FieldMouseListener, Field
/**
* Removes all secondary highlights for the current function
*
* @param function the function containing the secondary highlights
*/
public void removeSecondaryHighlights(Function function) {
@ -282,11 +283,12 @@ public class DecompilerPanel extends JPanel implements FieldMouseListener, Field
* This function is used to alert the panel that a token was renamed. If the token being renamed
* had a secondary highlight, we must re-apply the highlight to the new token.
*
* <p>This is not needed for highlighter service highlights, since they get called again to
* re-apply highlights. It is up to that highlighter to determine if highlighting still applies
* to the new token name. Alternatively, for secondary highlights, we know the user chose the
* highlight based upon name. Thus, when the name changes, we need to take action to update
* the secondary highlight.
* <p>
* This is not needed for highlighter service highlights, since they get called again to
* re-apply highlights. It is up to that highlighter to determine if highlighting still applies
* to the new token name. Alternatively, for secondary highlights, we know the user chose the
* highlight based upon name. Thus, when the name changes, we need to take action to update the
* secondary highlight.
*
* @param token the token being renamed
* @param newName the new name of the token
@ -331,6 +333,7 @@ public class DecompilerPanel extends JPanel implements FieldMouseListener, Field
/**
* Called by the provider to clone all highlights in the source panel and apply them to this
* panel
*
* @param sourcePanel the panel that was cloned
*/
public void cloneHighlights(DecompilerPanel sourcePanel) {
@ -374,6 +377,7 @@ public class DecompilerPanel extends JPanel implements FieldMouseListener, Field
/**
* This function sets the current window display based on our display state
*
* @param decompileData the new data
*/
void setDecompileData(DecompileData decompileData) {
@ -546,6 +550,7 @@ public class DecompilerPanel extends JPanel implements FieldMouseListener, Field
/**
* Put cursor on first token in the list
*
* @param tokens the tokens to search for
*/
private void goToBeginningOfLine(List<ClangToken> tokens) {
@ -608,8 +613,8 @@ public class DecompilerPanel extends JPanel implements FieldMouseListener, Field
/**
* Translate Ghidra address to decompiler address. Functions within an overlay space are
* decompiled in their physical space, therefore decompiler results refer to the
* functions underlying .physical space
* decompiled in their physical space, therefore decompiler results refer to the functions
* underlying .physical space
*
* @param addr the Ghidra address
* @return the decompiler address
@ -627,9 +632,9 @@ public class DecompilerPanel extends JPanel implements FieldMouseListener, Field
}
/**
* Translate Ghidra address set to decompiler address set. Functions within an overlay
* space are decompiled in their physical space, therefore decompiler results
* refer to the functions underlying .physical space
* Translate Ghidra address set to decompiler address set. Functions within an overlay space are
* decompiled in their physical space, therefore decompiler results refer to the functions
* underlying .physical space
*
* @param set the Ghidra addresses
* @return the decompiler addresses
@ -705,8 +710,9 @@ public class DecompilerPanel extends JPanel implements FieldMouseListener, Field
}
/**
* Passing false signals to disallow navigating to new functions from within the panel by
* using the mouse.
* Passing false signals to disallow navigating to new functions from within the panel by using
* the mouse.
*
* @param enabled false disabled mouse function navigation
*/
void setMouseNavigationEnabled(boolean enabled) {
@ -1013,8 +1019,9 @@ public class DecompilerPanel extends JPanel implements FieldMouseListener, Field
}
/**
* The color used in a primary highlight to mark the token that was clicked. This is used
* in 'slice' actions to mark the source of the slice.
* The color used in a primary highlight to mark the token that was clicked. This is used in
* 'slice' actions to mark the source of the slice.
*
* @return the color
*/
public Color getSpecialHighlightColor() {
@ -1076,6 +1083,7 @@ public class DecompilerPanel extends JPanel implements FieldMouseListener, Field
/**
* Returns a single selected token; null if there is no selection or multiple tokens selected.
*
* @return a single selected token; null if there is no selection or multiple tokens selected.
*/
public ClangToken getSelectedToken() {
@ -1165,14 +1173,11 @@ public class DecompilerPanel extends JPanel implements FieldMouseListener, Field
fieldPanel.requestFocus();
}
public void selectAll() {
public void selectAll(EventTrigger trigger) {
BigInteger numIndexes = layoutMgr.getNumIndexes();
FieldSelection selection = new FieldSelection();
selection.addRange(BigInteger.ZERO, numIndexes);
fieldPanel.setSelection(selection);
// fake it out that the selection was caused by the field panel GUI.
selectionChanged(selection, EventTrigger.GUI_ACTION);
fieldPanel.setSelection(selection, trigger);
}
public void optionsChanged(DecompileOptions decompilerOptions) {
@ -1270,10 +1275,10 @@ public class DecompilerPanel extends JPanel implements FieldMouseListener, Field
}
/**
* Moves this field panel to the given line and column. Further, this navigation will
* fire an event to the rest of the tool. (This is in contrast to a field panel
* <code>goTo</code>, which we use to simply move the cursor, but not trigger an
* tool-level navigation event.)
* Moves this field panel to the given line and column. Further, this navigation will fire
* an event to the rest of the tool. (This is in contrast to a field panel
* <code>goTo</code>, which we use to simply move the cursor, but not trigger an tool-level
* navigation event.)
*
* @param lineNumber the line number
* @param column the column within the line
@ -1285,8 +1290,8 @@ public class DecompilerPanel extends JPanel implements FieldMouseListener, Field
}
/**
* A class to track pending location updates. This allows us to buffer updates, only sending
* the last one received.
* A class to track pending location updates. This allows us to buffer updates, only sending the
* last one received.
*/
private class PendingHighlightUpdate {

View file

@ -21,6 +21,7 @@ import java.awt.event.KeyEvent;
import docking.ActionContext;
import docking.action.DockingAction;
import docking.action.KeyBindingData;
import docking.widgets.EventTrigger;
import ghidra.app.decompiler.component.DecompilerPanel;
import ghidra.app.util.HelpTopics;
import ghidra.util.HelpLocation;
@ -41,7 +42,6 @@ public class SelectAllAction extends DockingAction {
@Override
public void actionPerformed(ActionContext context) {
panel.selectAll();
panel.selectAll(EventTrigger.GUI_ACTION);
}
}