mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-23 04:32:12 +00:00
GT-3455 - Update action key binding collision dialog to allow for mouse
double-click
This commit is contained in:
parent
cf0c434d51
commit
d307623f67
@ -22,6 +22,7 @@ import java.util.List;
|
||||
import javax.swing.*;
|
||||
|
||||
import docking.action.DockingActionIf;
|
||||
import docking.event.mouse.GMouseListenerAdapter;
|
||||
import docking.widgets.label.GIconLabel;
|
||||
import docking.widgets.label.GLabel;
|
||||
|
||||
@ -29,7 +30,7 @@ import docking.widgets.label.GLabel;
|
||||
* Dialog to show multiple actions that are mapped to the same keystroke;
|
||||
* allows the user to select which action to do.
|
||||
*/
|
||||
public class ActionDialog extends DialogComponentProvider {
|
||||
public class MultiActionDialog extends DialogComponentProvider {
|
||||
|
||||
private String keystrokeName;
|
||||
private List<ExecutableKeyActionAdapter> list;
|
||||
@ -41,7 +42,7 @@ public class ActionDialog extends DialogComponentProvider {
|
||||
* @param keystrokeName keystroke name
|
||||
* @param list list of actions
|
||||
*/
|
||||
public ActionDialog(String keystrokeName, List<ExecutableKeyActionAdapter> list) {
|
||||
public MultiActionDialog(String keystrokeName, List<ExecutableKeyActionAdapter> list) {
|
||||
super("Select Action", true);
|
||||
this.keystrokeName = keystrokeName;
|
||||
init();
|
||||
@ -53,6 +54,10 @@ public class ActionDialog extends DialogComponentProvider {
|
||||
*/
|
||||
@Override
|
||||
protected void okCallback() {
|
||||
maybeDoAction();
|
||||
}
|
||||
|
||||
private void maybeDoAction() {
|
||||
int index = actionList.getSelectedIndex();
|
||||
if (index < 0) {
|
||||
return;
|
||||
@ -123,6 +128,13 @@ public class ActionDialog extends DialogComponentProvider {
|
||||
}
|
||||
});
|
||||
|
||||
actionList.addMouseListener(new GMouseListenerAdapter() {
|
||||
@Override
|
||||
public void doubleClickTriggered(MouseEvent e) {
|
||||
maybeDoAction();
|
||||
}
|
||||
});
|
||||
|
||||
actionList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
actionList.setVisibleRowCount(5);
|
||||
JScrollPane listScrollPane = new JScrollPane(actionList);
|
@ -30,7 +30,7 @@ import ghidra.util.Swing;
|
||||
public class MultipleKeyAction extends DockingKeyBindingAction {
|
||||
private List<ActionData> actions = new ArrayList<>();
|
||||
|
||||
private ActionDialog dialog;
|
||||
private MultiActionDialog dialog;
|
||||
|
||||
/**
|
||||
* Creates new MultipleKeyAction
|
||||
@ -133,7 +133,7 @@ public class MultipleKeyAction extends DockingKeyBindingAction {
|
||||
if (list.size() > 1) {
|
||||
// popup dialog to show multiple actions
|
||||
if (dialog == null) {
|
||||
dialog = new ActionDialog(KeyBindingUtils.parseKeyStroke(keyStroke), list);
|
||||
dialog = new MultiActionDialog(KeyBindingUtils.parseKeyStroke(keyStroke), list);
|
||||
}
|
||||
else {
|
||||
dialog.setActionList(list);
|
||||
|
Loading…
Reference in New Issue
Block a user