Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
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 07:03 Go to next message
Eclipse UserFriend
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 08:59 Go to previous messageGo to next message
Hans Mueller-Dieckert is currently offline Hans Mueller-DieckertFriend
Messages: 32
Registered: July 2009
Member
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 #47124 is a reply to message #47030] Mon, 28 August 2006 11:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

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 #47291 is a reply to message #47093] Tue, 29 August 2006 06:04 Go to previous messageGo to next message
Eclipse UserFriend
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 14:09 Go to previous message
Eclipse UserFriend
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 08:59 Go to previous message
Hans Mueller-Dieckert is currently offline Hans Mueller-DieckertFriend
Messages: 32
Registered: July 2009
Member
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 11:15 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33216
Registered: July 2009
Senior Member
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


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Where should we cancel the execution of a Command? [message #586606 is a reply to message #47093] Tue, 29 August 2006 06:04 Go to previous message
Eclipse UserFriend
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 14:09 Go to previous message
Eclipse UserFriend
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
Previous Topic:OCL and MetaModels
Next Topic:OCL or QUERY and CDO
Goto Forum:
  


Current Time: Fri Sep 20 06:12:33 GMT 2024

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

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

Back to the top