Search in sources :

Example 6 with TerminalPresenter

use of org.eclipse.che.ide.extension.machine.client.perspective.terminal.TerminalPresenter in project che by eclipse.

the class TerminalContainerViewImpl method showTerminal.

/** {@inheritDoc} */
@Override
public void showTerminal(@NotNull TerminalPresenter terminal) {
    for (TerminalPresenter presenter : terminals) {
        presenter.setVisible(false);
    }
    terminal.setVisible(true);
    onResize();
}
Also used : TerminalPresenter(org.eclipse.che.ide.extension.machine.client.perspective.terminal.TerminalPresenter)

Example 7 with TerminalPresenter

use of org.eclipse.che.ide.extension.machine.client.perspective.terminal.TerminalPresenter in project che by eclipse.

the class ProcessesPanelPresenterTest method shouldHideStopProcessButtonAtAddingTerminal.

@Test
public void shouldHideStopProcessButtonAtAddingTerminal() throws Exception {
    MachineDto machineDto = mock(MachineDto.class);
    MachineEntity machine = mock(MachineEntity.class);
    when(machine.getId()).thenReturn(MACHINE_ID);
    MachineConfigDto machineConfigDto = mock(MachineConfigDto.class);
    when(machine.getConfig()).thenReturn(machineConfigDto);
    when(machineConfigDto.isDev()).thenReturn(true);
    when(machine.getStatus()).thenReturn(MachineStatus.RUNNING);
    List<MachineDto> machines = new ArrayList<>(1);
    machines.add(machineDto);
    when(workspaceRuntime.getMachines()).thenReturn(machines);
    when(entityFactory.createMachine(machineDto)).thenReturn(machine);
    ProcessTreeNode machineNode = mock(ProcessTreeNode.class);
    when(machineNode.getId()).thenReturn(MACHINE_ID);
    List<ProcessTreeNode> children = new ArrayList<>();
    children.add(machineNode);
    presenter.rootNode = new ProcessTreeNode(ROOT_NODE, null, null, null, children);
    TerminalPresenter terminal = mock(TerminalPresenter.class);
    when(terminalFactory.create(machine, presenter)).thenReturn(terminal);
    IsWidget terminalWidget = mock(IsWidget.class);
    when(terminal.getView()).thenReturn(terminalWidget);
    when(terminalWidget.asWidget()).thenReturn(widget);
    presenter.addCommandOutput(MACHINE_ID, outputConsole);
    presenter.onAddTerminal(MACHINE_ID, presenter);
    verify(terminalFactory).create(eq(machine), eq(presenter));
    verify(terminal).getView();
    verify(view, times(2)).setProcessesData(anyObject());
    verify(view, times(2)).selectNode(anyObject());
    verify(view).addWidget(anyString(), anyString(), anyObject(), eq(terminalWidget), anyBoolean());
    verify(view, times(1)).addProcessNode(anyObject());
    verify(terminal).setVisible(eq(true));
    verify(terminal).connect();
    verify(terminal).setListener(anyObject());
    verify(view).setStopButtonVisibility(anyString(), eq(false));
}
Also used : MachineEntity(org.eclipse.che.ide.api.machine.MachineEntity) IsWidget(com.google.gwt.user.client.ui.IsWidget) MachineDto(org.eclipse.che.api.machine.shared.dto.MachineDto) ArrayList(java.util.ArrayList) MachineConfigDto(org.eclipse.che.api.machine.shared.dto.MachineConfigDto) ProcessTreeNode(org.eclipse.che.ide.extension.machine.client.processes.ProcessTreeNode) TerminalPresenter(org.eclipse.che.ide.extension.machine.client.perspective.terminal.TerminalPresenter) Test(org.junit.Test)

Aggregations

TerminalPresenter (org.eclipse.che.ide.extension.machine.client.perspective.terminal.TerminalPresenter)7 ProcessTreeNode (org.eclipse.che.ide.extension.machine.client.processes.ProcessTreeNode)5 Test (org.junit.Test)4 IsWidget (com.google.gwt.user.client.ui.IsWidget)3 ArrayList (java.util.ArrayList)3 MachineEntity (org.eclipse.che.ide.api.machine.MachineEntity)3 MachineConfigDto (org.eclipse.che.api.machine.shared.dto.MachineConfigDto)2 MachineDto (org.eclipse.che.api.machine.shared.dto.MachineDto)2