mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 10:49:34 +02:00
GP-3051 - Updated the Front End Project Table to allow users to change
selected rows by clicking any already selected row.
This commit is contained in:
parent
3e03a86117
commit
d0ce510437
1 changed files with 17 additions and 3 deletions
|
@ -243,7 +243,7 @@ public class ProjectDataTableDnDHandler implements DragSourceListener, DragGestu
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<DomainFileInfo> createSelectionList(GTable tableToSelect) {
|
private List<DomainFileInfo> createSelectionList(GTable tableToSelect) {
|
||||||
ArrayList<DomainFileInfo> list = new ArrayList<DomainFileInfo>();
|
ArrayList<DomainFileInfo> list = new ArrayList<>();
|
||||||
|
|
||||||
int[] rows = table.getSelectedRows();
|
int[] rows = table.getSelectedRows();
|
||||||
|
|
||||||
|
@ -273,7 +273,7 @@ public class ProjectDataTableDnDHandler implements DragSourceListener, DragGestu
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object getDomainFileList() {
|
private Object getDomainFileList() {
|
||||||
List<DomainFile> domainFileList = new ArrayList<DomainFile>();
|
List<DomainFile> domainFileList = new ArrayList<>();
|
||||||
for (DomainFileInfo domainFileInfo : list) {
|
for (DomainFileInfo domainFileInfo : list) {
|
||||||
domainFileList.add(domainFileInfo.getDomainFile());
|
domainFileList.add(domainFileInfo.getDomainFile());
|
||||||
}
|
}
|
||||||
|
@ -294,10 +294,12 @@ public class ProjectDataTableDnDHandler implements DragSourceListener, DragGestu
|
||||||
private class DnDMouseListener extends MouseAdapter {
|
private class DnDMouseListener extends MouseAdapter {
|
||||||
|
|
||||||
private boolean consuming = false;
|
private boolean consuming = false;
|
||||||
|
private boolean didDrag = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mousePressed(MouseEvent e) {
|
public void mousePressed(MouseEvent e) {
|
||||||
consuming = maybeConsumeEvent(e);
|
consuming = maybeConsumeEvent(e);
|
||||||
|
didDrag = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -309,12 +311,24 @@ public class ProjectDataTableDnDHandler implements DragSourceListener, DragGestu
|
||||||
// continue to consume the event that was started during the pressed event, for symmetry
|
// continue to consume the event that was started during the pressed event, for symmetry
|
||||||
maybeConsumeEvent(e);
|
maybeConsumeEvent(e);
|
||||||
consuming = false;
|
consuming = false;
|
||||||
|
|
||||||
|
if (!didDrag) {
|
||||||
|
//
|
||||||
|
// If we dragged, leave the initial selection, which does not disrupt the user's
|
||||||
|
// workflow; otherwise, select the clicked row. This allows users to change the
|
||||||
|
// selection by clicking in the table, which is the default table behavior.
|
||||||
|
//
|
||||||
|
table.clearSelection();
|
||||||
|
int row = table.rowAtPoint(e.getPoint());
|
||||||
|
table.selectRow(row);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseDragged(MouseEvent e) {
|
public void mouseDragged(MouseEvent e) {
|
||||||
// always consume the drag so that Java does not change the selection
|
// always consume the drag so that Java does not change the selection
|
||||||
e.consume();
|
e.consume();
|
||||||
|
didDrag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean maybeConsumeEvent(MouseEvent e) {
|
private boolean maybeConsumeEvent(MouseEvent e) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue