From ef01f8c4df41081df292dbbf630547b6d54a4fc8 Mon Sep 17 00:00:00 2001 From: Arseny Chernyaev Date: Wed, 11 Apr 2018 19:48:59 +0300 Subject: [PATCH] add currentSessionChanged method to XDebuggerManagerListener --- .../intellij/xdebugger/XDebuggerManagerListener.java | 10 ++++++++-- .../intellij/xdebugger/impl/XDebuggerManagerImpl.java | 10 ++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/platform/xdebugger-api/src/com/intellij/xdebugger/XDebuggerManagerListener.java b/platform/xdebugger-api/src/com/intellij/xdebugger/XDebuggerManagerListener.java index 22b98061ae38..0147bc2792e5 100644 --- a/platform/xdebugger-api/src/com/intellij/xdebugger/XDebuggerManagerListener.java +++ b/platform/xdebugger-api/src/com/intellij/xdebugger/XDebuggerManagerListener.java @@ -16,10 +16,16 @@ package com.intellij.xdebugger; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public interface XDebuggerManagerListener { - void processStarted(@NotNull XDebugProcess debugProcess); + default void processStarted(@NotNull XDebugProcess debugProcess) { + } - void processStopped(@NotNull XDebugProcess debugProcess); + default void processStopped(@NotNull XDebugProcess debugProcess) { + } + + default void currentSessionChanged(@Nullable XDebugSession previousSession, @Nullable XDebugSession currentSession) { + } } \ No newline at end of file diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerManagerImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerManagerImpl.java index d5fbcf014f6d..fff0bfc0de61 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerManagerImpl.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerManagerImpl.java @@ -227,7 +227,7 @@ public class XDebuggerManagerImpl extends XDebuggerManager implements Persistent sessionTab.getRunContentDescriptor()); } if (myActiveSession.compareAndSet(session, null)) { - onActiveSessionChanged(); + onActiveSessionChanged(session, null); } } @@ -240,12 +240,13 @@ public class XDebuggerManagerImpl extends XDebuggerManager implements Persistent } } - private void onActiveSessionChanged() { + private void onActiveSessionChanged(@Nullable XDebugSession previousSession, @Nullable XDebugSession currentSession) { myBreakpointManager.getLineBreakpointManager().queueAllBreakpointsUpdate(); ApplicationManager.getApplication().invokeLater(() -> { ValueLookupManager.getInstance(myProject).hideHint(); DebuggerUIUtil.repaintCurrentEditor(myProject); // to update inline debugger data }, myProject.getDisposed()); + myProject.getMessageBus().syncPublisher(TOPIC).currentSessionChanged(previousSession, currentSession); } @Override @@ -287,7 +288,8 @@ public class XDebuggerManagerImpl extends XDebuggerManager implements Persistent } void setCurrentSession(@Nullable XDebugSessionImpl session) { - boolean sessionChanged = myActiveSession.getAndSet(session) != session; + XDebugSessionImpl previousSession = myActiveSession.getAndSet(session); + boolean sessionChanged = previousSession != session; if (sessionChanged) { if (session != null) { XDebugSessionTab tab = session.getSessionTab(); @@ -298,7 +300,7 @@ public class XDebuggerManagerImpl extends XDebuggerManager implements Persistent else { myExecutionPointHighlighter.hide(); } - onActiveSessionChanged(); + onActiveSessionChanged(previousSession, session); } }