IDEA-29947 Suppress Objectinformation for type renderers - allow to gide object type in renderers

This commit is contained in:
Egor.Ushakov
2015-09-03 13:48:10 +03:00
parent 787735ac92
commit a6e094732d
4 changed files with 42 additions and 12 deletions
@@ -34,6 +34,7 @@ import com.intellij.openapi.util.Pair;
import com.intellij.psi.*;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.ui.*;
import com.intellij.ui.components.JBCheckBox;
import com.intellij.ui.table.JBTable;
import com.intellij.util.Function;
import com.intellij.util.ui.AbstractTableCellEditor;
@@ -56,6 +57,7 @@ class CompoundRendererConfigurable extends JPanel {
private final ClassNameEditorWithBrowseButton myClassNameField;
private final JRadioButton myRbDefaultLabel;
private final JRadioButton myRbExpressionLabel;
private final JBCheckBox myShowTypeCheckBox;
private final JRadioButton myRbDefaultChildrenRenderer;
private final JRadioButton myRbExpressionChildrenRenderer;
private final JRadioButton myRbListChildrenRenderer;
@@ -83,6 +85,8 @@ class CompoundRendererConfigurable extends JPanel {
labelButtonsGroup.add(myRbDefaultLabel);
labelButtonsGroup.add(myRbExpressionLabel);
myShowTypeCheckBox = new JBCheckBox(DebuggerBundle.message("label.compound.renderer.configurable.show.type"));
myRbDefaultChildrenRenderer = new JRadioButton(DebuggerBundle.message("label.compound.renderer.configurable.use.default.renderer"));
myRbExpressionChildrenRenderer = new JRadioButton(DebuggerBundle.message("label.compound.renderer.configurable.use.expression"));
myRbListChildrenRenderer = new JRadioButton(DebuggerBundle.message("label.compound.renderer.configurable.use.expression.list"));
@@ -135,6 +139,9 @@ class CompoundRendererConfigurable extends JPanel {
panel.add(new JLabel(DebuggerBundle.message("label.compound.renderer.configurable.when.rendering")),
new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
new Insets(20, 0, 0, 0), 0, 0));
panel.add(myShowTypeCheckBox,
new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
new Insets(0, 7, 0, 0), 0, 0));
panel.add(myRbDefaultLabel,
new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
new Insets(0, 10, 0, 0), 0, 0));
@@ -307,6 +314,7 @@ class CompoundRendererConfigurable extends JPanel {
private void flushDataTo(final CompoundReferenceRenderer renderer) { // label
LabelRenderer labelRenderer = null;
renderer.setShowType(myShowTypeCheckBox.isSelected());
if (myRbExpressionLabel.isSelected()) {
labelRenderer = new LabelRenderer();
labelRenderer.setLabelExpression(myLabelEditor.getText());
@@ -339,6 +347,8 @@ class CompoundRendererConfigurable extends JPanel {
final ChildrenRenderer childrenRenderer = myRenderer.getChildrenRenderer();
final NodeRendererSettings rendererSettings = NodeRendererSettings.getInstance();
myShowTypeCheckBox.setSelected(myRenderer.isShowType());
if (rendererSettings.isBase(labelRenderer)) {
myLabelEditor.setText(emptyExpressionFragment);
myRbDefaultLabel.setSelected(true);
@@ -22,9 +22,6 @@ import com.intellij.openapi.util.WriteExternalException;
import org.jdom.Element;
import org.jetbrains.annotations.NonNls;
import java.util.Iterator;
import java.util.List;
/**
* @author Eugene Zhuravlev
* Date: Feb 12, 2005
@@ -42,6 +39,9 @@ public final class BasicRendererProperties implements Cloneable, JDOMExternaliza
private static final @NonNls String CLASSNAME_OPTION = "QUALIFIED_NAME";
private String myClassName;
private static final @NonNls String SHOWTYPE_OPTION = "SHOW_TYPE";
private Boolean myShowType;
public String getName() {
return myName;
}
@@ -51,7 +51,7 @@ public final class BasicRendererProperties implements Cloneable, JDOMExternaliza
}
public boolean isEnabled() {
return myEnabled != null? myEnabled.booleanValue() : false;
return myEnabled != null && myEnabled.booleanValue();
}
public void setEnabled(final boolean enabled) {
@@ -66,24 +66,32 @@ public final class BasicRendererProperties implements Cloneable, JDOMExternaliza
myClassName = className;
}
public boolean isShowType() {
return myShowType == null || myShowType.booleanValue();
}
public void setShowType(boolean showType) {
myShowType = showType;
}
@SuppressWarnings({"HardCodedStringLiteral"}) public void readExternal(Element element) throws InvalidDataException {
final List options = element.getChildren("option");
myName = null;
myEnabled = null;
myClassName = null;
for (Iterator it = options.iterator(); it.hasNext();) {
final Element option = (Element)it.next();
for (Element option : element.getChildren("option")) {
final String optionName = option.getAttributeValue("name");
if (NAME_OPTION.equals(optionName)) {
myName = option.getAttributeValue("value");
}
else if (ENABLED_OPTION.equals(optionName)) {
final String val = option.getAttributeValue("value");
myEnabled = "true".equalsIgnoreCase(val);
myEnabled = Boolean.parseBoolean(option.getAttributeValue("value"));
}
else if (CLASSNAME_OPTION.equals(optionName)) {
myClassName = option.getAttributeValue("value");
}
else if (SHOWTYPE_OPTION.equals(optionName)) {
myShowType = Boolean.parseBoolean(option.getAttributeValue("value"));
}
}
}
@@ -92,11 +100,14 @@ public final class BasicRendererProperties implements Cloneable, JDOMExternaliza
addOption(element, NAME_OPTION, myName);
}
if (myEnabled != null) {
addOption(element, ENABLED_OPTION, myEnabled.booleanValue()? "true" : "false");
addOption(element, ENABLED_OPTION, myEnabled.toString());
}
if (myClassName != null) {
addOption(element, CLASSNAME_OPTION, myClassName);
}
if (myShowType != null) {
addOption(element, SHOWTYPE_OPTION, myShowType.toString());
}
}
@SuppressWarnings({"HardCodedStringLiteral"})
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2015 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.
@@ -63,6 +63,14 @@ public abstract class NodeRendererImpl implements NodeRenderer{
myProperties.setEnabled(enabled);
}
public boolean isShowType() {
return myProperties.isShowType();
}
public void setShowType(boolean showType) {
myProperties.setShowType(showType);
}
public Icon calcValueIcon(ValueDescriptor descriptor, EvaluationContext evaluationContext, DescriptorLabelListener listener) throws EvaluateException {
return null;
}
@@ -93,6 +101,6 @@ public abstract class NodeRendererImpl implements NodeRenderer{
@Nullable
public String getIdLabel(Value value, DebugProcess process) {
return value instanceof ObjectReference ? ValueDescriptorImpl.getIdLabel((ObjectReference)value) : null;
return value instanceof ObjectReference && isShowType() ? ValueDescriptorImpl.getIdLabel((ObjectReference)value) : null;
}
}
@@ -200,6 +200,7 @@ label.base.renderer.configurable.alternate.view=Enable alternative view for Coll
label.base.renderer.configurable.enable.toString=Enable 't&oString()' object view:
label.base.renderer.configurable.all.overriding=For all classes that override 'toString()' method
label.base.renderer.configurable.classes.from.list=For classes from the list:
label.compound.renderer.configurable.show.type=Show type and object id
label.compound.renderer.configurable.use.default.renderer=Use default renderer
label.compound.renderer.configurable.use.expression=Use following expression:
label.compound.renderer.configurable.use.expression.list=Use list of expressions: