diff --git a/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/AllFileTemplatesConfigurable.java b/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/AllFileTemplatesConfigurable.java index a6c4d68f3a34..cb79b5709bf5 100644 --- a/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/AllFileTemplatesConfigurable.java +++ b/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/AllFileTemplatesConfigurable.java @@ -359,12 +359,15 @@ public class AllFileTemplatesConfigurable implements SearchableConfigurable, Con private void onTabChanged() { applyEditor(myCurrentTab.getSelectedTemplate()); + FileTemplateTab tab = myCurrentTab; final int selectedIndex = myTabbedPane.getSelectedIndex(); if (0 <= selectedIndex && selectedIndex < myTabs.length) { myCurrentTab = myTabs[selectedIndex]; } ((CardLayout)myLeftPanel.getLayout()).show(myLeftPanel, myCurrentTab.getTitle()); onListSelectionChanged(); + // request focus to a list (or tree) later to avoid moving focus to the tabbed pane + if (tab != myCurrentTab) EventQueue.invokeLater(myCurrentTab.getComponent()::requestFocus); } private void onListSelectionChanged() {