void () { XDebugSession session = XDebugView.getSession(myTree); if (session != null) { session.addSessionListener(new XDebugSessionListener() { @Override public void sessionPaused() { cancel(); } @Override public void sessionResumed() { cancel(); } @Override public void sessionStopped() { cancel(); } @Override public void stackFrameChanged() { cancel(); } @Override public void beforeSessionResume() { cancel(); } private void cancel() { AppUIUtil.invokeOnEdt(XDebuggerTreeInplaceEditor.this::cancelEditing); } }, myDisposable); } }