Search in sources :

Example 16 with ProcessTreeNode

use of org.eclipse.che.ide.extension.machine.client.processes.ProcessTreeNode in project che by eclipse.

the class ProcessesPanelPresenter method selectDevMachine.

/**
     * Selects dev machine.
     */
public void selectDevMachine() {
    for (final ProcessTreeNode processTreeNode : machineNodes.values()) {
        if (processTreeNode.getData() instanceof MachineEntity) {
            if (((MachineEntity) processTreeNode.getData()).isDev()) {
                view.selectNode(processTreeNode);
                notifyTreeNodeSelected(processTreeNode);
            }
        }
    }
}
Also used : MachineEntity(org.eclipse.che.ide.api.machine.MachineEntity) ProcessTreeNode(org.eclipse.che.ide.extension.machine.client.processes.ProcessTreeNode)

Example 17 with ProcessTreeNode

use of org.eclipse.che.ide.extension.machine.client.processes.ProcessTreeNode in project che by eclipse.

the class ProcessesPanelViewImpl method showProcessOutput.

@Override
public void showProcessOutput(String processId) {
    if (!processWidgets.containsKey(processId)) {
        processId = "";
    }
    onResize();
    final WidgetToShow widgetToShow = processWidgets.get(processId);
    final SubPanel subPanel = widget2Panels.get(widgetToShow);
    if (subPanel != null) {
        subPanel.activateWidget(widgetToShow);
    }
    activeProcessId = processId;
    final ProcessTreeNode treeNode = processTreeNodes.get(processId);
    if (treeNode != null && !MACHINE_NODE.equals(treeNode.getType())) {
        treeNode.setHasUnreadContent(false);
        treeNode.getTreeNodeElement().getClassList().remove(machineResources.getCss().badgeVisible());
    }
}
Also used : WidgetToShow(org.eclipse.che.ide.ui.multisplitpanel.WidgetToShow) ProcessTreeNode(org.eclipse.che.ide.extension.machine.client.processes.ProcessTreeNode) SubPanel(org.eclipse.che.ide.ui.multisplitpanel.SubPanel)

Example 18 with ProcessTreeNode

use of org.eclipse.che.ide.extension.machine.client.processes.ProcessTreeNode in project che by eclipse.

the class ProcessesPanelViewImpl method setProcessesData.

@Override
public void setProcessesData(ProcessTreeNode root) {
    splitLayoutPanel.setWidgetHidden(navigationPanel, false);
    navigationPanelVisible = true;
    processTree.asWidget().setVisible(true);
    processTree.getModel().setRoot(root);
    processTree.renderTree();
    for (ProcessTreeNode processTreeNode : processTreeNodes.values()) {
        if (!processTreeNode.getId().equals(activeProcessId) && processTreeNode.hasUnreadContent()) {
            processTreeNode.getTreeNodeElement().getClassList().add(machineResources.getCss().badgeVisible());
        }
    }
}
Also used : ProcessTreeNode(org.eclipse.che.ide.extension.machine.client.processes.ProcessTreeNode)

Example 19 with ProcessTreeNode

use of org.eclipse.che.ide.extension.machine.client.processes.ProcessTreeNode in project che by eclipse.

the class ProcessesPanelPresenterTest method shouldShowErrorWhenMachineNodeIsNull.

@Test
public void shouldShowErrorWhenMachineNodeIsNull() throws Exception {
    List<ProcessTreeNode> children = new ArrayList<>();
    presenter.rootNode = new ProcessTreeNode(ROOT_NODE, null, null, null, children);
    OutputConsole outputConsole = mock(OutputConsole.class);
    presenter.addCommandOutput(MACHINE_ID, outputConsole);
    verify(notificationManager).notify(anyString(), anyString(), any(StatusNotification.Status.class), any(DisplayMode.class));
    verify(localizationConstant, times(2)).machineNotFound(eq(MACHINE_ID));
}
Also used : MachineStatus(org.eclipse.che.api.core.model.machine.MachineStatus) DisplayMode(org.eclipse.che.ide.api.notification.StatusNotification.DisplayMode) CommandOutputConsole(org.eclipse.che.ide.extension.machine.client.outputspanel.console.CommandOutputConsole) OutputConsole(org.eclipse.che.ide.api.outputconsole.OutputConsole) ArrayList(java.util.ArrayList) ProcessTreeNode(org.eclipse.che.ide.extension.machine.client.processes.ProcessTreeNode) Test(org.junit.Test)

Example 20 with ProcessTreeNode

use of org.eclipse.che.ide.extension.machine.client.processes.ProcessTreeNode 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

ProcessTreeNode (org.eclipse.che.ide.extension.machine.client.processes.ProcessTreeNode)36 Test (org.junit.Test)15 ArrayList (java.util.ArrayList)12 IsWidget (com.google.gwt.user.client.ui.IsWidget)8 MachineEntity (org.eclipse.che.ide.api.machine.MachineEntity)8 TerminalPresenter (org.eclipse.che.ide.extension.machine.client.perspective.terminal.TerminalPresenter)5 MachineConfigDto (org.eclipse.che.api.machine.shared.dto.MachineConfigDto)3 OutputConsole (org.eclipse.che.ide.api.outputconsole.OutputConsole)3 CommandOutputConsole (org.eclipse.che.ide.extension.machine.client.outputspanel.console.CommandOutputConsole)3 SubPanel (org.eclipse.che.ide.ui.multisplitpanel.SubPanel)3 Machine (org.eclipse.che.api.core.model.machine.Machine)2 ExtendedMachine (org.eclipse.che.api.core.model.workspace.ExtendedMachine)2 MachineDto (org.eclipse.che.api.machine.shared.dto.MachineDto)2 OperationException (org.eclipse.che.api.promises.client.OperationException)2 CommandOutputConsolePresenter (org.eclipse.che.ide.extension.machine.client.outputspanel.console.CommandOutputConsolePresenter)2 DefaultOutputConsole (org.eclipse.che.ide.extension.machine.client.outputspanel.console.DefaultOutputConsole)2 WidgetToShow (org.eclipse.che.ide.ui.multisplitpanel.WidgetToShow)2 AcceptsOneWidget (com.google.gwt.user.client.ui.AcceptsOneWidget)1 Focusable (com.google.gwt.user.client.ui.Focusable)1 Date (java.util.Date)1