IDEA-48873 Add easy access to exception stacktrace for exception objects - added a checkbox to disable this

This commit is contained in:
Egor Ushakov
2017-11-20 15:13:02 +03:00
parent 968f100606
commit 20473245ac
5 changed files with 14 additions and 21 deletions
@@ -40,6 +40,7 @@ public class DebuggerDataViewsConfigurable implements SearchableConfigurable {
private JCheckBox myCbShowObjectId;
private JCheckBox myCbShowStringsType;
private JCheckBox myCbHexValue;
private JCheckBox myCbPopulateThrowableStack;
private StateRestoringCheckBox myCbShowStaticFinalFields;
//private final ArrayRendererConfigurable myArrayRendererConfigurable;
@@ -110,6 +111,7 @@ public class DebuggerDataViewsConfigurable implements SearchableConfigurable {
myCbShowObjectId = new JCheckBox(DebuggerBundle.message("label.base.renderer.configurable.show.object.id"));
myCbHexValue = new JCheckBox(DebuggerBundle.message("label.base.renderer.configurable.show.hex.value"));
myCbShowStringsType = new JCheckBox(DebuggerBundle.message("label.base.renderer.configurable.show.strings.type"));
myCbPopulateThrowableStack = new JCheckBox(DebuggerBundle.message("label.base.renderer.configurable.populate.throwable.stack"));
myCbEnableToString = new JCheckBox(DebuggerBundle.message("label.base.renderer.configurable.enable.toString"));
myRbAllThatOverride = new JRadioButton(DebuggerBundle.message("label.base.renderer.configurable.all.overriding"));
@@ -160,6 +162,7 @@ public class DebuggerDataViewsConfigurable implements SearchableConfigurable {
panel.add(myCbShowStringsType, new GridBagConstraints(0, RELATIVE, 3, 1, 1.0, 0.0, NORTH, HORIZONTAL, JBUI.emptyInsets(), 0, 0));
panel.add(myCbHexValue, new GridBagConstraints(0, RELATIVE, 3, 1, 1.0, 0.0, NORTH, HORIZONTAL, JBUI.insetsTop(4), 0, 0));
panel.add(myCbHideNullArrayElements, new GridBagConstraints(0, RELATIVE, 3, 1, 1.0, 0.0, NORTH, HORIZONTAL, JBUI.insetsTop(4), 0, 0));
panel.add(myCbPopulateThrowableStack, new GridBagConstraints(0, RELATIVE, 3, 1, 1.0, 0.0, NORTH, HORIZONTAL, JBUI.insetsTop(4), 0, 0));
panel.add(myCbEnableAlternateViews, new GridBagConstraints(0, RELATIVE, 1, 1, 0.0, 0.0, WEST, NONE, JBUI.insets(4, 0, 0, 10), 0, 0));
// starting 4-th row
@@ -180,6 +183,7 @@ public class DebuggerDataViewsConfigurable implements SearchableConfigurable {
generalSettings.AUTOSCROLL_TO_NEW_LOCALS = myCbAutoscroll.isSelected();
rendererSettings.setAlternateCollectionViewsEnabled(myCbEnableAlternateViews.isSelected());
generalSettings.HIDE_NULL_ARRAY_ELEMENTS = myCbHideNullArrayElements.isSelected();
generalSettings.POPULATE_THROWABLE_STACKTRACE = myCbPopulateThrowableStack.isSelected();
final ClassRenderer classRenderer = rendererSettings.getClassRenderer();
classRenderer.SHOW_STATIC = myCbShowStatic.isSelected();
@@ -210,6 +214,7 @@ public class DebuggerDataViewsConfigurable implements SearchableConfigurable {
myCbAutoscroll.setSelected(generalSettings.AUTOSCROLL_TO_NEW_LOCALS);
myCbHideNullArrayElements.setSelected(generalSettings.HIDE_NULL_ARRAY_ELEMENTS);
myCbEnableAlternateViews.setSelected(rendererSettings.areAlternateCollectionViewsEnabled());
myCbPopulateThrowableStack.setSelected(generalSettings.POPULATE_THROWABLE_STACKTRACE);
ClassRenderer classRenderer = rendererSettings.getClassRenderer();
@@ -251,7 +256,8 @@ public class DebuggerDataViewsConfigurable implements SearchableConfigurable {
private boolean areGeneralSettingsModified() {
ViewsGeneralSettings generalSettings = ViewsGeneralSettings.getInstance();
return generalSettings.AUTOSCROLL_TO_NEW_LOCALS != myCbAutoscroll.isSelected() ||
generalSettings.HIDE_NULL_ARRAY_ELEMENTS != myCbHideNullArrayElements.isSelected();
generalSettings.HIDE_NULL_ARRAY_ELEMENTS != myCbHideNullArrayElements.isSelected() ||
generalSettings.POPULATE_THROWABLE_STACKTRACE != myCbPopulateThrowableStack.isSelected();
}
private boolean areDefaultRenderersModified() {
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2016 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-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.
package com.intellij.debugger.settings;
import com.intellij.openapi.components.PersistentStateComponent;
@@ -29,6 +15,7 @@ public class ViewsGeneralSettings implements PersistentStateComponent<ViewsGener
public boolean SHOW_OBJECTID = true;
public boolean HIDE_NULL_ARRAY_ELEMENTS = true;
public boolean AUTOSCROLL_TO_NEW_LOCALS = true;
public boolean POPULATE_THROWABLE_STACKTRACE = true;
public static ViewsGeneralSettings getInstance() {
return ServiceManager.getService(ViewsGeneralSettings.class);
@@ -49,6 +36,7 @@ public class ViewsGeneralSettings implements PersistentStateComponent<ViewsGener
ViewsGeneralSettings generalSettings = ((ViewsGeneralSettings)object);
return SHOW_OBJECTID == generalSettings.SHOW_OBJECTID &&
HIDE_NULL_ARRAY_ELEMENTS == generalSettings.HIDE_NULL_ARRAY_ELEMENTS &&
AUTOSCROLL_TO_NEW_LOCALS == generalSettings.AUTOSCROLL_TO_NEW_LOCALS;
AUTOSCROLL_TO_NEW_LOCALS == generalSettings.AUTOSCROLL_TO_NEW_LOCALS &&
POPULATE_THROWABLE_STACKTRACE == generalSettings.POPULATE_THROWABLE_STACKTRACE;
}
}
@@ -14,10 +14,10 @@ import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
import com.intellij.debugger.impl.DebuggerContextImpl;
import com.intellij.debugger.impl.PositionUtil;
import com.intellij.debugger.settings.NodeRendererSettings;
import com.intellij.debugger.settings.ViewsGeneralSettings;
import com.intellij.debugger.ui.tree.FieldDescriptor;
import com.intellij.debugger.ui.tree.NodeDescriptor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.CommonClassNames;
import com.intellij.psi.JavaPsiFacade;
@@ -102,7 +102,7 @@ public class FieldDescriptorImpl extends ValueDescriptorImpl implements FieldDes
private boolean populateExceptionStackTraceIfNeeded(Value value, EvaluationContextImpl evaluationContext) {
if ("stackTrace".equals(getName()) &&
Registry.is("debugger.populate.exception.stack") &&
ViewsGeneralSettings.getInstance().POPULATE_THROWABLE_STACKTRACE &&
value instanceof ArrayReference &&
((ArrayReference)value).length() == 0 &&
DebuggerUtils.instanceOf(myObject.type(), CommonClassNames.JAVA_LANG_THROWABLE)) {
@@ -368,8 +368,6 @@ debugger.keep.step.requests=false
debugger.enable.memory.view=true
debugger.enable.overhead.monitor=true
debugger.tree.states.depth=100
debugger.populate.exception.stack=true
debugger.populate.exception.stack.description=Automatically fill exception's stacktrace by calling getStackTrace
analyze.exceptions.on.the.fly=false
analyze.exceptions.on.the.fly.description=Automatically analyze clipboard on frame activation,\
@@ -204,6 +204,7 @@ label.base.renderer.configurable.show.fq.names=Fully &qualified names
label.base.renderer.configurable.show.object.id=Object &id
label.base.renderer.configurable.show.hex.value=Show hex value for primitives
label.base.renderer.configurable.show.strings.type=Show type for strings
label.base.renderer.configurable.populate.throwable.stack=Auto populate Throwable object's stacktrace
label.base.renderer.configurable.alternate.view=Enable alternative view for Coll&ections classes
label.base.renderer.configurable.enable.toString=Enable 't&oString()' object view:
label.base.renderer.configurable.all.overriding=For all classes that override 'toString()' method