From d4ea175aab253bdb073bba4722b6d2ab18a5df88 Mon Sep 17 00:00:00 2001 From: Vitaliy Guliy Date: Tue, 25 Oct 2016 16:57:48 +0300 Subject: [PATCH] CHE-2775 Amount of machines is not correctly displayed in process tree (#2885) Signed-off-by: Vitaliy Guliy --- .../panel/ProcessesPanelPresenter.java | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/plugins/plugin-machine/che-plugin-machine-ext-client/src/main/java/org/eclipse/che/ide/extension/machine/client/processes/panel/ProcessesPanelPresenter.java b/plugins/plugin-machine/che-plugin-machine-ext-client/src/main/java/org/eclipse/che/ide/extension/machine/client/processes/panel/ProcessesPanelPresenter.java index 9d6afedc9d..b1dc68cbbc 100644 --- a/plugins/plugin-machine/che-plugin-machine-ext-client/src/main/java/org/eclipse/che/ide/extension/machine/client/processes/panel/ProcessesPanelPresenter.java +++ b/plugins/plugin-machine/che-plugin-machine-ext-client/src/main/java/org/eclipse/che/ide/extension/machine/client/processes/panel/ProcessesPanelPresenter.java @@ -180,6 +180,42 @@ public class ProcessesPanelPresenter extends BasePresenter implements ProcessesP eventBus.addHandler(DownloadWorkspaceOutputEvent.TYPE, this); } + /** + * Updates list of the machines from application context. + */ + public void updateMachineList() { + if (appContext.getWorkspace() == null) { + return; + } + + List machines = getMachines(appContext.getWorkspace()); + if (machines.isEmpty()) { + return; + } + + ProcessTreeNode machineToSelect = null; + for (MachineEntity machine : machines) { + if (machine.isDev()) { + provideMachineNode(machine, true); + machines.remove(machine); + break; + } + } + + for (MachineEntity machine : machines) { + provideMachineNode(machine, true); + } + + if (machineToSelect == null) { + machineToSelect = machineNodes.entrySet().iterator().next().getValue(); + } + + view.selectNode(machineToSelect); + + workspaceAgent.setActivePart(ProcessesPanelPresenter.this); + } + + @Override public void go(AcceptsOneWidget container) { container.setWidget(view);