diff --git a/Ghidra/Debug/Debugger/src/main/help/help/topics/DebuggerListingPlugin/DebuggerListingPlugin.html b/Ghidra/Debug/Debugger/src/main/help/help/topics/DebuggerListingPlugin/DebuggerListingPlugin.html index 108aa48893..ff1c20b779 100644 --- a/Ghidra/Debug/Debugger/src/main/help/help/topics/DebuggerListingPlugin/DebuggerListingPlugin.html +++ b/Ghidra/Debug/Debugger/src/main/help/help/topics/DebuggerListingPlugin/DebuggerListingPlugin.html @@ -128,7 +128,7 @@ -
This action is always available, but only on the primary dynamic listing. It configures location synchronization with the (primary) static listing. When enabled, navigation in either @@ -139,7 +139,41 @@ "help/topics/DebuggerStaticMappingPlugin/DebuggerStaticMappingPlugin.html">Static Mappings window. When you navigate to a location contained by a module, but there is no corresponding static location, the listing logs a "missing module" to the console, offering either to import - the module or map it to an existing program.
+ the module or map it to an existing program. If the cursor cannot be mapped, the other + listing's location is left unchanged. If this does not seem correct. Check your module list and + static mappings. + +This action is always available, but only on the primary dynamic listing. It configures + selection synchronization with the (primary) static listing. When enabled, selection in either + listing automatically selects the corresponding ranges, if applicable, in the other. In + general, "corresponding ranges" are computed using information about loaded modules reported by + the debugger. For the finer details, see the Static Mappings + window. Portions of the selection which cannot be mapped are omitted.
+ +This action is available whenever the current context is dynamic and has a selection. It + maps the current dynamic selection to corresponding static ranges and selects those in the + static listing. In general, "corresponding ranges" are computed using information about loaded + modules reported by the debugger. For the finer details, see the Static Mappings + window. Portions of the selection which cannot be mapped are omitted. If no part of the + selection is mappable, an error is displayed in the status bar. This can happen if the module + list is missing, or Ghidra could not find the program for the current module.
+ +This action is available whenever the current context is static and has a selection. It maps + the current static selection to corresponding dynamic ranges and selects those in the dynamic + listing. In general, "corresponding ranges" are computed using information about loaded modules + reported by the debugger. For the finer details, see the Static Mappings + window. Portions of the selection which cannot be mapped are omitted. If no part of the + selection is mappable, an error is displayed in the status bar. This can happen if the module + list is missing, or Ghidra could not find the program for the current module.
By default, events are passed to the Objects Viewer even while the target is running. - The resulting changes in the GUI may be distracting for some. To disable updates to the - Objects Viewer, toggle "Updates While Running" off.
+By default, events are passed to the Objects Viewer even while the target is running. The + resulting changes in the GUI may be distracting for some. To disable updates to the Objects + Viewer, toggle "Updates While Running" off.
x86:LE:32:default
* @param consumer a consumer for the program
@@ -155,6 +157,7 @@ public abstract class AbstractGhidraHeadlessIntegrationTest extends AbstractDock
/**
* Creates an in-memory program with the given language
+ *
* @param name the program name
* @param languageString a language string of the format x86:LE:32:default
* @param compilerSpecID the ID
@@ -173,8 +176,8 @@ public abstract class AbstractGhidraHeadlessIntegrationTest extends AbstractDock
}
/**
- * Run a command against the specified program within a transaction.
- * The transaction will be committed unless the command throws a RollbackException.
+ * Run a command against the specified program within a transaction. The transaction will be
+ * committed unless the command throws a RollbackException.
*
* @param program the program
* @param cmd the command to apply
@@ -233,6 +236,7 @@ public abstract class AbstractGhidraHeadlessIntegrationTest extends AbstractDock
/**
* Provides a convenient method for modifying the current program, handling the transaction
* logic and returning a result.
+ *
* @param Note: this is a blocking operation. Your test will not proceed while this method is - * sleeping. + *
+ * Note: this is a blocking operation. Your test will not proceed while this method is sleeping. * - *
Do not leave this call in your test when committing changes. + *
+ * Do not leave this call in your test when committing changes. + * * @param p the program * @param address the address * @@ -610,6 +614,7 @@ public abstract class AbstractGhidraHeadlessIntegrationTest extends AbstractDock /** * Get language service used for testing. + * * @return language service. */ public synchronized static LanguageService getLanguageService() { diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/codebrowser/CodeBrowserScreenMovementTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/codebrowser/CodeBrowserScreenMovementTest.java index 81314ac334..4781a26186 100644 --- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/codebrowser/CodeBrowserScreenMovementTest.java +++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/codebrowser/CodeBrowserScreenMovementTest.java @@ -681,10 +681,7 @@ public class CodeBrowserScreenMovementTest extends AbstractProgramBasedTest { } private void setFieldSelection(FieldPanel fp, FieldSelection sel) { - fp.setSelection(sel); - Class>[] argClasses = new Class>[] { EventTrigger.class }; - Object[] args = new Object[] { EventTrigger.GUI_ACTION }; - invokeInstanceMethod("notifySelectionChanged", fp, argClasses, args); + fp.setSelection(sel, EventTrigger.GUI_ACTION); } private void setUpCodeBrowserTool(PluginTool tool) throws Exception { diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/colorizer/ColorizingPluginTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/colorizer/ColorizingPluginTest.java index a6b0409958..6d36f0db19 100644 --- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/colorizer/ColorizingPluginTest.java +++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/colorizer/ColorizingPluginTest.java @@ -256,7 +256,8 @@ public class ColorizingPluginTest extends AbstractGhidraHeadedIntegrationTest { /** * Tests navigation of offcut ranges when coloring is set from a GUI/API point-of-view. - * @throws Exception + * + * @throws Exception */ @Test public void testNavigateTopBottomOffcutColorRanges() throws Exception { @@ -321,7 +322,8 @@ public class ColorizingPluginTest extends AbstractGhidraHeadedIntegrationTest { /** * Tests navigation of offcut ranges when coloring is set from a plugin point-of-view. - * @throws Exception + * + * @throws Exception */ @Test public void testPluginNavigateTopBottomOffcutColorRanges() throws Exception { @@ -625,13 +627,7 @@ public class ColorizingPluginTest extends AbstractGhidraHeadedIntegrationTest { } private void setSelection(FieldPanel fp, FieldSelection sel) { - fp.setSelection(sel); - Class>[] argClasses = new Class>[] { EventTrigger.class }; - Object[] args = new Object[] { EventTrigger.GUI_ACTION }; - - runSwing(() -> { - invokeInstanceMethod("notifySelectionChanged", fp, argClasses, args); - }); + runSwing(() -> fp.setSelection(sel, EventTrigger.GUI_ACTION)); } private ActionContext getActionContext() { diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/disassembler/DisassemblerPluginTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/disassembler/DisassemblerPluginTest.java index 70e0558496..88976c50b6 100644 --- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/disassembler/DisassemblerPluginTest.java +++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/disassembler/DisassemblerPluginTest.java @@ -457,10 +457,7 @@ public class DisassemblerPluginTest extends AbstractGhidraHeadedIntegrationTest } private void setSelection(FieldPanel fp, FieldSelection sel) { - fp.setSelection(sel); - Class>[] argClasses = new Class>[] { EventTrigger.class }; - Object[] args = new Object[] { EventTrigger.GUI_ACTION }; - invokeInstanceMethod("notifySelectionChanged", fp, argClasses, args); + runSwing(() -> fp.setSelection(sel, EventTrigger.GUI_ACTION)); } private void clear(Address addr) { diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/marker/MarkerTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/marker/MarkerTest.java index 10aad15b45..3e8a6f6ee9 100644 --- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/marker/MarkerTest.java +++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/marker/MarkerTest.java @@ -493,10 +493,7 @@ public class MarkerTest extends AbstractGhidraHeadedIntegrationTest { } private void setSelection(FieldPanel fp, FieldSelection sel) { - fp.setSelection(sel); - Class>[] argClasses = new Class>[] { EventTrigger.class }; - Object[] args = new Object[] { EventTrigger.GUI_ACTION }; - runSwing(() -> invokeInstanceMethod("notifySelectionChanged", fp, argClasses, args)); + runSwing(() -> fp.setSelection(sel, EventTrigger.GUI_ACTION)); } private AddressSet getAddresses(MarkerSet ms) { diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/navigation/NextPrevSelectionHighlightTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/navigation/NextPrevSelectionHighlightTest.java index 49d63d31d5..0f7bc1caf5 100644 --- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/navigation/NextPrevSelectionHighlightTest.java +++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/navigation/NextPrevSelectionHighlightTest.java @@ -101,10 +101,7 @@ public class NextPrevSelectionHighlightTest extends AbstractGhidraHeadedIntegrat } private void setSelection(FieldPanel fp, FieldSelection sel) { - fp.setSelection(sel); - Class>[] argClasses = new Class>[] { EventTrigger.class }; - Object[] args = new Object[] { EventTrigger.GUI_ACTION }; - invokeInstanceMethod("notifySelectionChanged", fp, argClasses, args); + runSwing(() -> fp.setSelection(sel, EventTrigger.GUI_ACTION)); } @Test diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/select/RestoreSelectionPluginTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/select/RestoreSelectionPluginTest.java index 7d16518de2..8aff8d8d7d 100644 --- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/select/RestoreSelectionPluginTest.java +++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/select/RestoreSelectionPluginTest.java @@ -223,13 +223,7 @@ public class RestoreSelectionPluginTest extends AbstractGhidraHeadedIntegrationT } private void setSelection(FieldPanel fp, FieldSelection sel) { - fp.setSelection(sel); - Class>[] argClasses = new Class>[] { EventTrigger.class }; - Object[] args = new Object[] { EventTrigger.GUI_ACTION }; - - runSwing(() -> { - invokeInstanceMethod("notifySelectionChanged", fp, argClasses, args); - }); + runSwing(() -> fp.setSelection(sel, EventTrigger.GUI_ACTION)); } private void clearSelection(final Program program) { diff --git a/Ghidra/Features/ByteViewer/src/main/java/ghidra/app/plugin/core/byteviewer/ByteViewerComponent.java b/Ghidra/Features/ByteViewer/src/main/java/ghidra/app/plugin/core/byteviewer/ByteViewerComponent.java index 4c00de8144..b2c8fb1beb 100644 --- a/Ghidra/Features/ByteViewer/src/main/java/ghidra/app/plugin/core/byteviewer/ByteViewerComponent.java +++ b/Ghidra/Features/ByteViewer/src/main/java/ghidra/app/plugin/core/byteviewer/ByteViewerComponent.java @@ -178,7 +178,6 @@ public class ByteViewerComponent extends FieldPanel implements FieldMouseListene */ @Override public void selectionChanged(FieldSelection selection, EventTrigger trigger) { - if (blockSet == null || doingRefresh) { return; } diff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/DecompilerPanel.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/DecompilerPanel.java index 7a901511f8..b2d4b81490 100644 --- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/DecompilerPanel.java +++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/component/DecompilerPanel.java @@ -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. * - *
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. + *
+ * 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(ListgoTo
, 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
+ * goTo
, 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 {
diff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/SelectAllAction.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/SelectAllAction.java
index a98865d569..160e523712 100644
--- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/SelectAllAction.java
+++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/SelectAllAction.java
@@ -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);
}
-
}
diff --git a/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/mvc/FGController.java b/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/mvc/FGController.java
index 6a4515e331..fd1ae8a26a 100644
--- a/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/mvc/FGController.java
+++ b/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/mvc/FGController.java
@@ -288,6 +288,7 @@ public class FGController implements ProgramLocationListener, ProgramSelectionLi
/**
* Sets the message that will appear in the lower part of the graph.
+ *
* @param message the message to display
*/
public void setStatusMessage(String message) {
@@ -336,7 +337,10 @@ public class FGController implements ProgramLocationListener, ProgramSelectionLi
}
@Override
- public void programSelectionChanged(ProgramSelection selection) {
+ public void programSelectionChanged(ProgramSelection selection, EventTrigger trigger) {
+ if (trigger != EventTrigger.GUI_ACTION) {
+ return;
+ }
// We need to translate the given selection (which is from a single vertex) to the current
// overall selection for the graph (which includes the selection from all vertices). We
// do this so that a selection change in one vertex does not clear the selection in
@@ -785,12 +789,13 @@ public class FGController implements ProgramLocationListener, ProgramSelectionLi
}
/**
- * Signals that something major has changed for the program and we don't know where, so
- * clear all cached functions for the given program.
+ * Signals that something major has changed for the program and we don't know where, so clear
+ * all cached functions for the given program.
*
* BLEH!: I don't like clearing the cache this way...another options is to mark all cached
- * values as stale, somehow. If we did this, then when the view reuses the cached
- * data, it could signal to the user that the graph is out-of-date.
+ * values as stale, somehow. If we did this, then when the view reuses the cached data, it could
+ * signal to the user that the graph is out-of-date.
+ *
* @param program the program
*/
public void invalidateAllCacheForProgram(Program program) {
@@ -997,8 +1002,8 @@ public class FGController implements ProgramLocationListener, ProgramSelectionLi
}
/**
- * Update the graph's notion of the current location based upon that of the Tool. This
- * method is meant to be called from internal mutative operations.
+ * Update the graph's notion of the current location based upon that of the Tool. This method is
+ * meant to be called from internal mutative operations.
*/
public void synchronizeProgramLocationAfterEdit() {
// It is assumed that the provider's location is the correct location.
@@ -1007,6 +1012,7 @@ public class FGController implements ProgramLocationListener, ProgramSelectionLi
/**
* Will broadcast the given vertex location to the external system
+ *
* @param location the location coming from the vertex
*/
public void synchronizeProgramLocationToVertex(ProgramLocation location) {
diff --git a/Ghidra/Features/ProgramDiff/src/main/java/ghidra/app/plugin/core/diff/ProgramDiffPlugin.java b/Ghidra/Features/ProgramDiff/src/main/java/ghidra/app/plugin/core/diff/ProgramDiffPlugin.java
index eba347d6c4..21ce1b4ca4 100644
--- a/Ghidra/Features/ProgramDiff/src/main/java/ghidra/app/plugin/core/diff/ProgramDiffPlugin.java
+++ b/Ghidra/Features/ProgramDiff/src/main/java/ghidra/app/plugin/core/diff/ProgramDiffPlugin.java
@@ -724,7 +724,10 @@ public class ProgramDiffPlugin extends ProgramPlugin
* which displays P2.
*/
@Override
- public void programSelectionChanged(ProgramSelection newP2Selection) {
+ public void programSelectionChanged(ProgramSelection newP2Selection, EventTrigger trigger) {
+ if (trigger != EventTrigger.GUI_ACTION) {
+ return;
+ }
setProgram2Selection(newP2Selection);
}
@@ -1831,7 +1834,8 @@ public class ProgramDiffPlugin extends ProgramPlugin
MarkerSet selectionMarkers = getSelectionMarkers();
selectionMarkers.clearAll();
- programSelectionChanged(new ProgramSelection(p2AddressFactory, set));
+ programSelectionChanged(new ProgramSelection(p2AddressFactory, set),
+ EventTrigger.GUI_ACTION);
updatePgm2Enablement();
}
}
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/widgets/fieldpanel/FieldPanel.java b/Ghidra/Framework/Docking/src/main/java/docking/widgets/fieldpanel/FieldPanel.java
index 280612ee87..4d17046b8e 100644
--- a/Ghidra/Framework/Docking/src/main/java/docking/widgets/fieldpanel/FieldPanel.java
+++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/fieldpanel/FieldPanel.java
@@ -15,7 +15,7 @@
*/
package docking.widgets.fieldpanel;
-import static docking.widgets.EventTrigger.*;
+import static docking.widgets.EventTrigger.INTERNAL_ONLY;
import java.awt.*;
import java.awt.event.*;
@@ -392,6 +392,7 @@ public class FieldPanel extends JPanel
/**
* Returns the default background color.
+ *
* @return the default background color.
* @see #getBackground()
*/
@@ -433,6 +434,7 @@ public class FieldPanel extends JPanel
/**
*
* Returns the foreground color.
+ *
* @return the foreground color.
*/
public Color getForegroundColor() {
@@ -441,6 +443,7 @@ public class FieldPanel extends JPanel
/**
* Returns the color used as the background for selected items.
+ *
* @return the color used as the background for selected items.
*/
public Color getSelectionColor() {
@@ -449,6 +452,7 @@ public class FieldPanel extends JPanel
/**
* Returns the color color used as the background for highlighted items.
+ *
* @return the color color used as the background for highlighted items.
*/
public Color getHighlightColor() {
@@ -457,6 +461,7 @@ public class FieldPanel extends JPanel
/**
* Returns the cursor color when this field panel is focused.
+ *
* @return the cursor color when this field panel is focused.
*/
public Color getFocusedCursorColor() {
@@ -465,6 +470,7 @@ public class FieldPanel extends JPanel
/**
* Returns the cursor color when this field panel is not focused.
+ *
* @return the cursor color when this field panel is not focused.
*/
public Color getNonFocusCursorColor() {
@@ -495,6 +501,7 @@ public class FieldPanel extends JPanel
/**
* Returns the point in pixels of where the cursor is located.
+ *
* @return the point in pixels of where the cursor is located.
*/
public Point getCursorPoint() {
@@ -542,6 +549,7 @@ public class FieldPanel extends JPanel
/**
* Adds a selection listener that will be notified while the selection is being created
+ *
* @param listener the listener to be notified
*/
public void addLiveFieldSelectionListener(FieldSelectionListener listener) {
@@ -550,6 +558,7 @@ public class FieldPanel extends JPanel
/**
* Removes the selection listener from being notified when the selection is being created
+ *
* @param listener the listener to be removed from being notified
*/
public void removeLiveFieldSelectionListener(FieldSelectionListener listener) {
@@ -691,6 +700,7 @@ public class FieldPanel extends JPanel
/**
* Returns the current selection.
+ *
* @return the current selection.
*/
public FieldSelection getSelection() {
@@ -699,6 +709,7 @@ public class FieldPanel extends JPanel
/**
* Returns the current highlight (marked area).
+ *
* @return the current highlight (marked area).
*/
public FieldSelection getHighlight() {
@@ -711,12 +722,22 @@ public class FieldPanel extends JPanel
* @param sel the selection to set.
*/
public void setSelection(FieldSelection sel) {
+ setSelection(sel, EventTrigger.API_CALL);
+ }
+
+ /**
+ * Sets the current selection.
+ *
+ * @param sel the selection to set.
+ * @param trigger the cause of the change
+ */
+ public void setSelection(FieldSelection sel, EventTrigger trigger) {
if (!selectionHandler.isSelectionOn()) {
return;
}
selection = new FieldSelection(sel);
repaint();
- notifySelectionChanged(EventTrigger.API_CALL);
+ notifySelectionChanged(trigger);
}
/**
@@ -774,6 +795,7 @@ public class FieldPanel extends JPanel
/**
* Returns the state of the cursor. True if on, false if off.
+ *
* @return the state of the cursor. True if on, false if off.
*/
public boolean isCursorOn() {
@@ -871,6 +893,7 @@ public class FieldPanel extends JPanel
* that layout. For example, if the layout is completely displayed, yPos will be 0. If part of
* the layout is off the top off the screen, then yPos will have a negative value (indicating
* that it begins above the displayable part of the screen.
+ *
* @return the position
*/
public ViewerPosition getViewerPosition() {
@@ -1057,6 +1080,7 @@ public class FieldPanel extends JPanel
/**
* Returns the offset of the cursor from the top of the screen
+ *
* @return the offset of the cursor from the top of the screen
*/
public int getCursorOffset() {
@@ -1253,6 +1277,7 @@ public class FieldPanel extends JPanel
/**
* Finds the layout containing the given y position.
+ *
* @param y the y position.
* @return the layout.
*/
diff --git a/Ghidra/Framework/Docking/src/main/java/docking/widgets/fieldpanel/listener/FieldSelectionListener.java b/Ghidra/Framework/Docking/src/main/java/docking/widgets/fieldpanel/listener/FieldSelectionListener.java
index 29a972b514..cc2e389747 100644
--- a/Ghidra/Framework/Docking/src/main/java/docking/widgets/fieldpanel/listener/FieldSelectionListener.java
+++ b/Ghidra/Framework/Docking/src/main/java/docking/widgets/fieldpanel/listener/FieldSelectionListener.java
@@ -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.
@@ -26,6 +25,7 @@ public interface FieldSelectionListener {
/**
* Called whenever the FieldViewer selection changes.
+ *
* @param selection the new selection.
* @param trigger indicates the cause of the selection changing
*/
diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/address/AddressCollectors.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/address/AddressCollectors.java
new file mode 100644
index 0000000000..b51852086b
--- /dev/null
+++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/address/AddressCollectors.java
@@ -0,0 +1,63 @@
+/* ###
+ * 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.program.model.address;
+
+import java.util.Set;
+import java.util.function.*;
+import java.util.stream.Collector;
+
+/**
+ * Utilities for using addresses and ranges in streams
+ */
+public class AddressCollectors {
+
+ /**
+ * Union a stream of address ranges into a single mutable address set
+ *
+ * @return the address set
+ */
+ public static Collector