Search in sources :

Example 1 with Variable

use of com.google.api.services.clouddebugger.v2.model.Variable in project google-cloud-intellij by GoogleCloudPlatform.

the class CloudStackFrame method computeChildren.

@Override
public void computeChildren(@NotNull XCompositeNode node) {
    final XValueChildrenList list = new XValueChildrenList();
    List<Variable> arguments = frame.getArguments();
    if (arguments != null && arguments.size() > 0) {
        for (Variable variable : arguments) {
            if (!Strings.isNullOrEmpty(variable.getName())) {
                list.add(variable.getName(), new MyValue(variable, variableTable));
            }
        }
    }
    List<Variable> locals = frame.getLocals();
    if (locals != null && locals.size() > 0) {
        for (Variable variable : locals) {
            if (!Strings.isNullOrEmpty(variable.getName())) {
                list.add(variable.getName(), new MyValue(variable, variableTable));
            }
        }
    }
    if (evaluatedExpressions != null && evaluatedExpressions.size() > 0) {
        list.addTopGroup(new CustomWatchGroup());
    }
    node.addChildren(list, true);
}
Also used : XValueChildrenList(com.intellij.xdebugger.frame.XValueChildrenList) Variable(com.google.api.services.clouddebugger.v2.model.Variable)

Example 2 with Variable

use of com.google.api.services.clouddebugger.v2.model.Variable in project google-cloud-intellij by GoogleCloudPlatform.

the class CloudExecutionStackTest method testGetTopFrame_nonNull.

@Test
public void testGetTopFrame_nonNull() {
    List<StackFrame> frames = new ArrayList<StackFrame>();
    StackFrame frame1 = new StackFrame();
    SourceLocation location1 = new SourceLocation();
    location1.setLine(1);
    frame1.setLocation(location1);
    List<Variable> variables = new ArrayList<Variable>();
    Variable variable = new Variable();
    variable.setName("foo");
    variables.add(variable);
    frame1.setLocals(variables);
    StackFrame frame2 = new StackFrame();
    SourceLocation location2 = new SourceLocation();
    location2.setLine(2);
    frame2.setLocation(location2);
    frames.add(frame1);
    frames.add(frame2);
    CloudExecutionStack stack = new CloudExecutionStack(project, "name", frames, null, null);
    CloudStackFrame localFrame = stack.getTopFrame();
    Assert.assertNotNull(localFrame);
    SpyNode node = new SpyNode();
    localFrame.computeChildren(node);
    Assert.assertEquals(1, node.seenChildren.size());
    Assert.assertEquals("foo", node.seenChildren.get(0));
}
Also used : SourceLocation(com.google.api.services.clouddebugger.v2.model.SourceLocation) Variable(com.google.api.services.clouddebugger.v2.model.Variable) StackFrame(com.google.api.services.clouddebugger.v2.model.StackFrame) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Aggregations

Variable (com.google.api.services.clouddebugger.v2.model.Variable)2 SourceLocation (com.google.api.services.clouddebugger.v2.model.SourceLocation)1 StackFrame (com.google.api.services.clouddebugger.v2.model.StackFrame)1 XValueChildrenList (com.intellij.xdebugger.frame.XValueChildrenList)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1