Command: InputDialog in canExecute()? [message #230450] |
Mon, 12 February 2007 18:25 |
Eclipse User |
|
|
|
Originally posted by: devconsole.gmail.com
I would like to open an InputDialog when the user creates a new child
using a creation tool. So I tried to place the call to
InputDialog.open() in the execute() method of my command and everything
works - more or less.
The problem is that the command should not be executed at all if the
user clicks on the cancel button... But how to accomplish this?
Opening the dialog in execute() is too late because canExecute() already
returned true. Opening the dialog in canExecute() is not possible
because canExecute() gets invoked whenever the user moves the mouse.
Thanks in advance,
Dave
|
|
|
Re: Command: InputDialog in canExecute()? [message #230475 is a reply to message #230450] |
Tue, 13 February 2007 00:03 |
Eclipse User |
|
|
|
Originally posted by: none.unknown.com
Commands should only deal with the model anyway. A better way is to create
your own tool that would pop-up the dialog, gather all the information from
it and pass it to the command, and then execute the command only if
canExecute(). You can subclass CreationTool and override performCreation().
Then set the correct tool class on your entry on the palette.
"Dave Console" <devconsole@gmail.com> wrote in message
news:eqqbgt$upr$1@utils.eclipse.org...
>I would like to open an InputDialog when the user creates a new child using
>a creation tool. So I tried to place the call to InputDialog.open() in the
>execute() method of my command and everything works - more or less.
>
> The problem is that the command should not be executed at all if the user
> clicks on the cancel button... But how to accomplish this?
>
> Opening the dialog in execute() is too late because canExecute() already
> returned true. Opening the dialog in canExecute() is not possible because
> canExecute() gets invoked whenever the user moves the mouse.
>
> Thanks in advance,
>
> Dave
|
|
|
Powered by
FUDForum. Page generated in 0.02930 seconds