use of com.intellij.debugger.ui.impl.watch.MessageDescriptor 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