Navigatable (@NotNull Project project, @NotNull Navigatable navigatable) { return new Navigatable() { @Override public void navigate(boolean requestFocus) { FileEditorManagerEx fileEditorManager = FileEditorManagerEx.getInstanceEx(project); boolean isEditorAreaFocused = IJSwingUtilities.hasFocus(fileEditorManager.getComponent()); navigatable.navigate(requestFocus && isEditorAreaFocused); } @Override public boolean canNavigate() { return navigatable.canNavigate(); } @Override public boolean canNavigateToSource() { return navigatable.canNavigateToSource(); } }; }