22
22
import javax .swing .*;
23
23
24
24
import docking .action .DockingActionIf ;
25
+ import docking .event .mouse .GMouseListenerAdapter ;
25
26
import docking .widgets .label .GIconLabel ;
26
27
import docking .widgets .label .GLabel ;
27
28
28
29
/**
29
30
* Dialog to show multiple actions that are mapped to the same keystroke;
30
31
* allows the user to select which action to do.
31
32
*/
32
- public class ActionDialog extends DialogComponentProvider {
33
+ public class MultiActionDialog extends DialogComponentProvider {
33
34
34
35
private String keystrokeName ;
35
36
private List <ExecutableKeyActionAdapter > list ;
@@ -41,7 +42,7 @@ public class ActionDialog extends DialogComponentProvider {
41
42
* @param keystrokeName keystroke name
42
43
* @param list list of actions
43
44
*/
44
- public ActionDialog (String keystrokeName , List <ExecutableKeyActionAdapter > list ) {
45
+ public MultiActionDialog (String keystrokeName , List <ExecutableKeyActionAdapter > list ) {
45
46
super ("Select Action" , true );
46
47
this .keystrokeName = keystrokeName ;
47
48
init ();
@@ -53,6 +54,10 @@ public ActionDialog(String keystrokeName, List<ExecutableKeyActionAdapter> list)
53
54
*/
54
55
@ Override
55
56
protected void okCallback () {
57
+ maybeDoAction ();
58
+ }
59
+
60
+ private void maybeDoAction () {
56
61
int index = actionList .getSelectedIndex ();
57
62
if (index < 0 ) {
58
63
return ;
@@ -123,6 +128,13 @@ else if (evt.getKeyCode() == KeyEvent.VK_ESCAPE) {
123
128
}
124
129
});
125
130
131
+ actionList .addMouseListener (new GMouseListenerAdapter () {
132
+ @ Override
133
+ public void doubleClickTriggered (MouseEvent e ) {
134
+ maybeDoAction ();
135
+ }
136
+ });
137
+
126
138
actionList .setSelectionMode (ListSelectionModel .SINGLE_SELECTION );
127
139
actionList .setVisibleRowCount (5 );
128
140
JScrollPane listScrollPane = new JScrollPane (actionList );
0 commit comments