void () { myKeyField.selectAll(); //todo[peter,kirillk] without these invokeLaters this requestFocus conflicts with com.intellij.openapi.ui.impl.DialogWrapperPeerImpl.MyDialog.MyWindowListener.windowOpened() IdeFocusManager.findInstanceByComponent(myKeyField).requestFocus(myKeyField, true); final ModalityState modalityState = ModalityState.stateForComponent(myKeyField); ApplicationManager.getApplication().invokeLater(() -> ApplicationManager.getApplication().invokeLater(() -> ApplicationManager.getApplication().invokeLater(() -> IdeFocusManager.findInstanceByComponent(myKeyField).requestFocus(myKeyField, true), modalityState), modalityState), modalityState); }