use of com.perl5.lang.perl.idea.run.debugger.protocol.PerlValueDescriptor in project Perl5-IDEA by Camelcade.
the class PerlStackFrame method computeChildren.
@Override
public void computeChildren(@NotNull XCompositeNode node) {
PerlValueDescriptor[] lexicals = myFrameDescriptor.getLexicals();
PerlValueDescriptor[] globals = myFrameDescriptor.getGlobals();
PerlValueDescriptor[] args = myFrameDescriptor.getArgs();
int mainSize = myFrameDescriptor.getMainSize();
boolean fallback = true;
XValueChildrenList list = new XValueChildrenList();
if (globals != null && globals.length > 0) {
list.addTopGroup(new PerlXValueGroup("Global variables", "our", PerlIcons.OUR_GUTTER_ICON, globals, this, false));
fallback = false;
}
if (mainSize > 0) {
list.addTopGroup(new PerlXMainGroup(this, mainSize));
fallback = false;
}
if (args != null && args.length > 0) {
list.addTopGroup(new PerlXValueGroup("Arguments", null, PerlIcons.ARGS_GUTTER_ICON, args, this, true));
fallback = false;
}
if (lexicals != null && lexicals.length > 0) {
list.addTopGroup(new PerlXValueGroup("Lexical variables", "my/state", PerlIcons.MY_GUTTER_ICON, lexicals, this, true));
fallback = false;
}
if (fallback) {
super.computeChildren(node);
} else {
node.addChildren(list, true);
}
}
use of com.perl5.lang.perl.idea.run.debugger.protocol.PerlValueDescriptor in project Perl5-IDEA by Camelcade.
the class PerlXNamedValue method computeChildren.
@Override
public void computeChildren(@NotNull XCompositeNode node) {
boolean isExpandable = myPerlValueDescriptor.isExpandable();
PerlLayersDescriptor layers = myPerlValueDescriptor.getLayers();
PerlValueDescriptor tiedWith = myPerlValueDescriptor.getTiedWith();
if (!isExpandable && layers == null && tiedWith == null || StringUtil.isEmpty(myPerlValueDescriptor.getKey())) {
super.computeChildren(node);
}
XValueChildrenList childrenList = new XValueChildrenList();
if (layers != null) {
childrenList.add(new PerlXLayersNamedValue(layers));
}
if (tiedWith != null) {
childrenList.addTopGroup(new PerlTiedNamedValue(tiedWith, myStackFrame));
}
node.addChildren(childrenList, !isExpandable);
if (isExpandable) {
PerlDebugUtil.requestAndComputeChildren(node, myStackFrame, offset, myPerlValueDescriptor.getSize(), myPerlValueDescriptor.getKey());
}
}
use of com.perl5.lang.perl.idea.run.debugger.protocol.PerlValueDescriptor in project Perl5-IDEA by Camelcade.
the class PerlXValueGroup method computeChildren.
@Override
public void computeChildren(@NotNull XCompositeNode node) {
if (myVariables.length == 0) {
super.computeChildren(node);
} else {
XValueChildrenList list = new XValueChildrenList();
for (PerlValueDescriptor descriptor : myVariables) {
list.add(new PerlXNamedValue(descriptor, myStackFrame));
}
node.setAlreadySorted(true);
node.addChildren(list, true);
}
}
use of com.perl5.lang.perl.idea.run.debugger.protocol.PerlValueDescriptor in project Perl5-IDEA by Camelcade.
the class PerlDebugUtil method requestAndComputeChildren.
public static void requestAndComputeChildren(@NotNull final XCompositeNode node, final PerlStackFrame perlStackFrame, final int[] offset, final int size, String key) {
PerlDebugThread thread = perlStackFrame.getPerlExecutionStack().getSuspendContext().getDebugThread();
final int frameSize = XCompositeNode.MAX_CHILDREN_TO_SHOW;
thread.sendCommandAndGetResponse("getchildren", new PerlValueRequestDescriptor(offset[0], frameSize, key), new PerlDebuggingTransactionHandler() {
@Override
public void run(JsonObject jsonObject, JsonDeserializationContext jsonDeserializationContext) {
PerlValueDescriptor[] descriptors = jsonDeserializationContext.deserialize(jsonObject.getAsJsonArray("data"), PerlValueDescriptor[].class);
XValueChildrenList list = new XValueChildrenList();
for (PerlValueDescriptor descriptor : descriptors) {
list.add(new PerlXNamedValue(descriptor, perlStackFrame));
offset[0]++;
}
boolean isLast = offset[0] >= size;
node.addChildren(list, isLast);
if (!isLast) {
node.tooManyChildren(size - offset[0]);
}
}
});
}
Aggregations