Search in sources :

Example 1 with MutableVariable

use of org.eclipse.che.api.debug.shared.model.MutableVariable in project che by eclipse.

the class DebuggerViewImpl method setVariablesIntoSelectedVariable.

/** {@inheritDoc} */
@Override
public void setVariablesIntoSelectedVariable(@NotNull List<? extends Variable> variables) {
    MutableVariable rootVariable = selectedVariable.getData();
    rootVariable.setVariables(variables);
}
Also used : MutableVariable(org.eclipse.che.api.debug.shared.model.MutableVariable)

Example 2 with MutableVariable

use of org.eclipse.che.api.debug.shared.model.MutableVariable in project che by eclipse.

the class DebuggerViewImpl method setVariables.

/** {@inheritDoc} */
@Override
public void setVariables(@NotNull List<? extends Variable> variables) {
    MutableVariable root = this.variables.getModel().getRoot();
    if (root == null) {
        root = new MutableVariableImpl();
        this.variables.getModel().setRoot(root);
    }
    root.setVariables(variables);
    this.variables.renderTree(0);
}
Also used : MutableVariable(org.eclipse.che.api.debug.shared.model.MutableVariable) MutableVariableImpl(org.eclipse.che.api.debug.shared.model.impl.MutableVariableImpl)

Example 3 with MutableVariable

use of org.eclipse.che.api.debug.shared.model.MutableVariable in project che by eclipse.

the class VariableNodeDataAdapter method getNodeByPath.

/** {@inheritDoc} */
@Override
@Nullable
public MutableVariable getNodeByPath(@NotNull MutableVariable root, @NotNull List<String> relativeNodePath) {
    MutableVariable localRoot = root;
    for (int i = 0; i < relativeNodePath.size(); i++) {
        String path = relativeNodePath.get(i);
        if (localRoot != null) {
            List<MutableVariable> variables = new ArrayList<>(localRoot.getVariables());
            localRoot = null;
            for (int j = 0; j < variables.size(); j++) {
                MutableVariable variable = variables.get(i);
                if (variable.getName().equals(path)) {
                    localRoot = variable;
                    break;
                }
            }
            if (i == (relativeNodePath.size() - 1)) {
                return localRoot;
            }
        }
    }
    return null;
}
Also used : MutableVariable(org.eclipse.che.api.debug.shared.model.MutableVariable) ArrayList(java.util.ArrayList) Nullable(org.eclipse.che.commons.annotation.Nullable)

Example 4 with MutableVariable

use of org.eclipse.che.api.debug.shared.model.MutableVariable in project che by eclipse.

the class DebuggerPresenterTest method testOnExpandVariablesTree.

@Test
public void testOnExpandVariablesTree() throws OperationException {
    SimpleValueDto valueDto = mock(SimpleValueDto.class);
    List<MutableVariable> rootVariables = mock(List.class);
    doReturn(true).when(rootVariables).isEmpty();
    doReturn(rootVariables).when(selectedVariable).getVariables();
    doReturn(promiseValue).when(debugger).getValue(selectedVariable);
    doReturn(promiseValue).when(promiseValue).then((Operation<SimpleValueDto>) any());
    presenter.onExpandVariablesTree();
    verify(promiseValue).then(operationValueCaptor.capture());
    operationValueCaptor.getValue().apply(valueDto);
    verify(view).setVariablesIntoSelectedVariable(any());
    verify(view).updateSelectedVariable();
    verify(promiseValue).catchError(operationPromiseErrorCaptor.capture());
    operationPromiseErrorCaptor.getValue().apply(promiseError);
    notificationManager.notify(any(), eq(ERROR_MESSAGE), eq(FAIL), eq(FLOAT_MODE));
    verify(constant).failedToGetVariableValueTitle();
}
Also used : MutableVariable(org.eclipse.che.api.debug.shared.model.MutableVariable) SimpleValueDto(org.eclipse.che.api.debug.shared.dto.SimpleValueDto) Test(org.junit.Test) BaseTest(org.eclipse.che.plugin.debugger.ide.BaseTest)

Aggregations

MutableVariable (org.eclipse.che.api.debug.shared.model.MutableVariable)4 ArrayList (java.util.ArrayList)1 SimpleValueDto (org.eclipse.che.api.debug.shared.dto.SimpleValueDto)1 MutableVariableImpl (org.eclipse.che.api.debug.shared.model.impl.MutableVariableImpl)1 Nullable (org.eclipse.che.commons.annotation.Nullable)1 BaseTest (org.eclipse.che.plugin.debugger.ide.BaseTest)1 Test (org.junit.Test)1