else if(currentProcess!=null && source==runStopButton) { processInput.close(); currentProcess.destroy(); this.currentProcess = null; switchToRunState();
if(currentProcess == null) runCommand(inputCombo.getCommand());   else { processInput.close(); currentProcess.destroy(); this.currentProcess = null; switchToRunState(); }
    public void actionPerformed(ActionEvent e) {        Object source = e.getSource();        // Clears shell history.        if(source == clearButton) {            ShellHistoryManager.clear();            if(currentProcess == null)                inputCombo.requestFocus();            else                outputTextArea.requestFocus();        }        // Run button starts a new command        else if(currentProcess==null && (source == runStopButton))            runCommand(inputCombo.getCommand());        // Stop button stops current process        else if(currentProcess!=null && source==runStopButton) {            processInput.close();            currentProcess.destroy();            this.currentProcess = null;            switchToRunState();        }        // Cancel button disposes the dialog and kills the process        else if(source == cancelButton) {            if(currentProcess != null)                currentProcess.destroy();            dispose();			        }    }