Ejemplo n.º 1
0
 /**
  * ************************************************************************* Called when the
  * dialog is about to close.
  *
  * @return The superclass return value.
  *     ************************************************************************
  */
 public boolean close() {
   if (s_smgr.haveShell()) {
     s_smgr.removeShellListener(this);
   }
   m_image.dispose();
   return super.close();
 }
Ejemplo n.º 2
0
 /**
  * ************************************************************************* Constructor
  *
  * @param shell The parent shell
  *     ************************************************************************
  */
 public MasterShellDialog(Shell shell) {
   super(shell);
   if (s_smgr == null) {
     s_smgr = (IShellManager) ServiceManager.get(IShellManager.class);
   }
   // Try to load the shell plugin if available
   if (s_smgr.haveShell()) {
     s_smgr.addShellListener(this);
   }
   // Obtain the image for the dialog icon
   ImageDescriptor descr = Activator.getImageDescriptor("icons/dlg_exec.png");
   m_image = descr.createImage();
 }
Ejemplo n.º 3
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();
   }
 }