IDEA-199540: request focus on tab switching

This commit is contained in:
Sergey Malenkov
2018-10-05 14:37:19 +03:00
parent 7952cf5332
commit 84a25e60d4
@@ -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() {