IdeFocusManager () { IdeFocusManager focusManager = null; Application app = ApplicationManager.getApplication(); if (app != null && LoadingState.COMPONENTS_REGISTERED.isOccurred()) { focusManager = app.getService(IdeFocusManager.class); } // happens when app is semi-initialized (e.g. when IDEA server dialog is shown) return focusManager == null ? PassThroughIdeFocusManager.getInstance() : focusManager; }