@Override public void onTreeNodeSelected(@NotNull ProcessTreeNode node) { selectedTreeNode = node; view.showProcessOutput(node.getId()); resfreshStopButtonState(node.getId()); }
private void onStopProcess(@NotNull ProcessTreeNode node) { String processId = node.getId(); ProcessTreeNode parentNode = node.getParent(); int processIndex = view.getNodeIndex(processId); if (processIndex < 0) { return; } int countWidgets = terminals.size() + consoles.size(); if (countWidgets == 1) { view.hideProcessOutput(processId); removeChildFromMachineNode(node, parentNode); return; } int neighborIndex = processIndex > 0 ? processIndex - 1 : processIndex + 1; ProcessTreeNode neighborNode = view.getNodeByIndex(neighborIndex); String neighborNodeId = neighborNode.getId(); removeChildFromMachineNode(node, parentNode); view.selectNode(neighborNode); resfreshStopButtonState(neighborNodeId); view.showProcessOutput(neighborNodeId); view.hideProcessOutput(processId); }
/** * Adds command node to process tree and displays command output * * @param machineId id of machine in which the command will be executed * @param outputConsole the console for command output */ public void addCommandOutput(@NotNull String machineId, @NotNull OutputConsole outputConsole) { ProcessTreeNode machineTreeNode = findProcessTreeNodeById(machineId); if (machineTreeNode == null) { notificationManager.notify( localizationConstant.failedToExecuteCommand(), localizationConstant.machineNotFound(machineId), FAIL, FLOAT_MODE); Log.error(getClass(), localizationConstant.machineNotFound(machineId)); return; } String commandId; String outputConsoleTitle = outputConsole.getTitle(); ProcessTreeNode processTreeNode = getProcessTreeNodeByName(outputConsoleTitle, machineTreeNode); if (processTreeNode != null && isCommandStopped(processTreeNode.getId())) { commandId = processTreeNode.getId(); view.hideProcessOutput(commandId); } else { ProcessTreeNode commandNode = new ProcessTreeNode( COMMAND_NODE, machineTreeNode, outputConsoleTitle, outputConsole.getTitleIcon(), null); commandId = commandNode.getId(); view.addProcessNode(commandNode); addChildToMachineNode(commandNode, machineTreeNode); } updateCommandOutput(commandId, outputConsole); resfreshStopButtonState(commandId); workspaceAgent.setActivePart(this); }