From c9a83faec0f5a4be0e5f8ca4c529a21513b8ba09 Mon Sep 17 00:00:00 2001 From: "Svetlana.Zemlyanskaya" Date: Fri, 4 Nov 2016 16:30:30 +0100 Subject: [PATCH] WI-33168 Application no longer takes focus when hitting a breakpoint in 2016.3 EAP during PHP Debug --- .../xdebugger/impl/XDebugSessionImpl.java | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java index ef7555abc4ba..e394c2b8bda9 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java @@ -785,20 +785,21 @@ public class XDebugSessionImpl implements XDebugSession { updateExecutionPosition(); - if (myShowTabOnSuspend.compareAndSet(true, false)) { + final boolean showOnSuspend = myShowTabOnSuspend.compareAndSet(true, false); + if (showOnSuspend || attract) { AppUIUtil.invokeLaterIfProjectAlive(myProject, () -> { - initSessionTab(null); - showSessionTab(); - }); - } + if (showOnSuspend) { + initSessionTab(null); + showSessionTab(); + } - myDispatcher.getMulticaster().sessionPaused(); - - // user attractions should only be made if event happens independently (e.g. program paused/suspended) - // and should not be made when user steps in the code - if (attract) { - UIUtil.invokeLaterIfNeeded(() -> { - if (mySessionTab != null) { + // user attractions should only be made if event happens independently (e.g. program paused/suspended) + // and should not be made when user steps in the code + if (attract) { + if (mySessionTab == null) { + LOG.warn("Can not request focus because Session Tab is not initialized yet"); + return; + } if (XDebuggerSettingManagerImpl.getInstanceImpl().getGeneralSettings().isShowDebuggerOnBreakpoint()) { mySessionTab.toFront(true, this::updateExecutionPosition); @@ -814,6 +815,8 @@ public class XDebugSessionImpl implements XDebugSession { } }); } + + myDispatcher.getMulticaster().sessionPaused(); } @Override