File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
src/main/kotlin/com/redhat/devtools/gateway/view Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ import com.redhat.devtools.gateway.openshift.Projects
31
31
import com.redhat.devtools.gateway.openshift.Utils
32
32
import com.redhat.devtools.gateway.util.messageWithoutPrefix
33
33
import com.redhat.devtools.gateway.view.ui.Dialogs
34
+ import com.redhat.devtools.gateway.view.ui.onDoubleClick
34
35
import java.awt.Component
35
36
import javax.swing.DefaultListModel
36
37
import javax.swing.JButton
@@ -82,6 +83,11 @@ class DevSpacesWorkspacesStepView(private var devSpacesContext: DevSpacesContext
82
83
83
84
override fun onInit () {
84
85
listDevWorkspaces.selectionModel.addListSelectionListener(DevWorkspaceSelection ())
86
+ listDevWorkspaces.onDoubleClick {
87
+ if (! listDevWorkspaces.isSelectionEmpty) {
88
+ connect()
89
+ }
90
+ }
85
91
listDevWorkspaces.cellRenderer = DevWorkspaceListRenderer ()
86
92
listDevWorkspaces.setEmptyText(DevSpacesBundle .message(" connector.wizard_step.remote_server_connection.list.empty_text" ))
87
93
refreshAllDevWorkspaces()
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (c) 2024 Red Hat, Inc.
3
+ * This program and the accompanying materials are made
4
+ * available under the terms of the Eclipse Public License 2.0
5
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
6
+ *
7
+ * SPDX-License-Identifier: EPL-2.0
8
+ *
9
+ * Contributors:
10
+ * Red Hat, Inc. - initial API and implementation
11
+ */
12
+ package com.redhat.devtools.gateway.view.ui
13
+
14
+ import java.awt.event.MouseAdapter
15
+ import java.awt.event.MouseEvent
16
+ import javax.swing.JList
17
+
18
+ fun <T > JList<T>.onDoubleClick (action : (T ) -> Unit ) {
19
+ addMouseListener(object : MouseAdapter () {
20
+ override fun mouseClicked (e : MouseEvent ) {
21
+ if (e.clickCount == 2 ) {
22
+ selectedValue?.let { action(it) }
23
+ }
24
+ }
25
+ })
26
+ }
You can’t perform that action at this time.
0 commit comments