void (@NotNull Project project, AnActionEvent event) { XDebugSession session = DebuggerUIUtil.getSession(event); if (session == null) return; XValueMarkers<?, ?> markers = ((XDebugSessionImpl)session).getValueMarkers(); XValueNodeImpl node = XDebuggerTreeActionBase.getSelectedNode(event.getDataContext()); if (markers == null || node == null) return; XValue value = node.getValueContainer(); boolean detachedView = DebuggerUIUtil.isInDetachedTree(event); XDebuggerTreeState treeState = XDebuggerTreeState.saveState(node.getTree()); ValueMarkup existing = markers.getMarkup(value); Promise<Object> markPromise; if (existing != null) { markPromise = markers.unmarkValue(value); } else { Component component = event.getData(CONTEXT_COMPONENT); Window window = ComponentUtil.getWindow(component); if (!(window instanceof JFrame) && !(window instanceof JDialog)) { component = window.getOwner(); } ValueMarkerPresentationDialog dialog = new ValueMarkerPresentationDialog( component, node.getName(), markers.getAllMarkers().values()); dialog.show(); ValueMarkup markup = dialog.getConfiguredMarkup(); if (dialog.isOK() && markup != null) { markPromise = markers.markValue(value, markup); } else { return; } } markPromise.onSuccess(__ -> UIUtil.invokeLaterIfNeeded(() -> { if (detachedView) { node.getTree().rebuildAndRestore(treeState); } session.rebuildViews(); }) ); }