Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc) » Where should we cancel the execution of a Command?
Where should we cancel the execution of a Command? [message #47030] |
Mon, 28 August 2006 03:03  |
Eclipse User |
|
|
|
Originally posted by: hocnt.cybersoft-vn.com
Hi all,
I'm using EMFT. I override some EMF commands to show a custom dialog or
wizards. In the middle of the execution of a command, user can cancel
the execution by clicking on the Cancel button of the No button of the
wizard or dialog. I show the dialog or wizard in the execute() method.
If user cancels the command, I throw a RuntimeException to force the
current transaction to be rolled back. This works but it does not seem a
proper way. Does anyone have any other ideas?
Thanks,
Hoc
|
|
|
Re: Where should we cancel the execution of a Command? [message #47093 is a reply to message #47030] |
Mon, 28 August 2006 04:59   |
Eclipse User |
|
|
|
Hi,
I think the best place for showing a Wizard would be the canExecute() or
the prepare()-method.
But as I understand you right, you would have to do some stuff, show the
Wizard, remember the user input, roll everything back (in the
prepare()-method) and on execution of the command do everything again.
greetings,
Hans
Hoc Nguyen schrieb:
> Hi all,
> I'm using EMFT. I override some EMF commands to show a custom dialog or
> wizards. In the middle of the execution of a command, user can cancel
> the execution by clicking on the Cancel button of the No button of the
> wizard or dialog. I show the dialog or wizard in the execute() method.
> If user cancels the command, I throw a RuntimeException to force the
> current transaction to be rolled back. This works but it does not seem a
> proper way. Does anyone have any other ideas?
> Thanks,
> Hoc
|
|
| |
Re: Where should we cancel the execution of a Command? [message #47291 is a reply to message #47093] |
Tue, 29 August 2006 02:04   |
Eclipse User |
|
|
|
Originally posted by: hocnt.cybersoft-vn.com
hi Mueller-Dieckert,
The canExecute() and prepare() method are called before user performs
some actions which trigger the execution of the command => it's early to
show the wizard/dialog.
Thanks,
Hoc
Hans Mueller-Dieckert wrote:
> Hi,
>
> I think the best place for showing a Wizard would be the canExecute() or
> the prepare()-method.
> But as I understand you right, you would have to do some stuff, show the
> Wizard, remember the user input, roll everything back (in the
> prepare()-method) and on execution of the command do everything again.
>
> greetings,
> Hans
>
> Hoc Nguyen schrieb:
>
>> Hi all,
>> I'm using EMFT. I override some EMF commands to show a custom dialog
>> or wizards. In the middle of the execution of a command, user can
>> cancel the execution by clicking on the Cancel button of the No button
>> of the wizard or dialog. I show the dialog or wizard in the execute()
>> method. If user cancels the command, I throw a RuntimeException to
>> force the current transaction to be rolled back. This works but it
>> does not seem a proper way. Does anyone have any other ideas?
>> Thanks,
>> Hoc
|
|
|
Re: Where should we cancel the execution of a Command? [message #47564 is a reply to message #47030] |
Tue, 29 August 2006 10:09  |
Eclipse User |
|
|
|
Originally posted by: cdamus.ca.ibm.com
Hi, Hoc,
I agree with Ed about the most desirable placement of user interaction code
being in the UI action. However, this is not always feasible, as GMF has
demonstrated in, for example, the Connection Assistant handles
functionality.
Since https://bugs.eclipse.org/bugs/show_bug.cgi?id=146853, a Command that
throws an OperationCanceledException will cause a graceful rollback that
will not log any errors (user cancel is a normal condition).
HTH,
Christian
Hoc Nguyen wrote:
> Hi all,
> I'm using EMFT. I override some EMF commands to show a custom dialog or
> wizards. In the middle of the execution of a command, user can cancel
> the execution by clicking on the Cancel button of the No button of the
> wizard or dialog. I show the dialog or wizard in the execute() method.
> If user cancels the command, I throw a RuntimeException to force the
> current transaction to be rolled back. This works but it does not seem a
> proper way. Does anyone have any other ideas?
> Thanks,
> Hoc
|
|
|
Re: Where should we cancel the execution of a Command? [message #586477 is a reply to message #47030] |
Mon, 28 August 2006 04:59  |
Eclipse User |
|
|
|
Hi,
I think the best place for showing a Wizard would be the canExecute() or
the prepare()-method.
But as I understand you right, you would have to do some stuff, show the
Wizard, remember the user input, roll everything back (in the
prepare()-method) and on execution of the command do everything again.
greetings,
Hans
Hoc Nguyen schrieb:
> Hi all,
> I'm using EMFT. I override some EMF commands to show a custom dialog or
> wizards. In the middle of the execution of a command, user can cancel
> the execution by clicking on the Cancel button of the No button of the
> wizard or dialog. I show the dialog or wizard in the execute() method.
> If user cancels the command, I throw a RuntimeException to force the
> current transaction to be rolled back. This works but it does not seem a
> proper way. Does anyone have any other ideas?
> Thanks,
> Hoc
|
|
|
Re: Where should we cancel the execution of a Command? [message #586497 is a reply to message #47030] |
Mon, 28 August 2006 07:15  |
Eclipse User |
|
|
|
Hoc,
Generally it seems better to hook a wizard up directly to an action and
create a command at the end of the interaction with the wizard, rather
than try to bring up a wizard as part of executing a command.
Hoc Nguyen wrote:
> Hi all,
> I'm using EMFT. I override some EMF commands to show a custom dialog
> or wizards. In the middle of the execution of a command, user can
> cancel the execution by clicking on the Cancel button of the No button
> of the wizard or dialog. I show the dialog or wizard in the execute()
> method. If user cancels the command, I throw a RuntimeException to
> force the current transaction to be rolled back. This works but it
> does not seem a proper way. Does anyone have any other ideas?
> Thanks,
> Hoc
|
|
|
Re: Where should we cancel the execution of a Command? [message #586606 is a reply to message #47093] |
Tue, 29 August 2006 02:04  |
Eclipse User |
|
|
|
Originally posted by: hocnt.cybersoft-vn.com
hi Mueller-Dieckert,
The canExecute() and prepare() method are called before user performs
some actions which trigger the execution of the command => it's early to
show the wizard/dialog.
Thanks,
Hoc
Hans Mueller-Dieckert wrote:
> Hi,
>
> I think the best place for showing a Wizard would be the canExecute() or
> the prepare()-method.
> But as I understand you right, you would have to do some stuff, show the
> Wizard, remember the user input, roll everything back (in the
> prepare()-method) and on execution of the command do everything again.
>
> greetings,
> Hans
>
> Hoc Nguyen schrieb:
>
>> Hi all,
>> I'm using EMFT. I override some EMF commands to show a custom dialog
>> or wizards. In the middle of the execution of a command, user can
>> cancel the execution by clicking on the Cancel button of the No button
>> of the wizard or dialog. I show the dialog or wizard in the execute()
>> method. If user cancels the command, I throw a RuntimeException to
>> force the current transaction to be rolled back. This works but it
>> does not seem a proper way. Does anyone have any other ideas?
>> Thanks,
>> Hoc
|
|
|
Re: Where should we cancel the execution of a Command? [message #586742 is a reply to message #47030] |
Tue, 29 August 2006 10:09  |
Eclipse User |
|
|
|
Originally posted by: cdamus.ca.ibm.com
Hi, Hoc,
I agree with Ed about the most desirable placement of user interaction code
being in the UI action. However, this is not always feasible, as GMF has
demonstrated in, for example, the Connection Assistant handles
functionality.
Since https://bugs.eclipse.org/bugs/show_bug.cgi?id=146853, a Command that
throws an OperationCanceledException will cause a graceful rollback that
will not log any errors (user cancel is a normal condition).
HTH,
Christian
Hoc Nguyen wrote:
> Hi all,
> I'm using EMFT. I override some EMF commands to show a custom dialog or
> wizards. In the middle of the execution of a command, user can cancel
> the execution by clicking on the Cancel button of the No button of the
> wizard or dialog. I show the dialog or wizard in the execute() method.
> If user cancels the command, I throw a RuntimeException to force the
> current transaction to be rolled back. This works but it does not seem a
> proper way. Does anyone have any other ideas?
> Thanks,
> Hoc
|
|
|
Goto Forum:
Current Time: Sat May 10 03:16:19 EDT 2025
Powered by FUDForum. Page generated in 0.03225 seconds
|