Home » Eclipse Projects » GEF » CompoundCommand.appendAndExecute
CompoundCommand.appendAndExecute [message #115701] |
Wed, 04 February 2004 17:34  |
Eclipse User |
|
|
|
Originally posted by: david_michonneau.hotmail.com
The EMF compoundcommand have a appendAndExecute method, which is extremely
useful, since it allows to create CompoundComand while execute the commands
you add to them.
If I wanted to have this functionality in the GEF CompoundCommands, how
could I do? CompoundCommand is a class, not an interface, so I cannot
rewrite its implementation and add the method. Should I just create my own
CompoundCommand custom class deriving from Command?
Thanks,
David
|
|
| |
Re: CompoundCommand.appendAndExecute [message #115795 is a reply to message #115769] |
Wed, 04 February 2004 20:53   |
Eclipse User |
|
|
|
Originally posted by: david_michonneau.hotmail.com
Some parts of my model are not linked to EditParts. So the caller could be
anything, just non-GEF. For example if I create a JFaceViewer with a
ICellModifier, I could decide to create a compoundcommand in modify() and
execute it against the GEF commandstack (since I have little choice if I
want to have only commandstack, I have to use the GEF one).
Now I am wondering if it wouldn't be even better to add this
appendAndExecute to the commandstack (or startTransaction, endTransaction),
to handle the rollback in case the compoundcommand can't be completely
executed. But I don't see any way to replace the GEF command stack.
Thanks,
David
"Randy Hudson" <none@us.ibm.com> wrote in message
news:bvs6iq$5e6$1@eclipse.org...
> Can you give an example of when this would be used? Specifically, I'm
> wondering who the caller of the method would be. It seems like you could
> add this method to a subclass, but it depends again on who is going to
call
> the method.
>
> "David Michonneau" <david_michonneau@hotmail.com> wrote in message
> news:bvrrsc$qse$1@eclipse.org...
> > The EMF compoundcommand have a appendAndExecute method, which is
extremely
> > useful, since it allows to create CompoundComand while execute the
> commands
> > you add to them.
> >
> > If I wanted to have this functionality in the GEF CompoundCommands, how
> > could I do? CompoundCommand is a class, not an interface, so I cannot
> > rewrite its implementation and add the method. Should I just create my
own
> > CompoundCommand custom class deriving from Command?
> >
> > Thanks,
> >
> > David
> >
> >
>
>
|
|
|
Re: CompoundCommand.appendAndExecute [message #116307 is a reply to message #115795] |
Mon, 09 February 2004 22:58   |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
> Some parts of my model are not linked to EditParts. So the caller could be
> anything, just non-GEF. For example if I create a JFaceViewer with a
> ICellModifier, I could decide to create a compoundcommand in modify() and
I still don't understand:
a) why modify(...) is a compound operation
b) why you can't compound everything prior to executing, and then just call
execute()
Are you using EMF too?
> execute it against the GEF commandstack (since I have little choice if I
> want to have only commandstack, I have to use the GEF one).
>
> Now I am wondering if it wouldn't be even better to add this
> appendAndExecute to the commandstack (or startTransaction,
endTransaction),
> to handle the rollback in case the compoundcommand can't be completely
> executed. But I don't see any way to replace the GEF command stack.
>
> Thanks,
>
> David
>
> "Randy Hudson" <none@us.ibm.com> wrote in message
> news:bvs6iq$5e6$1@eclipse.org...
> > Can you give an example of when this would be used? Specifically, I'm
> > wondering who the caller of the method would be. It seems like you
could
> > add this method to a subclass, but it depends again on who is going to
> call
> > the method.
> >
> > "David Michonneau" <david_michonneau@hotmail.com> wrote in message
> > news:bvrrsc$qse$1@eclipse.org...
> > > The EMF compoundcommand have a appendAndExecute method, which is
> extremely
> > > useful, since it allows to create CompoundComand while execute the
> > commands
> > > you add to them.
> > >
> > > If I wanted to have this functionality in the GEF CompoundCommands,
how
> > > could I do? CompoundCommand is a class, not an interface, so I cannot
> > > rewrite its implementation and add the method. Should I just create my
> own
> > > CompoundCommand custom class deriving from Command?
> > >
> > > Thanks,
> > >
> > > David
> > >
> > >
> >
> >
>
>
|
|
|
Re: CompoundCommand.appendAndExecute [message #116880 is a reply to message #115701] |
Tue, 10 February 2004 16:41   |
Eclipse User |
|
|
|
Originally posted by: phil.williams.toadmail.com
David,
Have you come up with a strategy for this one yet? I have a similar
issue. I have developed a GEF editor along with a View that allows the
user to modify the non visual attributes of an element in the editor.
In the view if the user enters a new value in a text field, say, I want
to be able to mark the editor as dirty so the user knows that a save is
needed and they are prompted to save when they close. (I would also
like to be able to support undo/redo.)
I think that the only way to accomplish this is to capture all changes
on text fields, buttons, etc and create and execute a GEF command that
encapsulates the change.
I am not sure that I like this solution since the View that I created
does not neccesarily need to be tied to a GEF Editor view of the model.
Is there a better approach?
Phil
David Michonneau wrote:
>The EMF compoundcommand have a appendAndExecute method, which is extremely
>useful, since it allows to create CompoundComand while execute the commands
>you add to them.
>
>If I wanted to have this functionality in the GEF CompoundCommands, how
>could I do? CompoundCommand is a class, not an interface, so I cannot
>rewrite its implementation and add the method. Should I just create my own
>CompoundCommand custom class deriving from Command?
>
>Thanks,
>
>David
>
>
>
>
|
|
|
Re: CompoundCommand.appendAndExecute [message #116893 is a reply to message #116307] |
Tue, 10 February 2004 16:58   |
Eclipse User |
|
|
|
Originally posted by: david_michonneau.hotmail.com
"Randy Hudson" <none@us.ibm.com> wrote in message
news:c09knj$r0$1@eclipse.org...
> > Some parts of my model are not linked to EditParts. So the caller could
be
> > anything, just non-GEF. For example if I create a JFaceViewer with a
> > ICellModifier, I could decide to create a compoundcommand in modify()
and
>
> I still don't understand:
> a) why modify(...) is a compound operation
> b) why you can't compound everything prior to executing, and then just
call
> execute()
>
> Are you using EMF too?
>
Well, modify() could trigger a lot of changes, depending on the logic of the
model. Let's say I increase a tax percentage, I would have to recalculate
lots of prices. Then it's much easier for a developer to execute the
commands one by one, so that he can inspect the model state after each
command to decide what to do next (if the new price is over100$ after the
new percentage is applied, do some additional change...).
I might use EMF or GEF command framework, I need to choose one, still not
decided. But in EMF this appendAndExecute is a nice feature.
Thanks,
David
> > execute it against the GEF commandstack (since I have little choice if I
> > want to have only commandstack, I have to use the GEF one).
> >
> > Now I am wondering if it wouldn't be even better to add this
> > appendAndExecute to the commandstack (or startTransaction,
> endTransaction),
> > to handle the rollback in case the compoundcommand can't be completely
> > executed. But I don't see any way to replace the GEF command stack.
> >
> > Thanks,
> >
> > David
> >
> > "Randy Hudson" <none@us.ibm.com> wrote in message
> > news:bvs6iq$5e6$1@eclipse.org...
> > > Can you give an example of when this would be used? Specifically, I'm
> > > wondering who the caller of the method would be. It seems like you
> could
> > > add this method to a subclass, but it depends again on who is going to
> > call
> > > the method.
> > >
> > > "David Michonneau" <david_michonneau@hotmail.com> wrote in message
> > > news:bvrrsc$qse$1@eclipse.org...
> > > > The EMF compoundcommand have a appendAndExecute method, which is
> > extremely
> > > > useful, since it allows to create CompoundComand while execute the
> > > commands
> > > > you add to them.
> > > >
> > > > If I wanted to have this functionality in the GEF CompoundCommands,
> how
> > > > could I do? CompoundCommand is a class, not an interface, so I
cannot
> > > > rewrite its implementation and add the method. Should I just create
my
> > own
> > > > CompoundCommand custom class deriving from Command?
> > > >
> > > > Thanks,
> > > >
> > > > David
> > > >
> > > >
> > >
> > >
> >
> >
>
>
|
|
|
Re: CompoundCommand.appendAndExecute [message #116905 is a reply to message #116880] |
Tue, 10 February 2004 17:03   |
Eclipse User |
|
|
|
Originally posted by: david_michonneau.hotmail.com
"Phil Williams" <phil.williams@toadmail.com> wrote in message
news:c0bj11$g3m$1@eclipse.org...
> David,
>
> Have you come up with a strategy for this one yet? I have a similar
> issue. I have developed a GEF editor along with a View that allows the
> user to modify the non visual attributes of an element in the editor.
> In the view if the user enters a new value in a text field, say, I want
> to be able to mark the editor as dirty so the user knows that a save is
> needed and they are prompted to save when they close. (I would also
> like to be able to support undo/redo.)
>
> I think that the only way to accomplish this is to capture all changes
> on text fields, buttons, etc and create and execute a GEF command that
> encapsulates the change.
>
> I am not sure that I like this solution since the View that I created
> does not neccesarily need to be tied to a GEF Editor view of the model.
That's why having a proprietary commandstack in GEF is bad, because it's
intrusive in other views/editors, although they don't need GEF. I haven't
figured out the best way to do that, if you use EMF, Jeez wrappers are an
interesting option though (so you can use EMF commands). Otherwise your
approach will work, I tried it, and that works fine, you just need a handle
on the GEF commandstack.
>
> Is there a better approach?
>
> Phil
>
> David Michonneau wrote:
>
> >The EMF compoundcommand have a appendAndExecute method, which is
extremely
> >useful, since it allows to create CompoundComand while execute the
commands
> >you add to them.
> >
> >If I wanted to have this functionality in the GEF CompoundCommands, how
> >could I do? CompoundCommand is a class, not an interface, so I cannot
> >rewrite its implementation and add the method. Should I just create my
own
> >CompoundCommand custom class deriving from Command?
> >
> >Thanks,
> >
> >David
> >
> >
> >
> >
|
|
|
Re: CompoundCommand.appendAndExecute [message #117074 is a reply to message #116893] |
Wed, 11 February 2004 15:06   |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
> Well, modify() could trigger a lot of changes, depending on the logic of
the
> model. Let's say I increase a tax percentage, I would have to recalculate
The model should not have logic in it. Put the logic in the commands. The
model shouldn't even know that commands are being used to manipulate it, so
how would changing one thing trigger a command to be appended?
> lots of prices. Then it's much easier for a developer to execute the
> commands one by one, so that he can inspect the model state after each
> command to decide what to do next (if the new price is over100$ after the
> new percentage is applied, do some additional change...).
>
> I might use EMF or GEF command framework, I need to choose one, still not
> decided. But in EMF this appendAndExecute is a nice feature.
This is not what the appendAndExecute is used for in EMF, afaik.
The frameworks are not mutually exclusive. A significant % of GEF
application are backed by an EMF model.
|
|
|
Re: CompoundCommand.appendAndExecute [message #117087 is a reply to message #116880] |
Wed, 11 February 2004 15:09   |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
"Phil Williams" <phil.williams@toadmail.com> wrote in message
news:c0bj11$g3m$1@eclipse.org...
> David,
>
> Have you come up with a strategy for this one yet? I have a similar
> issue. I have developed a GEF editor along with a View that allows the
> user to modify the non visual attributes of an element in the editor.
> In the view if the user enters a new value in a text field, say, I want
> to be able to mark the editor as dirty so the user knows that a save is
> needed and they are prompted to save when they close. (I would also
> like to be able to support undo/redo.)
>
> I think that the only way to accomplish this is to capture all changes
> on text fields, buttons, etc and create and execute a GEF command that
> encapsulates the change.
>
> I am not sure that I like this solution since the View that I created
> does not neccesarily need to be tied to a GEF Editor view of the model.
>
> Is there a better approach?
Products build on eclipse face this problem a lot. Typically, using a timer
or focusLost event, Commands are lazily created which capture the
information to undo the change made on the text field, etc. Your view needs
to be tied into the editor, in the same way the outlines and property sheets
are outside of the editor, but essentially integrated.
> Phil
>
> David Michonneau wrote:
>
> >The EMF compoundcommand have a appendAndExecute method, which is
extremely
> >useful, since it allows to create CompoundComand while execute the
commands
> >you add to them.
> >
> >If I wanted to have this functionality in the GEF CompoundCommands, how
> >could I do? CompoundCommand is a class, not an interface, so I cannot
> >rewrite its implementation and add the method. Should I just create my
own
> >CompoundCommand custom class deriving from Command?
> >
> >Thanks,
> >
> >David
> >
> >
> >
> >
|
|
|
Re: CompoundCommand.appendAndExecute [message #117212 is a reply to message #117087] |
Wed, 11 February 2004 19:09   |
Eclipse User |
|
|
|
Originally posted by: phil.williams.toadmail.com
This is a multi-part message in MIME format.
--------------070609080400020905080206
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
>>I am not sure that I like this solution since the View that I created
>>does not neccesarily need to be tied to a GEF Editor view of the model.
>>
>>Is there a better approach?
>>
>>
>
>Products build on eclipse face this problem a lot. Typically, using a timer
>or focusLost event, Commands are lazily created which capture the
>information to undo the change made on the text field, etc. Your view needs
>to be tied into the editor, in the same way the outlines and property sheets
>are outside of the editor, but essentially integrated.
>
>
OK, I guess that makes sense.
However, I would like to reuse the widgets within the view in other
places in my application, say in a preference page. In that way the
default values for my model could be set by the user so that new model
elements would take on those values. When the widgets are within a
preference page they should not fire off commands. FYI, the widgets
that are within the view are built at run time, not compile time, if
that makes any difference.
So does that mean that I would simply have two different controllers for
the same (MVC) view? When the view is within an Eclipse view the
controller is integrated with the editor and the GEF command stack is
used to manipulate the model. When it is within a preference page there
would be a different controller that would not use the GEF commands.
Does that make any sense?
Thanks for listening.
Phil
--------------070609080400020905080206
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<title></title>
</head>
<body>
<br>
<blockquote type="cite" cite="midc0e208$e2l$1@eclipse.org">
<blockquote type="cite">
<pre wrap="">I am not sure that I like this solution since the View that I created
does not neccesarily need to be tied to a GEF Editor view of the model.
Is there a better approach?
</pre>
</blockquote>
<pre wrap=""><!---->
Products build on eclipse face this problem a lot. Typically, using a timer
or focusLost event, Commands are lazily created which capture the
information to undo the change made on the text field, etc. Your view needs
to be tied into the editor, in the same way the outlines and property sheets
are outside of the editor, but essentially integrated.
</pre>
</blockquote>
OK, I guess that makes sense.<br>
<br>
However, I would like to reuse the widgets within the view in other
places in my application, say in a preference page. In that way the
default values for my model could be set by the user so that new model
elements would take on those values. When the widgets are within a
preference page they should not fire off commands. FYI, the widgets
that are within the view are built at run time, not compile time, if
that makes any difference.<br>
<br>
So does that mean that I would simply have two different controllers
for the same (MVC) view? When the view is within an Eclipse view the
controller is integrated with the editor and the GEF command stack is
used to manipulate the model. When it is within a preference page
there would be a different controller that would not use the GEF
commands.<br>
<br>
Does that make any sense?<br>
<br>
Thanks for listening.<br>
<br>
Phil<br>
<br>
</body>
</html>
--------------070609080400020905080206--
|
|
|
Re: CompoundCommand.appendAndExecute [message #117451 is a reply to message #117212] |
Thu, 12 February 2004 14:37  |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
This is a multi-part message in MIME format.
------=_NextPart_000_0081_01C3F175.BEE2D430
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I think you are in the best position to make the decision. Perhaps =
decorating the widgets with listeners which build commands or something.
"Phil Williams" <phil.williams@toadmail.com> wrote in message =
news:c0eg28$ut2$1@eclipse.org...
I am not sure that I like this solution since the View that I created
does not neccesarily need to be tied to a GEF Editor view of the model.
Is there a better approach?
=20
Products build on eclipse face this problem a lot. Typically, using a =
timer
or focusLost event, Commands are lazily created which capture the
information to undo the change made on the text field, etc. Your view =
needs
to be tied into the editor, in the same way the outlines and property =
sheets
are outside of the editor, but essentially integrated.
OK, I guess that makes sense.
However, I would like to reuse the widgets within the view in other =
places in my application, say in a preference page. In that way the =
default values for my model could be set by the user so that new model =
elements would take on those values. When the widgets are within a =
preference page they should not fire off commands. FYI, the widgets =
that are within the view are built at run time, not compile time, if =
that makes any difference.
So does that mean that I would simply have two different controllers =
for the same (MVC) view? When the view is within an Eclipse view the =
controller is integrated with the editor and the GEF command stack is =
used to manipulate the model. When it is within a preference page there =
would be a different controller that would not use the GEF commands.
Does that make any sense?
Thanks for listening.
Phil
------=_NextPart_000_0081_01C3F175.BEE2D430
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE></TITLE>
<META http-equiv=3DContent-Type =
content=3Dtext/html;charset=3DISO-8859-1>
<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>I think you are in the best position to =
make the=20
decision. Perhaps decorating the widgets with listeners which =
build=20
commands or something.</FONT></DIV>
<DIV>"Phil Williams" <<A=20
href=3D"mailto:phil.williams@toadmail.com">phil.williams@toadmail.com</A>=
>=20
wrote in message <A=20
href=3D"news:c0eg28$ut2$1@eclipse.org">news:c0eg28$ut2$1@eclipse.org</A>.=
...</DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px"><BR>
<BLOCKQUOTE cite=3Dmidc0e208$e2l$1@eclipse.org type=3D"cite">
<BLOCKQUOTE type=3D"cite"><PRE wrap=3D"">I am not sure that I like =
this solution since the View that I created
does not neccesarily need to be tied to a GEF Editor view of the model.
Is there a better approach?
</PRE></BLOCKQUOTE><PRE wrap=3D""><!---->
Products build on eclipse face this problem a lot. Typically, using a =
timer
or focusLost event, Commands are lazily created which capture the
information to undo the change made on the text field, etc. Your view =
needs
to be tied into the editor, in the same way the outlines and property =
sheets
are outside of the editor, but essentially integrated.
</PRE></BLOCKQUOTE>OK, I guess that makes sense.<BR><BR>However, I =
would=20
like to reuse the widgets within the view in other places in my =
application,=20
say in a preference page. In that way the default values for my =
model=20
could be set by the user so that new model elements would take on =
those=20
values. When the widgets are within a preference page they =
should not=20
fire off commands. FYI, the widgets that are within the view are =
built=20
at run time, not compile time, if that makes any difference.<BR><BR>So =
does=20
that mean that I would simply have two different controllers for the =
same=20
(MVC) view? When the view is within an Eclipse view the =
controller is=20
integrated with the editor and the GEF command stack is used to =
manipulate the=20
model. When it is within a preference page there would be a =
different=20
controller that would not use the GEF commands.<BR><BR>Does that make =
any=20
sense?<BR><BR>Thanks for=20
listening.<BR><BR>Phil<BR><BR></BLOCKQUOTE></BODY></HTML >
------=_NextPart_000_0081_01C3F175.BEE2D430--
|
|
|
Goto Forum:
Current Time: Wed Apr 30 10:17:36 EDT 2025
Powered by FUDForum. Page generated in 0.33486 seconds
|