From 3b3c394e01d575c11e3e49403330d926d5a5198e Mon Sep 17 00:00:00 2001 From: Fred Bricon Date: Tue, 14 Nov 2023 17:15:43 +0100 Subject: [PATCH] feat: add focus to preferred components in Quarkus wizard Signed-off-by: Fred Bricon --- .../quarkus/projectWizard/QuarkusExtensionsStep.java | 9 ++++++++- .../quarkus/projectWizard/QuarkusModuleInfoStep.java | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/redhat/devtools/intellij/quarkus/projectWizard/QuarkusExtensionsStep.java b/src/main/java/com/redhat/devtools/intellij/quarkus/projectWizard/QuarkusExtensionsStep.java index 920c12405..dbcda9852 100644 --- a/src/main/java/com/redhat/devtools/intellij/quarkus/projectWizard/QuarkusExtensionsStep.java +++ b/src/main/java/com/redhat/devtools/intellij/quarkus/projectWizard/QuarkusExtensionsStep.java @@ -53,6 +53,7 @@ public class QuarkusExtensionsStep extends ModuleWizardStep implements Disposabl private JPanel outerPanel; private final WizardContext wizardContext; + private SearchTextField filter; private static class ExtensionsTreeCellRenderer extends CheckboxTree.CheckboxTreeCellRenderer { @@ -135,7 +136,7 @@ public JComponent getComponent() { JLabel label1 = new JLabel("Filter extensions"); label1.setAlignmentX(Component.LEFT_ALIGNMENT); panel.add(label1); - SearchTextField filter = new SearchTextField() { + filter = new SearchTextField() { @Override public Dimension getMaximumSize() { Dimension maxSize = super.getMaximumSize(); @@ -223,6 +224,12 @@ public void valueChanged(TreeSelectionEvent e) { return outerPanel; } + + @Override + public JComponent getPreferredFocusedComponent() { + return filter; + } + private KeyListener onSelectedExtensionsKeyPressed(List categories, CheckboxTree extensionsTree, JList selectedExtensions) { return new KeyAdapter() { @Override diff --git a/src/main/java/com/redhat/devtools/intellij/quarkus/projectWizard/QuarkusModuleInfoStep.java b/src/main/java/com/redhat/devtools/intellij/quarkus/projectWizard/QuarkusModuleInfoStep.java index 3dc88df6e..5f2cafd4c 100644 --- a/src/main/java/com/redhat/devtools/intellij/quarkus/projectWizard/QuarkusModuleInfoStep.java +++ b/src/main/java/com/redhat/devtools/intellij/quarkus/projectWizard/QuarkusModuleInfoStep.java @@ -202,6 +202,11 @@ protected void customizeCellRenderer(@NotNull JList isInitialized = true; } + @Override + public JComponent getPreferredFocusedComponent() { + return toolComboBox; + } + private Future loadExtensionsModel(CollectionComboBoxModel streamModel, ProgressIndicator indicator) { String key = ((QuarkusStream) streamModel.getSelectedItem()).getKey(); if (key == null) {