use of com.intellij.debugger.impl.descriptors.data.UserExpressionData in project intellij-community by JetBrains.
the class EnumerationChildrenRenderer method buildChildren.
public void buildChildren(Value value, ChildrenBuilder builder, EvaluationContext evaluationContext) {
NodeManager nodeManager = builder.getNodeManager();
NodeDescriptorFactory descriptorFactory = builder.getDescriptorManager();
List<DebuggerTreeNode> children = new ArrayList<>();
int idx = 0;
for (Pair<String, TextWithImports> pair : myChildren) {
UserExpressionData data = new UserExpressionData((ValueDescriptorImpl) builder.getParentDescriptor(), getClassName(), pair.getFirst(), pair.getSecond());
data.setEnumerationIndex(idx++);
children.add(nodeManager.createNode(descriptorFactory.getUserExpressionDescriptor(builder.getParentDescriptor(), data), evaluationContext));
}
builder.setChildren(children);
if (myAppendDefaultChildren) {
DebugProcessImpl.getDefaultRenderer(value).buildChildren(value, builder, evaluationContext);
}
}
use of com.intellij.debugger.impl.descriptors.data.UserExpressionData in project android by JetBrains.
the class ArrayMapRendererBase method buildChildren.
/** Builds a list of {@link DebuggerTreeNode}'s that are the children of this node. */
@Override
public void buildChildren(Value value, ChildrenBuilder builder, EvaluationContext evaluationContext) {
DebuggerManagerThreadImpl.assertIsManagerThread();
List<DebuggerTreeNode> children = new ArrayList<DebuggerTreeNode>();
NodeManagerImpl nodeManager = (NodeManagerImpl) builder.getNodeManager();
NodeDescriptorFactory descriptorFactory = builder.getDescriptorManager();
int size;
try {
size = getArrayMapSize(value, evaluationContext);
} catch (Exception e) {
size = 0;
}
for (int i = 0, n = Math.min(size, MAX_CHILDREN); i < n; i++) {
// For each entry, display the value at that entry. TODO: we need to show the key corresponding to this as well.
// We used to show the key and value by using the following expression:
// String expression = String.format("new Object[] {this.keyAt(%1$d), this.valueAt(%2$d)}", i, i);
// But it turns out that this throws "java.lang.ClassNotFoundException: [LObject;"
// Until we find an alternate scheme, just show the value.
String expression = String.format("this.valueAt(%1$d)", i);
UserExpressionData descriptorData = new UserExpressionData((ValueDescriptorImpl) builder.getParentDescriptor(), myFqn, String.format("value[%1$d]", i), new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, expression, "", StdFileTypes.JAVA));
UserExpressionDescriptor userExpressionDescriptor = descriptorFactory.getUserExpressionDescriptor(builder.getParentDescriptor(), descriptorData);
DebuggerTreeNode arrayMapItemNode = nodeManager.createNode(userExpressionDescriptor, evaluationContext);
children.add(arrayMapItemNode);
}
if (size > MAX_CHILDREN) {
children.add(nodeManager.createMessageNode(new MessageDescriptor(MORE_ELEMENTS, MessageDescriptor.SPECIAL)));
}
builder.setChildren(children);
}
Aggregations