correctly show watches tab after add to watch even in mixed watches/variables mode

This commit is contained in:
Egor.Ushakov
2016-03-18 13:08:25 +03:00
parent 482f105796
commit c42ffe6014
2 changed files with 17 additions and 18 deletions
@@ -15,8 +15,6 @@
*/
package com.intellij.xdebugger.impl.frame;
import com.intellij.debugger.ui.DebuggerContentInfo;
import com.intellij.execution.ui.layout.impl.RunnerContentUi;
import com.intellij.icons.AllIcons;
import com.intellij.ide.DataManager;
import com.intellij.ide.dnd.DnDEvent;
@@ -292,22 +290,7 @@ public class XWatchesViewImpl extends XVariablesView implements DnDNativeTarget,
myRootNode.addWatchExpression(session != null ? session.getCurrentStackFrame() : null, expression, index, navigateToWatchNode);
updateSessionData();
if (navigateToWatchNode && session != null) {
showWatchesTab((XDebugSessionImpl)session);
}
}
private static void showWatchesTab(@NotNull XDebugSessionImpl session) {
XDebugSessionTab tab = session.getSessionTab();
if (tab != null) {
tab.toFront(false, null);
// restore watches tab if minimized
JComponent component = tab.getUi().getComponent();
if (component instanceof DataProvider) {
RunnerContentUi ui = RunnerContentUi.KEY.getData(((DataProvider)component));
if (ui != null) {
ui.restoreContent(DebuggerContentInfo.WATCHES_CONTENT);
}
}
XDebugSessionTab.showWatchesView((XDebugSessionImpl)session);
}
}
@@ -24,6 +24,7 @@ import com.intellij.execution.ui.RunContentDescriptor;
import com.intellij.execution.ui.RunnerLayoutUi;
import com.intellij.execution.ui.actions.CloseAction;
import com.intellij.execution.ui.layout.PlaceInGrid;
import com.intellij.execution.ui.layout.impl.RunnerContentUi;
import com.intellij.execution.ui.layout.impl.ViewImpl;
import com.intellij.icons.AllIcons;
import com.intellij.ide.DataManager;
@@ -340,6 +341,21 @@ public class XDebugSessionTab extends DebuggerSessionTabBase {
}
}
public static void showWatchesView(@NotNull XDebugSessionImpl session) {
XDebugSessionTab tab = session.getSessionTab();
if (tab != null) {
tab.toFront(false, null);
// restore watches tab if minimized
JComponent component = tab.getUi().getComponent();
if (component instanceof DataProvider) {
RunnerContentUi ui = RunnerContentUi.KEY.getData(((DataProvider)component));
if (ui != null) {
ui.restoreContent(tab.myWatchesInVariables ? DebuggerContentInfo.VARIABLES_CONTENT : DebuggerContentInfo.WATCHES_CONTENT);
}
}
}
}
private void registerView(String contentId, @NotNull XDebugView view) {
myViews.put(contentId, view);
Disposer.register(myRunContentDescriptor, view);