mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
IDEA-50910 Add an option for debugger variables view to show a short name instead of FQN (actual class name)
This commit is contained in:
+7
-1
@@ -48,6 +48,7 @@ public class DebuggerDataViewsConfigurable implements SearchableConfigurable {
|
||||
private JCheckBox myCbHideNullArrayElements;
|
||||
private JCheckBox myCbShowStatic;
|
||||
private JCheckBox myCbShowDeclaredType;
|
||||
private JCheckBox myCbShowFQNames;
|
||||
private JCheckBox myCbShowObjectId;
|
||||
|
||||
private StateRestoringCheckBox myCbShowStaticFinalFields;
|
||||
@@ -102,6 +103,7 @@ public class DebuggerDataViewsConfigurable implements SearchableConfigurable {
|
||||
}
|
||||
});
|
||||
myCbShowDeclaredType = new JCheckBox(DebuggerBundle.message("label.base.renderer.configurable.show.declared.type"));
|
||||
myCbShowFQNames = new JCheckBox(DebuggerBundle.message("label.base.renderer.configurable.show.fq.names"));
|
||||
myCbShowObjectId = new JCheckBox(DebuggerBundle.message("label.base.renderer.configurable.show.object.id"));
|
||||
|
||||
myCbEnableToString = new JCheckBox(DebuggerBundle.message("label.base.renderer.configurable.enable.tostring"));
|
||||
@@ -149,7 +151,8 @@ public class DebuggerDataViewsConfigurable implements SearchableConfigurable {
|
||||
showPanel.add(myCbShowObjectId, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(4, 0, 0, 0), 0, 0));
|
||||
showPanel.add(myCbShowSyntheticFields, new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 10, 0, 0), 0, 0));
|
||||
showPanel.add(myCbShowStatic, new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(4, 10, 0, 0), 0, 0));
|
||||
showPanel.add(myCbShowStaticFinalFields, new GridBagConstraints(2, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(4, 10, 0, 0), 0, 0));
|
||||
showPanel.add(myCbShowStaticFinalFields, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(4, 10, 0, 0), 0, 0));
|
||||
showPanel.add(myCbShowFQNames, new GridBagConstraints(3, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 10, 0, 0), 0, 0));
|
||||
|
||||
panel.add(showPanel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 3, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(4, 0, 0, 0), 0, 0));
|
||||
|
||||
@@ -193,6 +196,7 @@ public class DebuggerDataViewsConfigurable implements SearchableConfigurable {
|
||||
classRenderer.SHOW_STATIC_FINAL = myCbShowStaticFinalFields.isSelectedWhenSelectable();
|
||||
classRenderer.SHOW_SYNTHETICS = myCbShowSyntheticFields.isSelected();
|
||||
classRenderer.SHOW_DECLARED_TYPE = myCbShowDeclaredType.isSelected();
|
||||
classRenderer.SHOW_FQ_TYPE_NAMES = myCbShowFQNames.isSelected();
|
||||
classRenderer.SHOW_OBJECT_ID = myCbShowObjectId.isSelected();
|
||||
|
||||
final ToStringRenderer toStringRenderer = rendererSettings.getToStringRenderer();
|
||||
@@ -226,6 +230,7 @@ public class DebuggerDataViewsConfigurable implements SearchableConfigurable {
|
||||
myCbShowStaticFinalFields.makeUnselectable(false);
|
||||
}
|
||||
myCbShowDeclaredType.setSelected(classRenderer.SHOW_DECLARED_TYPE);
|
||||
myCbShowFQNames.setSelected(classRenderer.SHOW_FQ_TYPE_NAMES);
|
||||
myCbShowObjectId.setSelected(classRenderer.SHOW_OBJECT_ID);
|
||||
|
||||
final ToStringRenderer toStringRenderer = rendererSettings.getToStringRenderer();
|
||||
@@ -275,6 +280,7 @@ public class DebuggerDataViewsConfigurable implements SearchableConfigurable {
|
||||
(classRenderer.SHOW_STATIC_FINAL != myCbShowStaticFinalFields.isSelectedWhenSelectable()) ||
|
||||
(classRenderer.SHOW_SYNTHETICS != myCbShowSyntheticFields.isSelected()) ||
|
||||
(classRenderer.SHOW_DECLARED_TYPE != myCbShowDeclaredType.isSelected()) ||
|
||||
(classRenderer.SHOW_FQ_TYPE_NAMES != myCbShowFQNames.isSelected()) ||
|
||||
(classRenderer.SHOW_OBJECT_ID != myCbShowObjectId.isSelected());
|
||||
if (isClassRendererModified) {
|
||||
return true;
|
||||
|
||||
@@ -158,7 +158,7 @@ public class FieldDescriptorImpl extends ValueDescriptorImpl implements FieldDes
|
||||
buf.append(getName());
|
||||
if (classRenderer.SHOW_DECLARED_TYPE) {
|
||||
buf.append(": ");
|
||||
buf.append(myField.typeName());
|
||||
buf.append(classRenderer.renderTypeName(myField.typeName()));
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
+1
-1
@@ -121,7 +121,7 @@ public class LocalVariableDescriptorImpl extends ValueDescriptorImpl implements
|
||||
buf.append(getName());
|
||||
if (classRenderer.SHOW_DECLARED_TYPE) {
|
||||
buf.append(": ");
|
||||
buf.append(myTypeName);
|
||||
buf.append(classRenderer.renderTypeName(myTypeName));
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
+4
-1
@@ -23,7 +23,9 @@ package com.intellij.debugger.ui.impl.watch;
|
||||
import com.intellij.debugger.engine.DebuggerManagerThreadImpl;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluateException;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
|
||||
import com.intellij.debugger.settings.NodeRendererSettings;
|
||||
import com.intellij.debugger.ui.tree.StaticDescriptor;
|
||||
import com.intellij.debugger.ui.tree.render.ClassRenderer;
|
||||
import com.intellij.debugger.ui.tree.render.DescriptorLabelListener;
|
||||
import com.sun.jdi.Field;
|
||||
import com.sun.jdi.ReferenceType;
|
||||
@@ -64,6 +66,7 @@ public class StaticDescriptorImpl extends NodeDescriptorImpl implements StaticDe
|
||||
|
||||
protected String calcRepresentation(EvaluationContextImpl context, DescriptorLabelListener descriptorLabelListener) throws EvaluateException {
|
||||
DebuggerManagerThreadImpl.assertIsManagerThread();
|
||||
return getName() + " = " + myType.name();
|
||||
final ClassRenderer classRenderer = NodeRendererSettings.getInstance().getClassRenderer();
|
||||
return getName() + " = " + classRenderer.renderTypeName(myType.name());
|
||||
}
|
||||
}
|
||||
+6
-2
@@ -27,7 +27,9 @@ import com.intellij.debugger.engine.evaluation.EvaluateExceptionUtil;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
|
||||
import com.intellij.debugger.engine.evaluation.TextWithImports;
|
||||
import com.intellij.debugger.impl.DebuggerUtilsEx;
|
||||
import com.intellij.debugger.settings.NodeRendererSettings;
|
||||
import com.intellij.debugger.ui.tree.UserExpressionDescriptor;
|
||||
import com.intellij.debugger.ui.tree.render.ClassRenderer;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiCodeFragment;
|
||||
@@ -57,8 +59,10 @@ public class UserExpressionDescriptorImpl extends EvaluationDescriptor implement
|
||||
try {
|
||||
buffer.append(getName());
|
||||
buffer.append(": ");
|
||||
if(getValue() != null) {
|
||||
buffer.append(getValue().type().name());
|
||||
final Value value = getValue();
|
||||
if(value != null) {
|
||||
final ClassRenderer classRenderer = NodeRendererSettings.getInstance().getClassRenderer();
|
||||
buffer.append(classRenderer.renderTypeName(value.type().name()));
|
||||
}
|
||||
|
||||
return buffer.toString();
|
||||
|
||||
@@ -378,7 +378,7 @@ public abstract class ValueDescriptorImpl extends NodeDescriptorImpl implements
|
||||
if (showConcreteType || classRenderer.SHOW_OBJECT_ID) {
|
||||
buf.append('{');
|
||||
if (showConcreteType) {
|
||||
buf.append(objRef.type().name());
|
||||
buf.append(classRenderer.renderTypeName(objRef.type().name()));
|
||||
}
|
||||
if (classRenderer.SHOW_OBJECT_ID) {
|
||||
buf.append('@');
|
||||
|
||||
@@ -63,6 +63,7 @@ public class ClassRenderer extends NodeRendererImpl{
|
||||
public boolean SHOW_STATIC = false;
|
||||
public boolean SHOW_STATIC_FINAL = false;
|
||||
|
||||
public boolean SHOW_FQ_TYPE_NAMES = true;
|
||||
public boolean SHOW_DECLARED_TYPE = false;
|
||||
public boolean SHOW_OBJECT_ID = true;
|
||||
|
||||
@@ -70,6 +71,17 @@ public class ClassRenderer extends NodeRendererImpl{
|
||||
myProperties.setEnabled(true);
|
||||
}
|
||||
|
||||
public final String renderTypeName(final String typeName) {
|
||||
if (SHOW_FQ_TYPE_NAMES) {
|
||||
return typeName;
|
||||
}
|
||||
final int dotIndex = typeName.lastIndexOf('.');
|
||||
if (dotIndex > 0) {
|
||||
return typeName.substring(dotIndex + 1);
|
||||
}
|
||||
return typeName;
|
||||
}
|
||||
|
||||
public String getUniqueId() {
|
||||
return UNIQUE_ID;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user