fskorgen opened a new issue, #8114:
URL: https://github.com/apache/hop/issues/8114

   ### Apache Hop version?
   
   2.19
   
   ### Java version?
   
   21
   
   ### Operating system
   
   Windows
   
   ### What happened?
   
   Pressing F8 on a pipeline (or workflow) opens the Run Options dialog. 
Pressing Enter does not
   launch. The keystroke goes to whatever control has focus instead: the Cancel 
button, or — when
   focus is in the Parameters grid — it opens the cell editor on the first 
parameter row.
   
   The keyboard flow "F8, Enter" to run the current pipeline is broken; the 
mouse has to be used.
   
   ### Cause
   
   `ConfigurationDialog.openDialog()` sets the default button but never sets 
focus:
   
   ```java
   protected void openDialog() {
     // Set the focus on the OK button
     shell.setDefaultButton(wOk);
     BaseDialog.defaultShellHandling(shell, c -> ok(), c -> cancel());
   }
   ```
   
   `Shell.setDefaultButton()` does not move focus. On open, SWT focuses the 
first created child of the
   shell. `buttonsSectionLayout()` creates Cancel before Launch, and it is 
called first in
   `PipelineExecutionConfigurationDialog.open()` and 
`WorkflowExecutionConfigurationDialog.open()`, so
   Cancel takes the initial focus. A focused push button consumes Enter itself, 
so the default button
   never sees it; and once focus is in the parameters `TableView`, Enter is 
consumed there to start
   cell editing ("Return: edit the first field in the row").
   
   The comment above the line says the focus is set on the OK button, so that 
was the intent.
   
   ### Steps to reproduce
   
   1. Open any pipeline in HopGui.
   2. Press F8.
   3. Press Enter.
   
   **Expected:** the pipeline starts.
   **Actual:** it does not. Either the dialog closes without running (focus on 
Cancel) or the first
   parameter cell opens for editing (focus in the Parameters grid).
   
   ### Suggested fix
   
   Focus the button explicitly, queued so it runs after the shell has opened 
and taken activation
   focus:
   
   ```java
   protected void openDialog() {
     shell.setDefaultButton(wOk);
     shell.getDisplay().asyncExec(() -> {
           if (!wOk.isDisposed()) {
             wOk.setFocus();
           }
         });
     BaseDialog.defaultShellHandling(shell, c -> ok(), c -> cancel());
   }
   ```
   
   One change in `ConfigurationDialog` covers both the pipeline and the 
workflow Run Options dialog.
   
   ### Issue Priority
   
   Priority: 3
   
   ### Issue Component
   
   Component: Hop Gui


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to