mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-06 12:00:04 +02:00
Merge remote-tracking branch 'origin/GP-157_ghidravore_live_selection_listener'
This commit is contained in:
commit
ced9c88e34
1 changed files with 29 additions and 1 deletions
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
package docking.widgets.fieldpanel;
|
||||
|
||||
import static docking.widgets.EventTrigger.INTERNAL_ONLY;
|
||||
import static docking.widgets.EventTrigger.*;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
|
@ -74,6 +74,7 @@ public class FieldPanel extends JPanel
|
|||
private List<ViewListener> viewListeners = new ArrayList<>();
|
||||
private List<FieldSelectionListener> selectionListeners = new ArrayList<>();
|
||||
private List<FieldSelectionListener> highlightListeners = new ArrayList<>();
|
||||
private List<FieldSelectionListener> liveSelectionListeners = new ArrayList<>();
|
||||
private List<AnchoredLayout> layouts = new ArrayList<>();
|
||||
|
||||
private int currentViewXpos;
|
||||
|
@ -528,6 +529,22 @@ public class FieldPanel extends JPanel
|
|||
selectionListeners.remove(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
liveSelectionListeners.add(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
liveSelectionListeners.remove(listener);
|
||||
}
|
||||
|
||||
public void addHighlightListener(FieldSelectionListener listener) {
|
||||
selectionListeners.add(listener);
|
||||
}
|
||||
|
@ -1266,6 +1283,16 @@ public class FieldPanel extends JPanel
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notifies all live listeners that the selection changed.
|
||||
*/
|
||||
private void notifyLiveSelectionChanged() {
|
||||
FieldSelection currentSelection = new FieldSelection(selection);
|
||||
for (FieldSelectionListener l : liveSelectionListeners) {
|
||||
l.selectionChanged(currentSelection, EventTrigger.GUI_ACTION);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notifies all listeners that the selection changed.
|
||||
*/
|
||||
|
@ -1788,6 +1815,7 @@ public class FieldPanel extends JPanel
|
|||
}
|
||||
scrollPoint = new FieldLocation(point);
|
||||
updateSelection(!removeFromSelection);
|
||||
notifyLiveSelectionChanged();
|
||||
}
|
||||
|
||||
private void updateSelection(boolean add) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue