Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » How do I handle my Model-Exceptions in GEF
How do I handle my Model-Exceptions in GEF [message #213005] Sat, 01 April 2006 08:06 Go to next message
adotor is currently offline adotorFriend
Messages: 46
Registered: July 2009
Member
Hello,

is there an elegant way to handle exceptions thrown by the model in the
commands. Currently my commands inherit the
org.eclipse.gef.commands.Command which doesn't allow to throw excpetions
in the execute-method.

Greetings,
Alexander
Re: How do I handle my Model-Exceptions in GEF [message #213153 is a reply to message #213005] Mon, 03 April 2006 16:49 Go to previous messageGo to next message
Steven R. Shaw is currently offline Steven R. ShawFriend
Messages: 128
Registered: July 2009
Senior Member
If an exception occurs during command execution, it is handled by the
CommandStack which will notify listeners that the command has been executed.
@see Command.execute. You could add a CommandStack listener before
executing and then check the undo command to see if it matches the command
you were executing to see if was successful.

Otherwise, it is possible to override the CommandStack and provide your own
special handling. Simply override the getAdapter method in your
GraphicalEditor to return your new CommandStack when adapting to
CommandStack.class.

-Steve

"Alexander Dotor" <alexander.dotor@uni-bayreuth.de> wrote in message
news:e0lcb5$9mq$1@utils.eclipse.org...
> Hello,
>
> is there an elegant way to handle exceptions thrown by the model in the
> commands. Currently my commands inherit the
> org.eclipse.gef.commands.Command which doesn't allow to throw excpetions
> in the execute-method.
>
> Greetings,
> Alexander
Re: How do I handle my Model-Exceptions in GEF [message #213187 is a reply to message #213153] Mon, 03 April 2006 17:52 Go to previous message
Steven R. Shaw is currently offline Steven R. ShawFriend
Messages: 128
Registered: July 2009
Senior Member
Actually, it is retrieved from the getAdapter, but more correctly you would
want to install your new CommandStack in the EditDomain which you would
associate with the viewer.

-Steve




"Steven Shaw" <steveshaw@ca.ibm.com> wrote in message
news:e0rjhd$gr2$1@utils.eclipse.org...
> If an exception occurs during command execution, it is handled by the
> CommandStack which will notify listeners that the command has been
executed.
> @see Command.execute. You could add a CommandStack listener before
> executing and then check the undo command to see if it matches the command
> you were executing to see if was successful.
>
> Otherwise, it is possible to override the CommandStack and provide your
own
> special handling. Simply override the getAdapter method in your
> GraphicalEditor to return your new CommandStack when adapting to
> CommandStack.class.
>
> -Steve
>
> "Alexander Dotor" <alexander.dotor@uni-bayreuth.de> wrote in message
> news:e0lcb5$9mq$1@utils.eclipse.org...
> > Hello,
> >
> > is there an elegant way to handle exceptions thrown by the model in the
> > commands. Currently my commands inherit the
> > org.eclipse.gef.commands.Command which doesn't allow to throw excpetions
> > in the execute-method.
> >
> > Greetings,
> > Alexander
>
>
Previous Topic:Tooltip handling in LeightweightSystem (Draw2D)
Next Topic:GEF / Draw2d adoption of ICU4J
Goto Forum:
  


Current Time: Tue Apr 16 15:49:23 GMT 2024

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

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

Back to the top