void () { String currentFrameThreadId = null; final XStackFrame currentFrame = session.getCurrentStackFrame(); if (currentFrame instanceof PyStackFrame) { currentFrameThreadId = ((PyStackFrame)currentFrame).getThreadId(); } final XExecutionStack activeStack = session.getSuspendContext().getActiveExecutionStack(); if ((activeStack == null) || (currentFrameThreadId == null)) { return; } final XStackFrame frameFromSuspendContext = activeStack.getTopFrame(); String activeStackThreadId = null; if (frameFromSuspendContext instanceof PyStackFrame) { activeStackThreadId = ((PyStackFrame)frameFromSuspendContext).getThreadId(); } if (!currentFrameThreadId.equals(activeStackThreadId)) { // another thread was selected, we should update suspendContext PyThreadInfo threadInfo = null; for (PyThreadInfo info : mySuspendedThreads) { if (info.getId().equals(currentFrameThreadId)) { threadInfo = info; break; } } if (threadInfo != null) { getSession().positionReached(createSuspendContext(threadInfo)); } } PyFrameListener.publisher().frameChanged(); for (PyFrameListener listener : myFrameListeners) { listener.frameChanged(); } }