void (final SelectInContext context, final boolean requestFocus) { @SuppressWarnings("ConstantConditions") final FileEditor fileEditor = context.getFileEditorProvider().openFileEditor(); StructureViewWrapper customStructureView = CUSTOM_STRUCTURE_VIEW_KEY.get(context.getVirtualFile()); if (customStructureView != null) { customStructureView.selectCurrentElement(fileEditor, context.getVirtualFile(), requestFocus); return; } ToolWindowManager windowManager = ToolWindowManager.getInstance(context.getProject()); final Runnable runnable = () -> StructureViewFactoryEx.getInstanceEx(myProject).runWhenInitialized( () -> getStructureViewWrapper().selectCurrentElement(fileEditor, context.getVirtualFile(), requestFocus)); if (requestFocus) { ToolWindow window = windowManager.getToolWindow(getToolWindowId()); // not all startup activities might have passed? if (window != null) { window.activate(runnable); } } else { runnable.run(); } }