示例#1
0
 /**
  * ************************************************************************* Callback for key
  * release event. Used for command processing.
  *
  * @param e Key release event
  *     ************************************************************************
  */
 public void keyReleased(KeyEvent e) {
   // Check if the key code corresponds to one of the two enter keys.
   if (e.keyCode == 13 || e.keyCode == 16777296) {
     // Obtain the contents of the input field
     String cmdString = m_prompt.getValue();
     try {
       // Add the text to the display, reset the prompt, and
       // send the command string to the shell manager
       if (!s_smgr.haveShell()) {
         addDisplayMessage("No shell plugin available.");
         return;
       }
       addDisplayMessage(m_prompt.getPrompt() + PromptField.PROMPT_SYMBOL + cmdString);
       s_smgr.shellInput(cmdString);
     } catch (CommandFailed ex) {
       // If the console manager raises an error show it on the
       // display
       addDisplayMessage("ERROR (" + m_prompt.getPrompt() + "): " + ex.getLocalizedMessage());
     }
     m_prompt.reset();
   }
 }