EA-118102 - Throwable: ExceptionUtil.currentStackTrace

This commit is contained in:
Egor Ushakov
2018-03-16 15:14:40 +03:00
parent 8a1096c330
commit 33b5d84a2a
3 changed files with 18 additions and 33 deletions
@@ -1,6 +1,4 @@
/*
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.xdebugger.impl.frame;
import com.intellij.ide.DataManager;
@@ -11,6 +9,7 @@ import com.intellij.openapi.CompositeDisposable;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.actionSystem.impl.ActionToolbarImpl;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.ide.CopyPasteManager;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.EmptyRunnable;
@@ -218,6 +217,7 @@ public class XWatchesViewImpl extends XVariablesView implements DnDNativeTarget,
@Override
public void addWatchExpression(@NotNull XExpression expression, int index, final boolean navigateToWatchNode) {
ApplicationManager.getApplication().assertIsDispatchThread();
XDebugSession session = getSession(getTree());
myRootNode.addWatchExpression(session != null ? session.getCurrentStackFrame() : null, expression, index, navigateToWatchNode);
updateSessionData();
@@ -276,6 +276,7 @@ public class XWatchesViewImpl extends XVariablesView implements DnDNativeTarget,
@Override
public void removeWatches(List<? extends XDebuggerTreeNode> nodes) {
ApplicationManager.getApplication().assertIsDispatchThread();
List<? extends WatchNode> children = myRootNode.getWatchChildren();
int minIndex = Integer.MAX_VALUE;
List<XDebuggerTreeNode> toRemove = new ArrayList<>();
@@ -299,6 +300,7 @@ public class XWatchesViewImpl extends XVariablesView implements DnDNativeTarget,
@Override
public void removeAllWatches() {
ApplicationManager.getApplication().assertIsDispatchThread();
myRootNode.removeAllChildren();
updateSessionData();
}
@@ -362,20 +364,13 @@ public class XWatchesViewImpl extends XVariablesView implements DnDNativeTarget,
public void drop(DnDEvent aEvent) {
Object object = aEvent.getAttachedObject();
if (object instanceof XValueNodeImpl[]) {
final XValueNodeImpl[] nodes = (XValueNodeImpl[])object;
for (XValueNodeImpl node : nodes) {
node.getValueContainer().calculateEvaluationExpression().done(expression -> {
if (expression != null) {
//noinspection ConstantConditions
addWatchExpression(expression, -1, false);
}
});
for (XValueNodeImpl node : (XValueNodeImpl[])object) {
DebuggerUIUtil.addToWatches(this, node);
}
}
else if (object instanceof EventInfo) {
String text = ((EventInfo)object).getTextForFlavor(DataFlavor.stringFlavor);
if (text != null) {
//noinspection ConstantConditions
addWatchExpression(XExpressionImpl.fromText(text), -1, false);
}
}
@@ -39,6 +39,7 @@ import com.intellij.xdebugger.impl.XDebuggerUtilImpl;
import com.intellij.xdebugger.impl.breakpoints.XBreakpointBase;
import com.intellij.xdebugger.impl.breakpoints.ui.BreakpointsDialogFactory;
import com.intellij.xdebugger.impl.breakpoints.ui.XLightBreakpointPropertiesPanel;
import com.intellij.xdebugger.impl.frame.XWatchesView;
import com.intellij.xdebugger.impl.ui.tree.XDebuggerTree;
import com.intellij.xdebugger.impl.ui.tree.XDebuggerTreeState;
import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl;
@@ -382,6 +383,14 @@ public class DebuggerUIUtil {
}
}
public static void addToWatches(@NotNull XWatchesView watchesView, @NotNull XValueNodeImpl node) {
node.getValueContainer().calculateEvaluationExpression().onSuccess(expression -> {
if (expression != null) {
invokeLater(() -> watchesView.addWatchExpression(expression, -1, false));
}
});
}
public static void registerActionOnComponent(String name, JComponent component, Disposable parentDisposable) {
AnAction action = ActionManager.getInstance().getAction(name);
action.registerCustomShortcutSet(action.getShortcutSet(), component, parentDisposable);
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.xdebugger.impl.ui.tree.actions;
import com.intellij.openapi.actionSystem.AnActionEvent;
@@ -40,12 +26,7 @@ public class XAddToWatchesTreeAction extends XDebuggerTreeActionBase {
protected void perform(final XValueNodeImpl node, @NotNull final String nodeName, final AnActionEvent e) {
final XWatchesView watchesView = getWatchesView(e);
if (watchesView != null) {
node.getValueContainer().calculateEvaluationExpression()
.done(expression -> {
if (expression != null) {
watchesView.addWatchExpression(expression, -1, true);
}
});
DebuggerUIUtil.addToWatches(watchesView, node);
}
}