use of org.ballerinalang.plugins.idea.debugger.dto.Variable in project ballerina by ballerina-lang.
the class BallerinaStackFrame method computeChildren.
/**
* Adds variables in the current stack to the node.
*/
@Override
public void computeChildren(@NotNull XCompositeNode node) {
// We categorize variables according to the scope. But we get all the variables in the stack. So we need to
// distinguish values in each scope. In this Map, key will be the scope name. Value will be the list of
// variables in that scope.
Map<String, List<Variable>> scopeMap = new HashMap<>();
// Iterate through each variable.
List<Variable> variables = myFrame.getVariables();
for (Variable variable : variables) {
// Get the scope.
String scopeName = variable.getScope();
// Check whether the scope is already available in the map.
if (scopeMap.containsKey(scopeName)) {
// If it is already in the map, add the variable to the corresponding list.
List<Variable> list = scopeMap.get(scopeName);
list.add(variable);
} else {
// If it is not available in the map, add it as a new entry.
List<Variable> list = new LinkedList<>();
list.add(variable);
scopeMap.put(scopeName, list);
}
}
// Iterate through each scope in the map.
scopeMap.forEach((scopeName, variableList) -> {
// Create a new XValueChildrenList to hold the XValues.
XValueChildrenList xValueChildrenList = new XValueChildrenList();
// Create a new variable to represent the scope.
Variable scopeVariable = new Variable();
// Set the variable name.
scopeVariable.setName(scopeName);
// Set the children.
scopeVariable.setChildren(variableList);
// Add the variables to the children list using a ValueGroup.
xValueChildrenList.addBottomGroup(new BallerinaXValueGroup(myProcess, myFrame, scopeName, scopeVariable));
// Add the list to the node as children.
node.addChildren(xValueChildrenList, true);
});
}
use of org.ballerinalang.plugins.idea.debugger.dto.Variable in project ballerina by ballerina-lang.
the class BallerinaXValueGroup method computeChildren.
@Override
public void computeChildren(@NotNull XCompositeNode node) {
List<Variable> children = myVariable.getChildren();
if (children == null) {
super.computeChildren(node);
} else {
XValueChildrenList list = new XValueChildrenList();
for (Variable child : children) {
list.add(child.getName(), new BallerinaXValue(myProcess, myFrame.getFrameName(), child, AllIcons.Nodes.Field));
}
node.addChildren(list, true);
}
}
use of org.ballerinalang.plugins.idea.debugger.dto.Variable in project ballerina by ballerina-lang.
the class BallerinaXValue method computeChildren.
@Override
public void computeChildren(@NotNull XCompositeNode node) {
List<Variable> children = myVariable.getChildren();
if (children == null) {
super.computeChildren(node);
} else {
XValueChildrenList list = new XValueChildrenList();
for (Variable child : children) {
list.add(child.getName(), new BallerinaXValue(myProcess, myFrameName, child, AllIcons.Nodes.Field));
}
node.addChildren(list, true);
}
}
Aggregations