void () { XFramesView framesView = getView(DebuggerContentInfo.FRAME_CONTENT, XFramesView.class); XVariablesViewBase variablesView = getView(DebuggerContentInfo.VARIABLES_CONTENT, XVariablesViewBase.class); if (framesView == null || variablesView == null) return; framesView.onFrameSelectionKeyPressed(frame -> { Content content = findOrRestoreContentIfNeeded(DebuggerContentInfo.VARIABLES_CONTENT); if (content == null) return; getUi().selectAndFocus(content, true, true).doWhenDone(() -> { // Don't ruin an old selection from the saved tree state (if any) while it's being restored. // Most of the time restoring the selection is fast enough. But even if it's not, // the variables view is focused instantly, so the user can still use the arrow keys // for navigating through the variables loaded so far. The tree restorer, in turn, // is careful enough to not reset the selection if the user happened to change it already. variablesView.onReady().whenComplete((node, throwable) -> { if (node != null && node.getTree().isSelectionEmpty()) { node.getTree().setSelectionRow(0); } }); }); }); }