Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Command: InputDialog in canExecute()?
Command: InputDialog in canExecute()? [message #230450] Mon, 12 February 2007 18:25 Go to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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
Previous Topic:PrintAction in Mac
Next Topic:Selection events with my model objects
Goto Forum:
  


Current Time: Sat Apr 20 02:38:34 GMT 2024

Powered by FUDForum. Page generated in 0.02930 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top