Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » EMF Commands vs. GEF Commands
EMF Commands vs. GEF Commands [message #76389] Wed, 23 April 2003 19:45 Go to next message
Edmund Reinhardt is currently offline Edmund ReinhardtFriend
Messages: 16
Registered: July 2009
Junior Member
I am designing my model in EMF so it will respond to EMF commands using the
EMF command stack for Undo/Redo.
I then want to put a GEF editor on top of that. But GEF is using its own
commands and command stack.
What is the recommended way of gettng EMF models and GEF edit parts to
communicate?

Thanks in advance
Re: EMF Commands vs. GEF Commands [message #76420 is a reply to message #76389] Wed, 23 April 2003 19:56 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

Could you please elaborate on your dependencies of the EMF commands package?
For example, why do you need to use the EMF command stack instead of the GEF
one, etc.

"Edmund Reinhardt" <reinhard@ca.ibm.com> wrote in message
news:b86pqn$mc6$1@rogue.oti.com...
> I am designing my model in EMF so it will respond to EMF commands using
the
> EMF command stack for Undo/Redo.
> I then want to put a GEF editor on top of that. But GEF is using its own
> commands and command stack.
> What is the recommended way of gettng EMF models and GEF edit parts to
> communicate?
>
> Thanks in advance
>
>
Re: EMF Commands vs. GEF Commands [message #76451 is a reply to message #76420] Wed, 23 April 2003 20:41 Go to previous messageGo to next message
Edmund Reinhardt is currently offline Edmund ReinhardtFriend
Messages: 16
Registered: July 2009
Junior Member
The model will be reused for other views (Properties, Outline) and
potentially editors that are not based on GEF.
I thought the recommended approach was to build the model in EMF with the
notification and command structure and then bolt on editors on top of that.

For example a move or resize command could be initiated from the Properties
or GEF editor.
Does each view and editor has its own command stack that Edit->Undo operates
on the current editor/view? But then Undos could be done out of order by
selecting the view and editor in a different order while undoing.
So for consistency, the undo stack has to be maintained by the model. Which
means that there is only one command stack which can contain only one type
of command?

Am I missing something?

"Randy Hudson" <none@us.ibm.com> wrote in message
news:b86qf4$mp3$1@rogue.oti.com...
> Could you please elaborate on your dependencies of the EMF commands
package?
> For example, why do you need to use the EMF command stack instead of the
GEF
> one, etc.
>
> "Edmund Reinhardt" <reinhard@ca.ibm.com> wrote in message
> news:b86pqn$mc6$1@rogue.oti.com...
> > I am designing my model in EMF so it will respond to EMF commands using
> the
> > EMF command stack for Undo/Redo.
> > I then want to put a GEF editor on top of that. But GEF is using its
own
> > commands and command stack.
> > What is the recommended way of gettng EMF models and GEF edit parts to
> > communicate?
> >
> > Thanks in advance
> >
> >
>
>
Re: EMF Commands vs. GEF Commands [message #76483 is a reply to message #76451] Wed, 23 April 2003 21:53 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

"Edmund Reinhardt" <reinhard@ca.ibm.com> wrote in message
news:b86t4v$onp$1@rogue.oti.com...
> The model will be reused for other views (Properties, Outline) and
> potentially editors that are not based on GEF.
> I thought the recommended approach was to build the model in EMF with the
> notification and command structure and then bolt on editors on top of
that.

What does "command structure" mean, other than the base interfaces and
impls? Don't you have to write your own commands to manipulate the model?

> For example a move or resize command could be initiated from the
Properties
> or GEF editor.
> Does each view and editor has its own command stack that Edit->Undo
operates
> on the current editor/view? But then Undos could be done out of order by

No, all views should share a common command stack. That means that the
commands that the property sheet executes would be the same as the types
used by GEF.

> selecting the view and editor in a different order while undoing.
> So for consistency, the undo stack has to be maintained by the model.
Which
> means that there is only one command stack which can contain only one type
> of command?

Correct.
Re: EMF Commands vs. GEF Commands [message #76499 is a reply to message #76389] Thu, 24 April 2003 01:18 Go to previous messageGo to next message
Eric Suen is currently offline Eric SuenFriend
Messages: 94
Registered: July 2009
Member
Hi,

I have written some wrap for EMF & GEF, Maybe it is not the best way,
but it works. for more information, you can visite:
http://sourceforge.net/projects/jeez

I think the best way is EMF & GEF use the same command interface.

Regards,

Eric

"Edmund Reinhardt" <reinhard@ca.ibm.com> д
  • Attachment: commands.zip
    (Size: 3.14KB, Downloaded 93 times)
Re: EMF Commands vs. GEF Commands [message #76811 is a reply to message #76483] Sat, 26 April 2003 02:40 Go to previous messageGo to next message
Edmund Reinhardt is currently offline Edmund ReinhardtFriend
Messages: 16
Registered: July 2009
Junior Member
Hi Randy,

> No, all views should share a common command stack. That means that the
> commands that the property sheet executes would be the same as the types
> used by GEF.

I see that Eric Suen has already hit this problem and had to write some 500
lines of code to create his own EMF command stack (with an inner GEF command
stack) that can contain either EMF or GEF commands.

In order to get the benefit of EMF, he needs to have an EMF Command stack
and listener, but he has a GEF editor so he needs to pass around GEF
commands. So he hides a GEFCommandStack in and EMFCommandStack and has
wrappers for each command so they can pretend to be one or the other.

This would all go away if there was a single command interface and a single
command stack implementation.

The GEF abstract Command and the EMF Command interface are close but EMF has
getResult(), getAffectedObjects(), getDescription(), - GEF has
get/setDebugLabel()
..
Then there are 2 different CommandStacks to deal with. GEF has an abstract
implementation but EMF has an interface with a number of implementations.
EMF has getMostRecentCommand() , GEF has getCommands(), get/setUndoLimit()
Of course any method that takes or returns a Command is incompatible.

At least the CommandStackListeners are the same. But then when you create
your anonymous class, will it be the GEF or EMF interface.

I was thinking that since EMF + GEF is the IBM way to go, that this
overlapping function would not conflict.

Eric, am I explaining this right?
Re: EMF Commands vs. GEF Commands [message #76827 is a reply to message #76499] Sat, 26 April 2003 02:57 Go to previous messageGo to next message
Edmund Reinhardt is currently offline Edmund ReinhardtFriend
Messages: 16
Registered: July 2009
Junior Member
Hi Eric,

Nice job of making things work for two different worlds! Any concerns about
code plagiarism?

If I understand Randy correctly, he is saying that you do not need an EMF
command stack.
A GEF command stack would be sufficient. Is there any reason why that
wouldn't work for your report designer editor?

Thanks,

"Eric Suen" <eric_suen_cn@hotmail.com> wrote in message
news:b87dme$1r7$1@rogue.oti.com...
> Hi,
>
> I have written some wrap for EMF & GEF, Maybe it is not the best way,
> but it works. for more information, you can visite:
> http://sourceforge.net/projects/jeez
>
> I think the best way is EMF & GEF use the same command interface.
>
> Regards,
>
> Eric
>
> "Edmund Reinhardt" <reinhard@ca.ibm.com> д
Re: EMF Commands vs. GEF Commands [message #76841 is a reply to message #76827] Sat, 26 April 2003 13:43 Go to previous messageGo to next message
Eric Suen is currently offline Eric SuenFriend
Messages: 94
Registered: July 2009
Member
Hi Edmund,

>>Any concerns about code plagiarism
You can use these code freely if you wish, but I still think GEF & EMF
should
use the same command API just like WSAD.

use EMF command stack instead of GEF is because: EMF has implement some
common
command, like set, copy, cut, past, drag & drop, reparent, reorder, if I use
GEF command
stack, I should rewrite all these command myself, in my report designer
project, you
can found a lot of Action class, but very little Command class :)

Regards,

Eric

"Edmund Reinhardt" <reinhard@ca.ibm.com> д
Re: EMF Commands vs. GEF Commands [message #76858 is a reply to message #76841] Sat, 26 April 2003 15:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

This is a multi-part message in MIME format.

------=_NextPart_000_001A_01C30BE4.28A755D0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable


"Eric Suen" <eric_suen_cn@hotmail.com> wrote in message =
news:b8e2e6$nho$1@rogue.oti.com...
> Hi Edmund,
>=20
> >>Any concerns about code plagiarism
> You can use these code freely if you wish, but I still think GEF & =
EMF
> should
> use the same command API just like WSAD.
>=20
> use EMF command stack instead of GEF is because: EMF has implement =
some
> common
> command, like set, copy, cut, past, drag & drop, reparent, reorder, if =
I use
> GEF command

Are any of the reused EMF commands complicated for you to implement? =
For example, here is reorder from the Logic example. It is 20 lines of =
code:

public class ReorderPartCommand extends Command {

private int oldIndex, newIndex;
private LogicSubpart child;
private LogicDiagram parent;

public ReorderPartCommand(LogicSubpart child, LogicDiagram parent, int =
oldIndex, int newIndex ) {
super(LogicMessages.ReorderPartCommand_Label);
this.child =3D child;
this.parent =3D parent;
this.oldIndex =3D oldIndex;
this.newIndex =3D newIndex;
}

public void execute() {
parent.removeChild(child);
parent.addChild(child, newIndex);
}

public void undo() {
parent.removeChild(child);
parent.addChild(child, oldIndex);
}

I'm just asking because Edmund mentioned that your mixed-mode =
commandstack is 500+ lines of code. Are you actually getting more than =
500 lines in return? The other concern I have is that when you start =
piecing together pre-made commands, you end up putting too much logic in =
EditPolicies or somewhere else that really should just be in a "smarter" =
command.

I'm sort of familiar with the CopyCommand in EMF. This command is =
really just a factory for cloning objects. You could always use it as a =
helper to clone objects, without using it as a Command.

> stack, I should rewrite all these command myself, in my report =
designer
> project, you
> can found a lot of Action class, but very little Command class :)
>=20
> Regards,
>=20
> Eric
>=20
> "Edmund Reinhardt" <reinhard@ca.ibm.com> =
=D0=B4=C8=EB=CF=FB=CF=A2=D0=C2=CE=C5
> :b8csi6$3c1$1@rogue.oti.com...
> > Hi Eric,
> >
> > Nice job of making things work for two different worlds! Any =
concerns
> about
> > code plagiarism?
> >
> > If I understand Randy correctly, he is saying that you do not need =
an EMF
> > command stack.
> > A GEF command stack would be sufficient. Is there any reason why =
that
> > wouldn't work for your report designer editor?
> >
> > Thanks,
> >
> > "Eric Suen" <eric_suen_cn@hotmail.com> wrote in message
> > news:b87dme$1r7$1@rogue.oti.com...
> > > Hi,
> > >
> > > I have written some wrap for EMF & GEF, Maybe it is not the =
best
> way,
> > > but it works. for more information, you can visite:
> > > http://sourceforge.net/projects/jeez
> > >
> > > I think the best way is EMF & GEF use the same command interface.
> > >
> > > Regards,
> > >
> > > Eric
> > >
> > > "Edmund Reinhardt" <reinhard@ca.ibm.com> =
=D0=B4=C8=EB=CF=FB=CF=A2=D0=C2=CE=C5
> > > :b86pqn$mc6$1@rogue.oti.com...
> > > > I am designing my model in EMF so it will respond to EMF =
commands
> using
> > > the
> > > > EMF command stack for Undo/Redo.
> > > > I then want to put a GEF editor on top of that. But GEF is =
using its
> > own
> > > > commands and command stack.
> > > > What is the recommended way of gettng EMF models and GEF edit =
parts to
> > > > communicate?
> > > >
> > > > Thanks in advance
> > > >
> > > >
> > >
> > >
> > >
> >
> >
>=20
>=20

------=_NextPart_000_001A_01C30BE4.28A755D0
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>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2723.2500" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>"Eric Suen" &lt;</FONT><A=20
href=3D"mailto:eric_suen_cn@hotmail.com"><FONT face=3DArial=20
size=3D2>eric_suen_cn@hotmail.com</FONT></A><FONT face=3DArial =
size=3D2>&gt; wrote in=20
message </FONT><A href=3D"news:b8e2e6$nho$1@rogue.oti.com"><FONT =
face=3DArial=20
size=3D2>news:b8e2e6$nho$1@rogue.oti.com</FONT></A><FONT face=3DArial=20
size=3D2>...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&gt; Hi Edmund,<BR>&gt; <BR>&gt; =
&nbsp;&nbsp;&nbsp;=20
&gt;&gt;Any concerns about code plagiarism<BR>&gt; &nbsp;&nbsp;&nbsp; =
You can=20
use these code freely if you wish, but I still think GEF &amp; =
EMF<BR>&gt;=20
should<BR>&gt; use the same command API just like WSAD.<BR>&gt; <BR>&gt; =

&nbsp;&nbsp;&nbsp; use EMF command stack instead of GEF is because: EMF =
has=20
implement some<BR>&gt; common<BR>&gt; command, like set, copy, cut, =
past, drag=20
&amp; drop, reparent, reorder, if I use<BR>&gt; GEF command</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Are any of the reused EMF commands =
complicated for=20
you to implement?&nbsp; For example, here is reorder from the Logic=20
example.&nbsp; It is 20 lines of code:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>public class ReorderPartCommand extends =
Command=20
{</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>private int oldIndex, =
newIndex;<BR>private=20
LogicSubpart child;<BR>private LogicDiagram parent;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>public ReorderPartCommand(LogicSubpart =
child,=20
LogicDiagram parent, int oldIndex, int newIndex )=20
{<BR>&nbsp;super(LogicMessages.ReorderPartCommand_Label); <BR>&nbsp;this.c=
hild =3D=20
child;<BR>&nbsp;this.parent =3D parent;<BR>&nbsp;this.oldIndex =3D=20
oldIndex;<BR>&nbsp;this.newIndex =3D newIndex;<BR>}</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>public void execute()=20
{<BR>&nbsp;parent.removeChild(child);<BR>&nbsp;parent.addChild(child,=20
newIndex);<BR>}</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>public void undo()=20
{<BR>&nbsp;parent.removeChild(child);<BR>&nbsp;parent.addChild(child,=20
oldIndex);<BR>}<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I'm just asking because Edmund =
mentioned that your=20
mixed-mode commandstack is 500+ lines of code.&nbsp;Are you actually =
getting=20
more than 500 lines in return?&nbsp; The other concern I have is that =
when you=20
start piecing together pre-made commands, you end up putting too much =
logic in=20
EditPolicies or somewhere else that really should just be in&nbsp;a=20
"smarter"&nbsp;command.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I'm sort of familiar with the =
CopyCommand in=20
EMF.&nbsp; This command is really just a factory for cloning =
objects.&nbsp; You=20
could always use it as a helper to clone objects, without using it as a=20
Command.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT><FONT face=3DArial =
size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&gt; stack, I should rewrite all these =
command=20
myself, in my report designer<BR>&gt; project, you<BR>&gt; can found a =
lot of=20
Action class, but very little Command class :)<BR>&gt; <BR>&gt; =
Regards,<BR>&gt;=20
<BR>&gt; Eric<BR>&gt; <BR>&gt; "Edmund Reinhardt" &lt;</FONT><A=20
href=3D"mailto:reinhard@ca.ibm.com"><FONT face=3DArial=20
size=3D2>reinhard@ca.ibm.com</FONT></A><FONT face=3DArial size=3D2>&gt;=20
=D0=B4=C8=EB=CF=FB=CF=A2=D0=C2=CE=C5<BR>&gt; =
:b8csi6$3c1$1@rogue.oti.com...<BR>&gt; &gt; Hi=20
Eric,<BR>&gt; &gt;<BR>&gt; &gt; Nice job of making things work for two =
different=20
worlds! Any concerns<BR>&gt; about<BR>&gt; &gt; code plagiarism?<BR>&gt; =

&gt;<BR>&gt; &gt; If I understand Randy correctly, he is saying that you =
do not=20
need an EMF<BR>&gt; &gt; command stack.<BR>&gt; &gt; A GEF command stack =
would=20
be sufficient.&nbsp; Is there any reason why that<BR>&gt; &gt; wouldn't =
work for=20
your report designer editor?<BR>&gt; &gt;<BR>&gt; &gt; Thanks,<BR>&gt;=20
&gt;<BR>&gt; &gt; "Eric Suen" &lt;</FONT><A=20
href=3D"mailto:eric_suen_cn@hotmail.com"><FONT face=3DArial=20
size=3D2>eric_suen_cn@hotmail.com</FONT></A><FONT face=3DArial =
size=3D2>&gt; wrote in=20
message<BR>&gt; &gt; </FONT><A =
href=3D"news:b87dme$1r7$1@rogue.oti.com"><FONT=20
face=3DArial size=3D2>news:b87dme$1r7$1@rogue.oti.com</FONT></A><FONT =
face=3DArial=20
size=3D2>...<BR>&gt; &gt; &gt; Hi,<BR>&gt; &gt; &gt;<BR>&gt; &gt;=20
&gt;&nbsp;&nbsp;&nbsp;&nbsp; I have written some wrap for EMF &amp; GEF, =
Maybe=20
it is not the best<BR>&gt; way,<BR>&gt; &gt; &gt; but it works. for more =

information, you can visite:<BR>&gt; &gt; &gt;&nbsp; </FONT><A=20
href=3D"http://sourceforge.net/projects/jeez"><FONT face=3DArial=20
size=3D2>http://sourceforge.net/projects/jeez</FONT></A><BR><FONT =
face=3DArial=20
size=3D2>&gt; &gt; &gt;<BR>&gt; &gt; &gt; I think the best way is EMF =
&amp; GEF=20
use the same command interface.<BR>&gt; &gt; &gt;<BR>&gt; &gt; &gt;=20
Regards,<BR>&gt; &gt; &gt;<BR>&gt; &gt; &gt; Eric<BR>&gt; &gt; =
&gt;<BR>&gt; &gt;=20
&gt; "Edmund Reinhardt" &lt;</FONT><A =
href=3D"mailto:reinhard@ca.ibm.com"><FONT=20
face=3DArial size=3D2>reinhard@ca.ibm.com</FONT></A><FONT face=3DArial =
size=3D2>&gt;=20
=D0=B4=C8=EB=CF=FB=CF=A2=D0=C2=CE=C5<BR>&gt; &gt; &gt; =
:b86pqn$mc6$1@rogue.oti.com...<BR>&gt; &gt; &gt;=20
&gt; I am designing my model in EMF so it will respond to EMF =
commands<BR>&gt;=20
using<BR>&gt; &gt; &gt; the<BR>&gt; &gt; &gt; &gt; EMF command stack for =

Undo/Redo.<BR>&gt; &gt; &gt; &gt; I then want to put a GEF editor on top =
of=20
that.&nbsp; But GEF is using its<BR>&gt; &gt; own<BR>&gt; &gt; &gt; &gt; =

commands and command stack.<BR>&gt; &gt; &gt; &gt; What is the =
recommended way=20
of gettng EMF models and GEF edit parts to<BR>&gt; &gt; &gt; &gt;=20
communicate?<BR>&gt; &gt; &gt; &gt;<BR>&gt; &gt; &gt; &gt; Thanks in=20
advance<BR>&gt; &gt; &gt; &gt;<BR>&gt; &gt; &gt; &gt;<BR>&gt; &gt; =
&gt;<BR>&gt;=20
&gt; &gt;<BR>&gt; &gt; &gt;<BR>&gt; &gt;<BR>&gt; &gt;<BR>&gt; <BR>&gt;=20
</FONT></DIV></BODY></HTML>

------=_NextPart_000_001A_01C30BE4.28A755D0--
Re: EMF Commands vs. GEF Commands [message #76878 is a reply to message #76858] Sat, 26 April 2003 16:22 Go to previous messageGo to next message
Eric Suen is currently offline Eric SuenFriend
Messages: 94
Registered: July 2009
Member
This is a multi-part message in MIME format.

------=_NextPart_000_0022_01C30C53.0AF4CC60
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

In 500+ lines of codes, there are more then 200+ lines is
comments generated by eclipse, :) and the others code is just the =
simple
wrap, no complex logic!

If I use GEF command stack, then if I want the PropertySheetPage support =

undo/redo, I must use code like this or write my own PropertySheetPage:
PropertySheetPage page =3D new PropertySheetPage();
=
page.setRootEntry(GEFPlugin.createUndoablePropertySheetEntry (getCommandSt=
ack()));
am I right?

So, how can I use edit code generated by EMF? and in EMF, the property =
changed in
model, need Adapter(ItemProvider) -> AdapterFactory -> Viewer? do you =
means I should
rewrite another framework myself to handle this ? or like the code in =
logicdesigner,=20
mix the model logic with PropertySource & PropertyDescriptor?

Maybe there are many way to mix EMF & GEF & use GEF command stack, but I =
just know
my way.

BTW, use the default EMF command of cause little slow then the command =
rewrite for
specif application, because these command is very common, it will call =
lots methods
even for very simple operation like set property.

Regards,

Eric
"Randy Hudson" <none@us.ibm.com> ??????:b8e7da$qf9$1@rogue.oti.com...

"Eric Suen" <eric_suen_cn@hotmail.com> wrote in message =
news:b8e2e6$nho$1@rogue.oti.com...
> Hi Edmund,
>=20
> >>Any concerns about code plagiarism
> You can use these code freely if you wish, but I still think GEF =
& EMF
> should
> use the same command API just like WSAD.
>=20
> use EMF command stack instead of GEF is because: EMF has =
implement some
> common
> command, like set, copy, cut, past, drag & drop, reparent, reorder, =
if I use
> GEF command

Are any of the reused EMF commands complicated for you to implement? =
For example, here is reorder from the Logic example. It is 20 lines of =
code:

public class ReorderPartCommand extends Command {

private int oldIndex, newIndex;
private LogicSubpart child;
private LogicDiagram parent;

public ReorderPartCommand(LogicSubpart child, LogicDiagram parent, int =
oldIndex, int newIndex ) {
super(LogicMessages.ReorderPartCommand_Label);
this.child =3D child;
this.parent =3D parent;
this.oldIndex =3D oldIndex;
this.newIndex =3D newIndex;
}

public void execute() {
parent.removeChild(child);
parent.addChild(child, newIndex);
}

public void undo() {
parent.removeChild(child);
parent.addChild(child, oldIndex);
}

I'm just asking because Edmund mentioned that your mixed-mode =
commandstack is 500+ lines of code. Are you actually getting more than =
500 lines in return? The other concern I have is that when you start =
piecing together pre-made commands, you end up putting too much logic in =
EditPolicies or somewhere else that really should just be in a "smarter" =
command.

I'm sort of familiar with the CopyCommand in EMF. This command is =
really just a factory for cloning objects. You could always use it as a =
helper to clone objects, without using it as a Command.

> stack, I should rewrite all these command myself, in my report =
designer
> project, you
> can found a lot of Action class, but very little Command class :)
>=20
> Regards,
>=20
> Eric
>=20
> "Edmund Reinhardt" <reinhard@ca.ibm.com> =
=D0=B4=C8=EB=CF=FB=CF=A2=D0=C2=CE=C5
> :b8csi6$3c1$1@rogue.oti.com...
> > Hi Eric,
> >
> > Nice job of making things work for two different worlds! Any =
concerns
> about
> > code plagiarism?
> >
> > If I understand Randy correctly, he is saying that you do not need =
an EMF
> > command stack.
> > A GEF command stack would be sufficient. Is there any reason why =
that
> > wouldn't work for your report designer editor?
> >
> > Thanks,
> >
> > "Eric Suen" <eric_suen_cn@hotmail.com> wrote in message
> > news:b87dme$1r7$1@rogue.oti.com...
> > > Hi,
> > >
> > > I have written some wrap for EMF & GEF, Maybe it is not the =
best
> way,
> > > but it works. for more information, you can visite:
> > > http://sourceforge.net/projects/jeez
> > >
> > > I think the best way is EMF & GEF use the same command =
interface.
> > >
> > > Regards,
> > >
> > > Eric
> > >
> > > "Edmund Reinhardt" <reinhard@ca.ibm.com> =
=D0=B4=C8=EB=CF=FB=CF=A2=D0=C2=CE=C5
> > > :b86pqn$mc6$1@rogue.oti.com...
> > > > I am designing my model in EMF so it will respond to EMF =
commands
> using
> > > the
> > > > EMF command stack for Undo/Redo.
> > > > I then want to put a GEF editor on top of that. But GEF is =
using its
> > own
> > > > commands and command stack.
> > > > What is the recommended way of gettng EMF models and GEF edit =
parts to
> > > > communicate?
> > > >
> > > > Thanks in advance
> > > >
> > > >
> > >
> > >
> > >
> >
> >
>=20
>
------=_NextPart_000_0022_01C30C53.0AF4CC60
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>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1106" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3D&#23435;&#20307; size=3D2>In 500+ lines of codes, =
there are more then 200+ lines=20
is<BR>comments generated by eclipse, :)&nbsp; and the others code is =
just the=20
simple<BR>wrap, no complex logic!</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3D&#23435;&#20307; size=3D2>If I use GEF command stack, =
then if I want the=20
PropertySheetPage support <BR>undo/redo, I must use code like this or =
write my=20
own PropertySheetPage:<BR>&nbsp; PropertySheetPage page =3D new=20
PropertySheetPage();<BR>&nbsp;=20
page.setRootEntry(GEFPlugin.createUndoablePropertySheetEntry (getCommandSt=
ack()));<BR>am=20
I right?</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3D&#23435;&#20307; size=3D2>So, how can I use edit code =
generated by EMF? and in=20
EMF, the property changed in<BR>model, need Adapter(ItemProvider) -&gt;=20
AdapterFactory -&gt; Viewer? do you means I should<BR>rewrite another =
framework=20
myself to handle this ? or like the code in logicdesigner, <BR>mix the =
model=20
logic with PropertySource &amp; PropertyDescriptor?</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3D&#23435;&#20307; size=3D2>Maybe there are many way to =
mix EMF &amp; GEF &amp;=20
use GEF command stack, but I just know<BR>my way.</FONT></DIV>
<DIV><FONT face=3D&#23435;&#20307; size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D&#23435;&#20307; size=3D2>BTW, use the default EMF =
command of cause little slow=20
then the command rewrite for<BR>specif application, because these =
command is=20
very common, it will call lots methods<BR>even for very simple operation =
like=20
set property.</FONT></DIV>
<DIV><FONT face=3D&#23435;&#20307; size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D&#23435;&#20307; size=3D2>Regards,</FONT></DIV>
<DIV><FONT face=3D&#23435;&#20307; size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D&#23435;&#20307; size=3D2>Eric</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Randy Hudson" &lt;<A=20
href=3D"mailto:none@us.ibm.com">none@us.ibm.com</A>&gt;=20
=
&#20889;&#20837;&#28040;&#24687;&#26032; &#38395;:b8e7da$qf9$1@rogue.oti.c=
om...</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>"Eric Suen" &lt;</FONT><A=20
href=3D"mailto:eric_suen_cn@hotmail.com"><FONT face=3DArial=20
size=3D2>eric_suen_cn@hotmail.com</FONT></A><FONT face=3DArial =
size=3D2>&gt; wrote=20
in message </FONT><A href=3D"news:b8e2e6$nho$1@rogue.oti.com"><FONT =
face=3DArial=20
size=3D2>news:b8e2e6$nho$1@rogue.oti.com</FONT></A><FONT face=3DArial=20
size=3D2>...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&gt; Hi Edmund,<BR>&gt; <BR>&gt;=20
&nbsp;&nbsp;&nbsp; &gt;&gt;Any concerns about code plagiarism<BR>&gt;=20
&nbsp;&nbsp;&nbsp; You can use these code freely if you wish, but I =
still=20
think GEF &amp; EMF<BR>&gt; should<BR>&gt; use the same command API =
just like=20
WSAD.<BR>&gt; <BR>&gt; &nbsp;&nbsp;&nbsp; use EMF command stack =
instead of GEF=20
is because: EMF has implement some<BR>&gt; common<BR>&gt; command, =
like set,=20
copy, cut, past, drag &amp; drop, reparent, reorder, if I use<BR>&gt; =
GEF=20
command</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Are any of the reused EMF commands =
complicated=20
for you to implement?&nbsp; For example, here is reorder from the =
Logic=20
example.&nbsp; It is 20 lines of code:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>public class ReorderPartCommand =
extends Command=20
{</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>private int oldIndex, =
newIndex;<BR>private=20
LogicSubpart child;<BR>private LogicDiagram parent;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>public =
ReorderPartCommand(LogicSubpart child,=20
LogicDiagram parent, int oldIndex, int newIndex )=20
=
{<BR>&nbsp;super(LogicMessages.ReorderPartCommand_Label); <BR>&nbsp;this.c=
hild=20
=3D child;<BR>&nbsp;this.parent =3D parent;<BR>&nbsp;this.oldIndex =3D =

oldIndex;<BR>&nbsp;this.newIndex =3D newIndex;<BR>}</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>public void execute()=20
{<BR>&nbsp;parent.removeChild(child);<BR>&nbsp;parent.addChild(child,=20
newIndex);<BR>}</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>public void undo()=20
{<BR>&nbsp;parent.removeChild(child);<BR>&nbsp;parent.addChild(child,=20
oldIndex);<BR>}<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I'm just asking because Edmund =
mentioned that=20
your mixed-mode commandstack is 500+ lines of code.&nbsp;Are you =
actually=20
getting more than 500 lines in return?&nbsp; The other concern I have =
is that=20
when you start piecing together pre-made commands, you end up putting =
too much=20
logic in EditPolicies or somewhere else that really should just be =
in&nbsp;a=20
"smarter"&nbsp;command.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I'm sort of familiar with the =
CopyCommand in=20
EMF.&nbsp; This command is really just a factory for cloning =
objects.&nbsp;=20
You could always use it as a helper to clone objects, without using it =
as a=20
Command.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT><FONT face=3DArial=20
size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&gt; stack, I should rewrite all =
these command=20
myself, in my report designer<BR>&gt; project, you<BR>&gt; can found a =
lot of=20
Action class, but very little Command class :)<BR>&gt; <BR>&gt;=20
Regards,<BR>&gt; <BR>&gt; Eric<BR>&gt; <BR>&gt; "Edmund Reinhardt"=20
&lt;</FONT><A href=3D"mailto:reinhard@ca.ibm.com"><FONT face=3DArial=20
size=3D2>reinhard@ca.ibm.com</FONT></A><FONT face=3DArial =
size=3D2>&gt;=20
=D0=B4=C8=EB=CF=FB=CF=A2=D0=C2=CE=C5<BR>&gt; =
:b8csi6$3c1$1@rogue.oti.com...<BR>&gt; &gt; Hi=20
Eric,<BR>&gt; &gt;<BR>&gt; &gt; Nice job of making things work for two =

different worlds! Any concerns<BR>&gt; about<BR>&gt; &gt; code=20
plagiarism?<BR>&gt; &gt;<BR>&gt; &gt; If I understand Randy correctly, =
he is=20
saying that you do not need an EMF<BR>&gt; &gt; command stack.<BR>&gt; =
&gt; A=20
GEF command stack would be sufficient.&nbsp; Is there any reason why=20
that<BR>&gt; &gt; wouldn't work for your report designer =
editor?<BR>&gt;=20
&gt;<BR>&gt; &gt; Thanks,<BR>&gt; &gt;<BR>&gt; &gt; "Eric Suen" =
&lt;</FONT><A=20
href=3D"mailto:eric_suen_cn@hotmail.com"><FONT face=3DArial=20
size=3D2>eric_suen_cn@hotmail.com</FONT></A><FONT face=3DArial =
size=3D2>&gt; wrote=20
in message<BR>&gt; &gt; </FONT><A =
href=3D"news:b87dme$1r7$1@rogue.oti.com"><FONT=20
face=3DArial size=3D2>news:b87dme$1r7$1@rogue.oti.com</FONT></A><FONT =
face=3DArial=20
size=3D2>...<BR>&gt; &gt; &gt; Hi,<BR>&gt; &gt; &gt;<BR>&gt; &gt;=20
&gt;&nbsp;&nbsp;&nbsp;&nbsp; I have written some wrap for EMF &amp; =
GEF, Maybe=20
it is not the best<BR>&gt; way,<BR>&gt; &gt; &gt; but it works. for =
more=20
information, you can visite:<BR>&gt; &gt; &gt;&nbsp; </FONT><A=20
href=3D"http://sourceforge.net/projects/jeez"><FONT face=3DArial=20
size=3D2>http://sourceforge.net/projects/jeez</FONT></A><BR><FONT =
face=3DArial=20
size=3D2>&gt; &gt; &gt;<BR>&gt; &gt; &gt; I think the best way is EMF =
&amp; GEF=20
use the same command interface.<BR>&gt; &gt; &gt;<BR>&gt; &gt; &gt;=20
Regards,<BR>&gt; &gt; &gt;<BR>&gt; &gt; &gt; Eric<BR>&gt; &gt; =
&gt;<BR>&gt;=20
&gt; &gt; "Edmund Reinhardt" &lt;</FONT><A=20
href=3D"mailto:reinhard@ca.ibm.com"><FONT face=3DArial=20
size=3D2>reinhard@ca.ibm.com</FONT></A><FONT face=3DArial =
size=3D2>&gt;=20
=D0=B4=C8=EB=CF=FB=CF=A2=D0=C2=CE=C5<BR>&gt; &gt; &gt; =
:b86pqn$mc6$1@rogue.oti.com...<BR>&gt; &gt;=20
&gt; &gt; I am designing my model in EMF so it will respond to EMF=20
commands<BR>&gt; using<BR>&gt; &gt; &gt; the<BR>&gt; &gt; &gt; &gt; =
EMF=20
command stack for Undo/Redo.<BR>&gt; &gt; &gt; &gt; I then want to put =
a GEF=20
editor on top of that.&nbsp; But GEF is using its<BR>&gt; &gt; =
own<BR>&gt;=20
&gt; &gt; &gt; commands and command stack.<BR>&gt; &gt; &gt; &gt; What =
is the=20
recommended way of gettng EMF models and GEF edit parts to<BR>&gt; =
&gt; &gt;=20
&gt; communicate?<BR>&gt; &gt; &gt; &gt;<BR>&gt; &gt; &gt; &gt; Thanks =
in=20
advance<BR>&gt; &gt; &gt; &gt;<BR>&gt; &gt; &gt; &gt;<BR>&gt; &gt;=20
&gt;<BR>&gt; &gt; &gt;<BR>&gt; &gt; &gt;<BR>&gt; &gt;<BR>&gt; =
&gt;<BR>&gt;=20
<BR>&gt; </FONT></DIV></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_0022_01C30C53.0AF4CC60--
Re: EMF Commands vs. GEF Commands [message #76892 is a reply to message #76858] Sat, 26 April 2003 16:32 Go to previous messageGo to next message
Eric Suen is currently offline Eric SuenFriend
Messages: 94
Registered: July 2009
Member
This is a multi-part message in MIME format.

------=_NextPart_000_000D_01C30C54.85D1EF20
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

And as I understand, Edmund mentioned 500+ lines of code is just to tell
the importance that EMF & GEF should use the same command API, because
they are all the subproject of Eclipse.

Regards,

Eric
------=_NextPart_000_000D_01C30C54.85D1EF20
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>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1106" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3D&#23435;&#20307; size=3D2>And as I understand, Edmund =
mentioned 500+ lines of=20
code is just to tell<BR>the importance that EMF &amp; GEF should use the =
same=20
command API, because<BR>they are all the subproject of =
Eclipse.</FONT></DIV>
<DIV><FONT face=3D&#23435;&#20307; size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D&#23435;&#20307; size=3D2>Regards,</FONT></DIV>
<DIV><FONT face=3D&#23435;&#20307; size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D&#23435;&#20307; =
size=3D2>Eric</FONT></DIV></BODY></HTML>

------=_NextPart_000_000D_01C30C54.85D1EF20--
Re: EMF Commands vs. GEF Commands [message #76912 is a reply to message #76878] Sat, 26 April 2003 17:57 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

This is a multi-part message in MIME format.

------=_NextPart_000_008A_01C30BFB.C89BDAE0
Content-Type: text/plain;
charset="utf-8"
Content-Transfer-Encoding: quoted-printable

Last time I checked, EMF Edit does not do PropertySource correctly. The =
commands must be generated externally, otherwise Undo is not atomic. To =
see this, select 2 or more items in an EMF edit application and change =
the property, then undo.
"Eric Suen" <eric_suen_cn@hotmail.com> wrote in message =
news:b8ebni$srl$1@rogue.oti.com...
In 500+ lines of codes, there are more then 200+ lines is
comments generated by eclipse, :) and the others code is just the =
simple
wrap, no complex logic!

If I use GEF command stack, then if I want the PropertySheetPage =
support=20
undo/redo, I must use code like this or write my own =
PropertySheetPage:
PropertySheetPage page =3D new PropertySheetPage();
=
page.setRootEntry(GEFPlugin.createUndoablePropertySheetEntry (getCommandSt=
ack()));
am I right?

So, how can I use edit code generated by EMF? and in EMF, the property =
changed in
model, need Adapter(ItemProvider) -> AdapterFactory -> Viewer? do you =
means I should
rewrite another framework myself to handle this ? or like the code in =
logicdesigner,=20
mix the model logic with PropertySource & PropertyDescriptor?

Maybe there are many way to mix EMF & GEF & use GEF command stack, but =
I just know
my way.

BTW, use the default EMF command of cause little slow then the command =
rewrite for
specif application, because these command is very common, it will call =
lots methods
even for very simple operation like set property.

Regards,

Eric
"Randy Hudson" <none@us.ibm.com> =
=E5=86=99=E5=85=A5=E6=B6=88=E6=81=AF=E6=96=B0=E9=97=BB:b8e7d a$qf9$1@rogue=
..oti.com...

"Eric Suen" <eric_suen_cn@hotmail.com> wrote in message =
news:b8e2e6$nho$1@rogue.oti.com...
> Hi Edmund,
>=20
> >>Any concerns about code plagiarism
> You can use these code freely if you wish, but I still think =
GEF & EMF
> should
> use the same command API just like WSAD.
>=20
> use EMF command stack instead of GEF is because: EMF has =
implement some
> common
> command, like set, copy, cut, past, drag & drop, reparent, =
reorder, if I use
> GEF command

Are any of the reused EMF commands complicated for you to implement? =
For example, here is reorder from the Logic example. It is 20 lines of =
code:

public class ReorderPartCommand extends Command {

private int oldIndex, newIndex;
private LogicSubpart child;
private LogicDiagram parent;

public ReorderPartCommand(LogicSubpart child, LogicDiagram parent, =
int oldIndex, int newIndex ) {
super(LogicMessages.ReorderPartCommand_Label);
this.child =3D child;
this.parent =3D parent;
this.oldIndex =3D oldIndex;
this.newIndex =3D newIndex;
}

public void execute() {
parent.removeChild(child);
parent.addChild(child, newIndex);
}

public void undo() {
parent.removeChild(child);
parent.addChild(child, oldIndex);
}

I'm just asking because Edmund mentioned that your mixed-mode =
commandstack is 500+ lines of code. Are you actually getting more than =
500 lines in return? The other concern I have is that when you start =
piecing together pre-made commands, you end up putting too much logic in =
EditPolicies or somewhere else that really should just be in a "smarter" =
command.

I'm sort of familiar with the CopyCommand in EMF. This command is =
really just a factory for cloning objects. You could always use it as a =
helper to clone objects, without using it as a Command.

> stack, I should rewrite all these command myself, in my report =
designer
> project, you
> can found a lot of Action class, but very little Command class :)
>=20
> Regards,
>=20
> Eric
>=20
> "Edmund Reinhardt" <reinhard@ca.ibm.com> =
=C3=90=C2=B4=C3=88=C3=AB=C3=8F=C3=BB=C3=8F=C2=A2=C3=90=C3=82 =C3=8E=C3=85
> :b8csi6$3c1$1@rogue.oti.com...
> > Hi Eric,
> >
> > Nice job of making things work for two different worlds! Any =
concerns
> about
> > code plagiarism?
> >
> > If I understand Randy correctly, he is saying that you do not =
need an EMF
> > command stack.
> > A GEF command stack would be sufficient. Is there any reason =
why that
> > wouldn't work for your report designer editor?
> >
> > Thanks,
> >
> > "Eric Suen" <eric_suen_cn@hotmail.com> wrote in message
> > news:b87dme$1r7$1@rogue.oti.com...
> > > Hi,
> > >
> > > I have written some wrap for EMF & GEF, Maybe it is not =
the best
> way,
> > > but it works. for more information, you can visite:
> > > http://sourceforge.net/projects/jeez
> > >
> > > I think the best way is EMF & GEF use the same command =
interface.
> > >
> > > Regards,
> > >
> > > Eric
> > >
> > > "Edmund Reinhardt" <reinhard@ca.ibm.com> =
=C3=90=C2=B4=C3=88=C3=AB=C3=8F=C3=BB=C3=8F=C2=A2=C3=90=C3=82 =C3=8E=C3=85
> > > :b86pqn$mc6$1@rogue.oti.com...
> > > > I am designing my model in EMF so it will respond to EMF =
commands
> using
> > > the
> > > > EMF command stack for Undo/Redo.
> > > > I then want to put a GEF editor on top of that. But GEF is =
using its
> > own
> > > > commands and command stack.
> > > > What is the recommended way of gettng EMF models and GEF =
edit parts to
> > > > communicate?
> > > >
> > > > Thanks in advance
> > > >
> > > >
> > >
> > >
> > >
> >
> >
>=20
>=20

------=_NextPart_000_008A_01C30BFB.C89BDAE0
Content-Type: text/html;
charset="utf-8"
Content-Transfer-Encoding: quoted-printable

=EF=BB=BF<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Dutf-8">
<META content=3D"MSHTML 6.00.2723.2500" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Last time I checked, EMF Edit does not =
do=20
PropertySource correctly.&nbsp; The commands must be generated =
externally,=20
otherwise Undo is not atomic.&nbsp; To see this, select 2 or more items =
in an=20
EMF edit application and change the property, then undo.</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Eric Suen" &lt;<A=20
=
href=3D"mailto:eric_suen_cn@hotmail.com">eric_suen_cn@hotmail.com</A>&gt;=
wrote=20
in message <A=20
=
href=3D"news:b8ebni$srl$1@rogue.oti.com">news:b8ebni$srl$1@rogue.oti.com<=
/A>...</DIV>
<DIV><FONT face=3D=E5=AE=8B=E4=BD=93 size=3D2>In 500+ lines of codes, =
there are more then 200+=20
lines is<BR>comments generated by eclipse, :)&nbsp; and the others =
code is=20
just the simple<BR>wrap, no complex logic!</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3D=E5=AE=8B=E4=BD=93 size=3D2>If I use GEF command =
stack, then if I want the=20
PropertySheetPage support <BR>undo/redo, I must use code like this or =
write my=20
own PropertySheetPage:<BR>&nbsp; PropertySheetPage page =3D new=20
PropertySheetPage();<BR>&nbsp;=20
=
page.setRootEntry(GEFPlugin.createUndoablePropertySheetEntry (getCommandSt=
ack()));<BR>am=20
I right?</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3D=E5=AE=8B=E4=BD=93 size=3D2>So, how can I use edit =
code generated by EMF? and in=20
EMF, the property changed in<BR>model, need Adapter(ItemProvider) =
-&gt;=20
AdapterFactory -&gt; Viewer? do you means I should<BR>rewrite another=20
framework myself to handle this ? or like the code in logicdesigner, =
<BR>mix=20
the model logic with PropertySource &amp; =
PropertyDescriptor?</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3D=E5=AE=8B=E4=BD=93 size=3D2>Maybe there are many way =
to mix EMF &amp; GEF &amp;=20
use GEF command stack, but I just know<BR>my way.</FONT></DIV>
<DIV><FONT face=3D=E5=AE=8B=E4=BD=93 size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D=E5=AE=8B=E4=BD=93 size=3D2>BTW, use the default EMF =
command of cause little=20
slow then the command rewrite for<BR>specif application, because these =
command=20
is very common, it will call lots methods<BR>even for very simple =
operation=20
like set property.</FONT></DIV>
<DIV><FONT face=3D=E5=AE=8B=E4=BD=93 size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D=E5=AE=8B=E4=BD=93 size=3D2>Regards,</FONT></DIV>
<DIV><FONT face=3D=E5=AE=8B=E4=BD=93 size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D=E5=AE=8B=E4=BD=93 size=3D2>Eric</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Randy Hudson" &lt;<A=20
href=3D"mailto:none@us.ibm.com">none@us.ibm.com</A>&gt;=20
=
=E5=86=99=E5=85=A5=E6=B6=88=E6=81=AF=E6=96=B0=E9=97=BB:b8e7d a$qf9$1@rogue=
..oti.com...</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>"Eric Suen" &lt;</FONT><A=20
href=3D"mailto:eric_suen_cn@hotmail.com"><FONT face=3DArial=20
size=3D2>eric_suen_cn@hotmail.com</FONT></A><FONT face=3DArial =
size=3D2>&gt; wrote=20
in message </FONT><A href=3D"news:b8e2e6$nho$1@rogue.oti.com"><FONT =
face=3DArial=20
size=3D2>news:b8e2e6$nho$1@rogue.oti.com</FONT></A><FONT =
face=3DArial=20
size=3D2>...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&gt; Hi Edmund,<BR>&gt; <BR>&gt;=20
&nbsp;&nbsp;&nbsp; &gt;&gt;Any concerns about code =
plagiarism<BR>&gt;=20
&nbsp;&nbsp;&nbsp; You can use these code freely if you wish, but I =
still=20
think GEF &amp; EMF<BR>&gt; should<BR>&gt; use the same command API =
just=20
like WSAD.<BR>&gt; <BR>&gt; &nbsp;&nbsp;&nbsp; use EMF command stack =
instead=20
of GEF is because: EMF has implement some<BR>&gt; common<BR>&gt; =
command,=20
like set, copy, cut, past, drag &amp; drop, reparent, reorder, if I=20
use<BR>&gt; GEF command</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Are any of the reused EMF commands =
complicated=20
for you to implement?&nbsp; For example, here is reorder from the =
Logic=20
example.&nbsp; It is 20 lines of code:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>public class ReorderPartCommand =
extends Command=20
{</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>private int oldIndex, =
newIndex;<BR>private=20
LogicSubpart child;<BR>private LogicDiagram parent;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>public =
ReorderPartCommand(LogicSubpart child,=20
LogicDiagram parent, int oldIndex, int newIndex )=20
=
{<BR>&nbsp;super(LogicMessages.ReorderPartCommand_Label); <BR>&nbsp;this.c=
hild=20
=3D child;<BR>&nbsp;this.parent =3D parent;<BR>&nbsp;this.oldIndex =
=3D=20
oldIndex;<BR>&nbsp;this.newIndex =3D newIndex;<BR>}</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>public void execute()=20
=
{<BR>&nbsp;parent.removeChild(child);<BR>&nbsp;parent.addChild(child,=20
newIndex);<BR>}</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>public void undo()=20
=
{<BR>&nbsp;parent.removeChild(child);<BR>&nbsp;parent.addChild(child,=20
oldIndex);<BR>}<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I'm just asking because Edmund =
mentioned that=20
your mixed-mode commandstack is 500+ lines of code.&nbsp;Are you =
actually=20
getting more than 500 lines in return?&nbsp; The other concern I =
have is=20
that when you start piecing together pre-made commands, you end up =
putting=20
too much logic in EditPolicies or somewhere else that really should =
just be=20
in&nbsp;a "smarter"&nbsp;command.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I'm sort of familiar with the =
CopyCommand in=20
EMF.&nbsp; This command is really just a factory for cloning =
objects.&nbsp;=20
You could always use it as a helper to clone objects, without using =
it as a=20
Command.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT><FONT face=3DArial=20
size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&gt; stack, I should rewrite all =
these command=20
myself, in my report designer<BR>&gt; project, you<BR>&gt; can found =
a lot=20
of Action class, but very little Command class :)<BR>&gt; <BR>&gt;=20
Regards,<BR>&gt; <BR>&gt; Eric<BR>&gt; <BR>&gt; "Edmund Reinhardt"=20
&lt;</FONT><A href=3D"mailto:reinhard@ca.ibm.com"><FONT face=3DArial =

size=3D2>reinhard@ca.ibm.com</FONT></A><FONT face=3DArial =
size=3D2>&gt;=20
=
=C3=90=C2=B4=C3=88=C3=AB=C3=8F=C3=BB=C3=8F=C2=A2=C3=90=C3=82 =C3=8E=C3=85 <=
BR>&gt; :b8csi6$3c1$1@rogue.oti.com...<BR>&gt; &gt; Hi=20
Eric,<BR>&gt; &gt;<BR>&gt; &gt; Nice job of making things work for =
two=20
different worlds! Any concerns<BR>&gt; about<BR>&gt; &gt; code=20
plagiarism?<BR>&gt; &gt;<BR>&gt; &gt; If I understand Randy =
correctly, he is=20
saying that you do not need an EMF<BR>&gt; &gt; command =
stack.<BR>&gt; &gt;=20
A GEF command stack would be sufficient.&nbsp; Is there any reason =
why=20
that<BR>&gt; &gt; wouldn't work for your report designer =
editor?<BR>&gt;=20
&gt;<BR>&gt; &gt; Thanks,<BR>&gt; &gt;<BR>&gt; &gt; "Eric Suen"=20
&lt;</FONT><A href=3D"mailto:eric_suen_cn@hotmail.com"><FONT =
face=3DArial=20
size=3D2>eric_suen_cn@hotmail.com</FONT></A><FONT face=3DArial =
size=3D2>&gt; wrote=20
in message<BR>&gt; &gt; </FONT><A=20
href=3D"news:b87dme$1r7$1@rogue.oti.com"><FONT face=3DArial=20
size=3D2>news:b87dme$1r7$1@rogue.oti.com</FONT></A><FONT =
face=3DArial=20
size=3D2>...<BR>&gt; &gt; &gt; Hi,<BR>&gt; &gt; &gt;<BR>&gt; &gt;=20
&gt;&nbsp;&nbsp;&nbsp;&nbsp; I have written some wrap for EMF &amp; =
GEF,=20
Maybe it is not the best<BR>&gt; way,<BR>&gt; &gt; &gt; but it =
works. for=20
more information, you can visite:<BR>&gt; &gt; &gt;&nbsp; </FONT><A=20
href=3D"http://sourceforge.net/projects/jeez"><FONT face=3DArial=20
size=3D2>http://sourceforge.net/projects/jeez</FONT></A><BR><FONT =
face=3DArial=20
size=3D2>&gt; &gt; &gt;<BR>&gt; &gt; &gt; I think the best way is =
EMF &amp;=20
GEF use the same command interface.<BR>&gt; &gt; &gt;<BR>&gt; &gt; =
&gt;=20
Regards,<BR>&gt; &gt; &gt;<BR>&gt; &gt; &gt; Eric<BR>&gt; &gt; =
&gt;<BR>&gt;=20
&gt; &gt; "Edmund Reinhardt" &lt;</FONT><A=20
href=3D"mailto:reinhard@ca.ibm.com"><FONT face=3DArial=20
size=3D2>reinhard@ca.ibm.com</FONT></A><FONT face=3DArial =
size=3D2>&gt;=20
=
=C3=90=C2=B4=C3=88=C3=AB=C3=8F=C3=BB=C3=8F=C2=A2=C3=90=C3=82 =C3=8E=C3=85 <=
BR>&gt; &gt; &gt; :b86pqn$mc6$1@rogue.oti.com...<BR>&gt; &gt;=20
&gt; &gt; I am designing my model in EMF so it will respond to EMF=20
commands<BR>&gt; using<BR>&gt; &gt; &gt; the<BR>&gt; &gt; &gt; &gt; =
EMF=20
command stack for Undo/Redo.<BR>&gt; &gt; &gt; &gt; I then want to =
put a GEF=20
editor on top of that.&nbsp; But GEF is using its<BR>&gt; &gt; =
own<BR>&gt;=20
&gt; &gt; &gt; commands and command stack.<BR>&gt; &gt; &gt; &gt; =
What is=20
the recommended way of gettng EMF models and GEF edit parts =
to<BR>&gt; &gt;=20
&gt; &gt; communicate?<BR>&gt; &gt; &gt; &gt;<BR>&gt; &gt; &gt; &gt; =
Thanks=20
in advance<BR>&gt; &gt; &gt; &gt;<BR>&gt; &gt; &gt; &gt;<BR>&gt; =
&gt;=20
&gt;<BR>&gt; &gt; &gt;<BR>&gt; &gt; &gt;<BR>&gt; &gt;<BR>&gt; =
&gt;<BR>&gt;=20
<BR>&gt; </FONT></DIV></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_008A_01C30BFB.C89BDAE0--
Re: EMF Commands vs. GEF Commands [message #76985 is a reply to message #76912] Sun, 27 April 2003 13:46 Go to previous messageGo to next message
Eric Suen is currently offline Eric SuenFriend
Messages: 94
Registered: July 2009
Member
This is a multi-part message in MIME format.

------=_NextPart_000_0058_01C30D06.71D70E30
Content-Type: text/plain;
charset="utf-8"
Content-Transfer-Encoding: quoted-printable

Yes, EMF Edit has some bugs, if you select 2 or more items, and click =
property in
propertysheetpage, even you no change the value, the command stack is =
changed, but
you know, all software has bugs, default if you select more than one =
item, EMF Edit
does not show property because their implementation of isCompatibleWith =
is just simply
return false.
"Randy Hudson" <none@us.ibm.com> =
=E5=86=99=E5=85=A5=E6=B6=88=E6=81=AF=E6=96=B0=E9=97=BB:b8eha d$vrc$1@rogue=
..oti.com...
Last time I checked, EMF Edit does not do PropertySource correctly. =
The commands must be generated externally, otherwise Undo is not atomic. =
To see this, select 2 or more items in an EMF edit application and =
change the property, then undo.
"Eric Suen" <eric_suen_cn@hotmail.com> wrote in message =
news:b8ebni$srl$1@rogue.oti.com...
In 500+ lines of codes, there are more then 200+ lines is
comments generated by eclipse, :) and the others code is just the =
simple
wrap, no complex logic!

If I use GEF command stack, then if I want the PropertySheetPage =
support=20
undo/redo, I must use code like this or write my own =
PropertySheetPage:
PropertySheetPage page =3D new PropertySheetPage();
=
page.setRootEntry(GEFPlugin.createUndoablePropertySheetEntry (getCommandSt=
ack()));
am I right?

So, how can I use edit code generated by EMF? and in EMF, the =
property changed in
model, need Adapter(ItemProvider) -> AdapterFactory -> Viewer? do =
you means I should
rewrite another framework myself to handle this ? or like the code =
in logicdesigner,=20
mix the model logic with PropertySource & PropertyDescriptor?

Maybe there are many way to mix EMF & GEF & use GEF command stack, =
but I just know
my way.

BTW, use the default EMF command of cause little slow then the =
command rewrite for
specif application, because these command is very common, it will =
call lots methods
even for very simple operation like set property.

Regards,

Eric
"Randy Hudson" <none@us.ibm.com> =
=E5=86=99=E5=85=A5=E6=B6=88=E6=81=AF=E6=96=B0=E9=97=BB:b8e7d a$qf9$1@rogue=
..oti.com...

"Eric Suen" <eric_suen_cn@hotmail.com> wrote in message =
news:b8e2e6$nho$1@rogue.oti.com...
> Hi Edmund,
>=20
> >>Any concerns about code plagiarism
> You can use these code freely if you wish, but I still think =
GEF & EMF
> should
> use the same command API just like WSAD.
>=20
> use EMF command stack instead of GEF is because: EMF has =
implement some
> common
> command, like set, copy, cut, past, drag & drop, reparent, =
reorder, if I use
> GEF command

Are any of the reused EMF commands complicated for you to =
implement? For example, here is reorder from the Logic example. It is =
20 lines of code:

public class ReorderPartCommand extends Command {

private int oldIndex, newIndex;
private LogicSubpart child;
private LogicDiagram parent;

public ReorderPartCommand(LogicSubpart child, LogicDiagram parent, =
int oldIndex, int newIndex ) {
super(LogicMessages.ReorderPartCommand_Label);
this.child =3D child;
this.parent =3D parent;
this.oldIndex =3D oldIndex;
this.newIndex =3D newIndex;
}

public void execute() {
parent.removeChild(child);
parent.addChild(child, newIndex);
}

public void undo() {
parent.removeChild(child);
parent.addChild(child, oldIndex);
}

I'm just asking because Edmund mentioned that your mixed-mode =
commandstack is 500+ lines of code. Are you actually getting more than =
500 lines in return? The other concern I have is that when you start =
piecing together pre-made commands, you end up putting too much logic in =
EditPolicies or somewhere else that really should just be in a "smarter" =
command.

I'm sort of familiar with the CopyCommand in EMF. This command is =
really just a factory for cloning objects. You could always use it as a =
helper to clone objects, without using it as a Command.

> stack, I should rewrite all these command myself, in my report =
designer
> project, you
> can found a lot of Action class, but very little Command class =
:)
>=20
> Regards,
>=20
> Eric
>=20
> "Edmund Reinhardt" <reinhard@ca.ibm.com> =
=C3=90=C2=B4=C3=88=C3=AB=C3=8F=C3=BB=C3=8F=C2=A2=C3=90=C3=82 =C3=8E=C3=85
> :b8csi6$3c1$1@rogue.oti.com...
> > Hi Eric,
> >
> > Nice job of making things work for two different worlds! Any =
concerns
> about
> > code plagiarism?
> >
> > If I understand Randy correctly, he is saying that you do not =
need an EMF
> > command stack.
> > A GEF command stack would be sufficient. Is there any reason =
why that
> > wouldn't work for your report designer editor?
> >
> > Thanks,
> >
> > "Eric Suen" <eric_suen_cn@hotmail.com> wrote in message
> > news:b87dme$1r7$1@rogue.oti.com...
> > > Hi,
> > >
> > > I have written some wrap for EMF & GEF, Maybe it is not =
the best
> way,
> > > but it works. for more information, you can visite:
> > > http://sourceforge.net/projects/jeez
> > >
> > > I think the best way is EMF & GEF use the same command =
interface.
> > >
> > > Regards,
> > >
> > > Eric
> > >
> > > "Edmund Reinhardt" <reinhard@ca.ibm.com> =
=C3=90=C2=B4=C3=88=C3=AB=C3=8F=C3=BB=C3=8F=C2=A2=C3=90=C3=82 =C3=8E=C3=85
> > > :b86pqn$mc6$1@rogue.oti.com...
> > > > I am designing my model in EMF so it will respond to EMF =
commands
> using
> > > the
> > > > EMF command stack for Undo/Redo.
> > > > I then want to put a GEF editor on top of that. But GEF =
is using its
> > own
> > > > commands and command stack.
> > > > What is the recommended way of gettng EMF models and GEF =
edit parts to
> > > > communicate?
> > > >
> > > > Thanks in advance
> > > >
> > > >
> > >
> > >
> > >
> >
> >
>=20
>
------=_NextPart_000_0058_01C30D06.71D70E30
Content-Type: text/html;
charset="utf-8"
Content-Transfer-Encoding: quoted-printable

=EF=BB=BF<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Dutf-8">
<META content=3D"MSHTML 6.00.2800.1106" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3D=E5=AE=8B=E4=BD=93 size=3D2>Yes, EMF Edit has some =
bugs, if you select 2 or more=20
items, and click property in</FONT></DIV>
<DIV><FONT face=3D=E5=AE=8B=E4=BD=93 size=3D2>propertysheetpage, even =
you no change the value, the=20
command stack is changed, but</FONT></DIV>
<DIV><FONT face=3D=E5=AE=8B=E4=BD=93 size=3D2>you know, all software has =
bugs, default if you select=20
more than one item, EMF Edit</FONT></DIV>
<DIV><FONT face=3D=E5=AE=8B=E4=BD=93 size=3D2>does not show property =
because their implementation of=20
isCompatibleWith is just simply</FONT></DIV>
<DIV><FONT face=3D=E5=AE=8B=E4=BD=93 size=3D2>return false.</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Randy Hudson" &lt;<A=20
href=3D"mailto:none@us.ibm.com">none@us.ibm.com</A>&gt;=20
=
=E5=86=99=E5=85=A5=E6=B6=88=E6=81=AF=E6=96=B0=E9=97=BB:b8eha d$vrc$1@rogue=
..oti.com...</DIV>
<DIV><FONT face=3DArial size=3D2>Last time I checked, EMF Edit does =
not do=20
PropertySource correctly.&nbsp; The commands must be generated =
externally,=20
otherwise Undo is not atomic.&nbsp; To see this, select 2 or more =
items in an=20
EMF edit application and change the property, then undo.</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Eric Suen" &lt;<A=20
=
href=3D"mailto:eric_suen_cn@hotmail.com">eric_suen_cn@hotmail.com</A>&gt;=
=20
wrote in message <A=20
=
href=3D"news:b8ebni$srl$1@rogue.oti.com">news:b8ebni$srl$1@rogue.oti.com<=
/A>...</DIV>
<DIV><FONT face=3D=E5=AE=8B=E4=BD=93 size=3D2>In 500+ lines of =
codes, there are more then 200+=20
lines is<BR>comments generated by eclipse, :)&nbsp; and the others =
code is=20
just the simple<BR>wrap, no complex logic!</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3D=E5=AE=8B=E4=BD=93 size=3D2>If I use GEF command =
stack, then if I want the=20
PropertySheetPage support <BR>undo/redo, I must use code like this =
or write=20
my own PropertySheetPage:<BR>&nbsp; PropertySheetPage page =3D new=20
PropertySheetPage();<BR>&nbsp;=20
=
page.setRootEntry(GEFPlugin.createUndoablePropertySheetEntry (getCommandSt=
ack()));<BR>am=20
I right?</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3D=E5=AE=8B=E4=BD=93 size=3D2>So, how can I use edit =
code generated by EMF? and=20
in EMF, the property changed in<BR>model, need Adapter(ItemProvider) =
-&gt;=20
AdapterFactory -&gt; Viewer? do you means I should<BR>rewrite =
another=20
framework myself to handle this ? or like the code in logicdesigner, =
<BR>mix=20
the model logic with PropertySource &amp; =
PropertyDescriptor?</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3D=E5=AE=8B=E4=BD=93 size=3D2>Maybe there are many =
way to mix EMF &amp; GEF=20
&amp; use GEF command stack, but I just know<BR>my way.</FONT></DIV>
<DIV><FONT face=3D=E5=AE=8B=E4=BD=93 size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D=E5=AE=8B=E4=BD=93 size=3D2>BTW, use the default =
EMF command of cause little=20
slow then the command rewrite for<BR>specif application, because =
these=20
command is very common, it will call lots methods<BR>even for very =
simple=20
operation like set property.</FONT></DIV>
<DIV><FONT face=3D=E5=AE=8B=E4=BD=93 size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D=E5=AE=8B=E4=BD=93 size=3D2>Regards,</FONT></DIV>
<DIV><FONT face=3D=E5=AE=8B=E4=BD=93 size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D=E5=AE=8B=E4=BD=93 size=3D2>Eric</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Randy Hudson" &lt;<A=20
href=3D"mailto:none@us.ibm.com">none@us.ibm.com</A>&gt;=20
=
=E5=86=99=E5=85=A5=E6=B6=88=E6=81=AF=E6=96=B0=E9=97=BB:b8e7d a$qf9$1@rogue=
..oti.com...</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>"Eric Suen" &lt;</FONT><A=20
href=3D"mailto:eric_suen_cn@hotmail.com"><FONT face=3DArial=20
size=3D2>eric_suen_cn@hotmail.com</FONT></A><FONT face=3DArial =
size=3D2>&gt;=20
wrote in message </FONT><A =
href=3D"news:b8e2e6$nho$1@rogue.oti.com"><FONT=20
face=3DArial =
size=3D2>news:b8e2e6$nho$1@rogue.oti.com</FONT></A><FONT=20
face=3DArial size=3D2>...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&gt; Hi Edmund,<BR>&gt; <BR>&gt;=20
&nbsp;&nbsp;&nbsp; &gt;&gt;Any concerns about code =
plagiarism<BR>&gt;=20
&nbsp;&nbsp;&nbsp; You can use these code freely if you wish, but =
I still=20
think GEF &amp; EMF<BR>&gt; should<BR>&gt; use the same command =
API just=20
like WSAD.<BR>&gt; <BR>&gt; &nbsp;&nbsp;&nbsp; use EMF command =
stack=20
instead of GEF is because: EMF has implement some<BR>&gt; =
common<BR>&gt;=20
command, like set, copy, cut, past, drag &amp; drop, reparent, =
reorder, if=20
I use<BR>&gt; GEF command</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Are any of the reused EMF =
commands=20
complicated for you to implement?&nbsp; For example, here is =
reorder from=20
the Logic example.&nbsp; It is 20 lines of code:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>public class ReorderPartCommand =
extends=20
Command {</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>private int oldIndex, =
newIndex;<BR>private=20
LogicSubpart child;<BR>private LogicDiagram parent;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>public =
ReorderPartCommand(LogicSubpart child,=20
LogicDiagram parent, int oldIndex, int newIndex )=20
=
{<BR>&nbsp;super(LogicMessages.ReorderPartCommand_Label); <BR>&nbsp;this.c=
hild=20
=3D child;<BR>&nbsp;this.parent =3D parent;<BR>&nbsp;this.oldIndex =
=3D=20
oldIndex;<BR>&nbsp;this.newIndex =3D newIndex;<BR>}</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>public void execute()=20
=
{<BR>&nbsp;parent.removeChild(child);<BR>&nbsp;parent.addChild(child,=20
newIndex);<BR>}</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>public void undo()=20
=
{<BR>&nbsp;parent.removeChild(child);<BR>&nbsp;parent.addChild(child,=20
oldIndex);<BR>}<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I'm just asking because Edmund =
mentioned that=20
your mixed-mode commandstack is 500+ lines of code.&nbsp;Are you =
actually=20
getting more than 500 lines in return?&nbsp; The other concern I =
have is=20
that when you start piecing together pre-made commands, you end up =
putting=20
too much logic in EditPolicies or somewhere else that really =
should just=20
be in&nbsp;a "smarter"&nbsp;command.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I'm sort of familiar with the =
CopyCommand in=20
EMF.&nbsp; This command is really just a factory for cloning=20
objects.&nbsp; You could always use it as a helper to clone =
objects,=20
without using it as a Command.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT><FONT face=3DArial=20
size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&gt; stack, I should rewrite all =
these=20
command myself, in my report designer<BR>&gt; project, you<BR>&gt; =
can=20
found a lot of Action class, but very little Command class =
:)<BR>&gt;=20
<BR>&gt; Regards,<BR>&gt; <BR>&gt; Eric<BR>&gt; <BR>&gt; "Edmund=20
Reinhardt" &lt;</FONT><A href=3D"mailto:reinhard@ca.ibm.com"><FONT =

face=3DArial size=3D2>reinhard@ca.ibm.com</FONT></A><FONT =
face=3DArial=20
size=3D2>&gt; =
=C3=90=C2=B4=C3=88=C3=AB=C3=8F=C3=BB=C3=8F=C2=A2=C3=90=C3=82 =C3=8E=C3=85 <=
BR>&gt; :b8csi6$3c1$1@rogue.oti.com...<BR>&gt;=20
&gt; Hi Eric,<BR>&gt; &gt;<BR>&gt; &gt; Nice job of making things =
work for=20
two different worlds! Any concerns<BR>&gt; about<BR>&gt; &gt; code =

plagiarism?<BR>&gt; &gt;<BR>&gt; &gt; If I understand Randy =
correctly, he=20
is saying that you do not need an EMF<BR>&gt; &gt; command =
stack.<BR>&gt;=20
&gt; A GEF command stack would be sufficient.&nbsp; Is there any =
reason=20
why that<BR>&gt; &gt; wouldn't work for your report designer=20
editor?<BR>&gt; &gt;<BR>&gt; &gt; Thanks,<BR>&gt; &gt;<BR>&gt; =
&gt; "Eric=20
Suen" &lt;</FONT><A href=3D"mailto:eric_suen_cn@hotmail.com"><FONT =

face=3DArial size=3D2>eric_suen_cn@hotmail.com</FONT></A><FONT =
face=3DArial=20
size=3D2>&gt; wrote in message<BR>&gt; &gt; </FONT><A=20
href=3D"news:b87dme$1r7$1@rogue.oti.com"><FONT face=3DArial=20
size=3D2>news:b87dme$1r7$1@rogue.oti.com</FONT></A><FONT =
face=3DArial=20
size=3D2>...<BR>&gt; &gt; &gt; Hi,<BR>&gt; &gt; &gt;<BR>&gt; &gt;=20
&gt;&nbsp;&nbsp;&nbsp;&nbsp; I have written some wrap for EMF =
&amp; GEF,=20
Maybe it is not the best<BR>&gt; way,<BR>&gt; &gt; &gt; but it =
works. for=20
more information, you can visite:<BR>&gt; &gt; &gt;&nbsp; =
</FONT><A=20
href=3D"http://sourceforge.net/projects/jeez"><FONT face=3DArial=20
size=3D2>http://sourceforge.net/projects/jeez</FONT></A><BR><FONT =
face=3DArial=20
size=3D2>&gt; &gt; &gt;<BR>&gt; &gt; &gt; I think the best way is =
EMF &amp;=20
GEF use the same command interface.<BR>&gt; &gt; &gt;<BR>&gt; &gt; =
&gt;=20
Regards,<BR>&gt; &gt; &gt;<BR>&gt; &gt; &gt; Eric<BR>&gt; &gt;=20
&gt;<BR>&gt; &gt; &gt; "Edmund Reinhardt" &lt;</FONT><A=20
href=3D"mailto:reinhard@ca.ibm.com"><FONT face=3DArial=20
size=3D2>reinhard@ca.ibm.com</FONT></A><FONT face=3DArial =
size=3D2>&gt;=20
=
=C3=90=C2=B4=C3=88=C3=AB=C3=8F=C3=BB=C3=8F=C2=A2=C3=90=C3=82 =C3=8E=C3=85 <=
BR>&gt; &gt; &gt; :b86pqn$mc6$1@rogue.oti.com...<BR>&gt; &gt;=20
&gt; &gt; I am designing my model in EMF so it will respond to EMF =

commands<BR>&gt; using<BR>&gt; &gt; &gt; the<BR>&gt; &gt; &gt; =
&gt; EMF=20
command stack for Undo/Redo.<BR>&gt; &gt; &gt; &gt; I then want to =
put a=20
GEF editor on top of that.&nbsp; But GEF is using its<BR>&gt; &gt; =

own<BR>&gt; &gt; &gt; &gt; commands and command stack.<BR>&gt; =
&gt; &gt;=20
&gt; What is the recommended way of gettng EMF models and GEF edit =
parts=20
to<BR>&gt; &gt; &gt; &gt; communicate?<BR>&gt; &gt; &gt; =
&gt;<BR>&gt; &gt;=20
&gt; &gt; Thanks in advance<BR>&gt; &gt; &gt; &gt;<BR>&gt; &gt; =
&gt;=20
&gt;<BR>&gt; &gt; &gt;<BR>&gt; &gt; &gt;<BR>&gt; &gt; &gt;<BR>&gt; =

&gt;<BR>&gt; &gt;<BR>&gt; <BR>&gt;=20
</FONT></DIV></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BODY ></HTML>

------=_NextPart_000_0058_01C30D06.71D70E30--
Re: EMF Commands vs. GEF Commands [message #76999 is a reply to message #76985] Mon, 28 April 2003 01:19 Go to previous message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

This is a multi-part message in MIME format.

------=_NextPart_000_0023_01C30D02.B5AAEF40
Content-Type: text/plain;
charset="utf-8"
Content-Transfer-Encoding: quoted-printable

It isn't just multiple selection that is affected. Properties that have =
sub-properties result in two separate calls to setPropertyValue(...). =
So, the "x" property might be set onto the "location" property, then the =
locatin property is set on the selected item. Undo must be handled =
specially. Instead of rolling back the changes in the reverse order, =
they must be reverted in the same order, so that the old "x" is set into =
the "location", and then location is set into the selected item.
"Eric Suen" <eric_suen_cn@hotmail.com> wrote in message =
news:b8gmvh$7mv$1@rogue.oti.com...
Yes, EMF Edit has some bugs, if you select 2 or more items, and click =
property in
propertysheetpage, even you no change the value, the command stack is =
changed, but
you know, all software has bugs, default if you select more than one =
item, EMF Edit
does not show property because their implementation of =
isCompatibleWith is just simply
return false.
"Randy Hudson" <none@us.ibm.com> =
=E5=86=99=E5=85=A5=E6=B6=88=E6=81=AF=E6=96=B0=E9=97=BB:b8eha d$vrc$1@rogue=
..oti.com...
Last time I checked, EMF Edit does not do PropertySource correctly. =
The commands must be generated externally, otherwise Undo is not atomic. =
To see this, select 2 or more items in an EMF edit application and =
change the property, then undo.
"Eric Suen" <eric_suen_cn@hotmail.com> wrote in message =
news:b8ebni$srl$1@rogue.oti.com...
In 500+ lines of codes, there are more then 200+ lines is
comments generated by eclipse, :) and the others code is just the =
simple
wrap, no complex logic!

If I use GEF command stack, then if I want the PropertySheetPage =
support=20
undo/redo, I must use code like this or write my own =
PropertySheetPage:
PropertySheetPage page =3D new PropertySheetPage();
=
page.setRootEntry(GEFPlugin.createUndoablePropertySheetEntry (getCommandSt=
ack()));
am I right?

So, how can I use edit code generated by EMF? and in EMF, the =
property changed in
model, need Adapter(ItemProvider) -> AdapterFactory -> Viewer? do =
you means I should
rewrite another framework myself to handle this ? or like the code =
in logicdesigner,=20
mix the model logic with PropertySource & PropertyDescriptor?

Maybe there are many way to mix EMF & GEF & use GEF command stack, =
but I just know
my way.

BTW, use the default EMF command of cause little slow then the =
command rewrite for
specif application, because these command is very common, it will =
call lots methods
even for very simple operation like set property.

Regards,

Eric
"Randy Hudson" <none@us.ibm.com> =
=E5=86=99=E5=85=A5=E6=B6=88=E6=81=AF=E6=96=B0=E9=97=BB:b8e7d a$qf9$1@rogue=
..oti.com...

"Eric Suen" <eric_suen_cn@hotmail.com> wrote in message =
news:b8e2e6$nho$1@rogue.oti.com...
> Hi Edmund,
>=20
> >>Any concerns about code plagiarism
> You can use these code freely if you wish, but I still =
think GEF & EMF
> should
> use the same command API just like WSAD.
>=20
> use EMF command stack instead of GEF is because: EMF has =
implement some
> common
> command, like set, copy, cut, past, drag & drop, reparent, =
reorder, if I use
> GEF command

Are any of the reused EMF commands complicated for you to =
implement? For example, here is reorder from the Logic example. It is =
20 lines of code:

public class ReorderPartCommand extends Command {

private int oldIndex, newIndex;
private LogicSubpart child;
private LogicDiagram parent;

public ReorderPartCommand(LogicSubpart child, LogicDiagram =
parent, int oldIndex, int newIndex ) {
super(LogicMessages.ReorderPartCommand_Label);
this.child =3D child;
this.parent =3D parent;
this.oldIndex =3D oldIndex;
this.newIndex =3D newIndex;
}

public void execute() {
parent.removeChild(child);
parent.addChild(child, newIndex);
}

public void undo() {
parent.removeChild(child);
parent.addChild(child, oldIndex);
}

I'm just asking because Edmund mentioned that your mixed-mode =
commandstack is 500+ lines of code. Are you actually getting more than =
500 lines in return? The other concern I have is that when you start =
piecing together pre-made commands, you end up putting too much logic in =
EditPolicies or somewhere else that really should just be in a "smarter" =
command.

I'm sort of familiar with the CopyCommand in EMF. This command =
is really just a factory for cloning objects. You could always use it =
as a helper to clone objects, without using it as a Command.

> stack, I should rewrite all these command myself, in my report =
designer
> project, you
> can found a lot of Action class, but very little Command class =
:)
>=20
> Regards,
>=20
> Eric
>=20
> "Edmund Reinhardt" <reinhard@ca.ibm.com> =
=C3=90=C2=B4=C3=88=C3=AB=C3=8F=C3=BB=C3=8F=C2=A2=C3=90=C3=82 =C3=8E=C3=85
> :b8csi6$3c1$1@rogue.oti.com...
> > Hi Eric,
> >
> > Nice job of making things work for two different worlds! Any =
concerns
> about
> > code plagiarism?
> >
> > If I understand Randy correctly, he is saying that you do =
not need an EMF
> > command stack.
> > A GEF command stack would be sufficient. Is there any =
reason why that
> > wouldn't work for your report designer editor?
> >
> > Thanks,
> >
> > "Eric Suen" <eric_suen_cn@hotmail.com> wrote in message
> > news:b87dme$1r7$1@rogue.oti.com...
> > > Hi,
> > >
> > > I have written some wrap for EMF & GEF, Maybe it is =
not the best
> way,
> > > but it works. for more information, you can visite:
> > > http://sourceforge.net/projects/jeez
> > >
> > > I think the best way is EMF & GEF use the same command =
interface.
> > >
> > > Regards,
> > >
> > > Eric
> > >
> > > "Edmund Reinhardt" <reinhard@ca.ibm.com> =
=C3=90=C2=B4=C3=88=C3=AB=C3=8F=C3=BB=C3=8F=C2=A2=C3=90=C3=82 =C3=8E=C3=85
> > > :b86pqn$mc6$1@rogue.oti.com...
> > > > I am designing my model in EMF so it will respond to EMF =
commands
> using
> > > the
> > > > EMF command stack for Undo/Redo.
> > > > I then want to put a GEF editor on top of that. But GEF =
is using its
> > own
> > > > commands and command stack.
> > > > What is the recommended way of gettng EMF models and GEF =
edit parts to
> > > > communicate?
> > > >
> > > > Thanks in advance
> > > >
> > > >
> > >
> > >
> > >
> >
> >
>=20
>=20

------=_NextPart_000_0023_01C30D02.B5AAEF40
Content-Type: text/html;
charset="utf-8"
Content-Transfer-Encoding: quoted-printable

=EF=BB=BF<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Dutf-8">
<META content=3D"MSHTML 6.00.2723.2500" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>It isn't just multiple selection that =
is=20
affected.&nbsp; Properties that have sub-properties result in two =
separate calls=20
to setPropertyValue(...).&nbsp; So, the "x" property might be set onto =
the=20
"location" property, then the locatin property is set on the selected=20
item.&nbsp; Undo must be handled specially.&nbsp; Instead of rolling =
back the=20
changes in the reverse order, they must be reverted in the same order, =
so that=20
the old "x" is set into the "location", and then location is set into =
the=20
selected item.</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Eric Suen" &lt;<A=20
=
href=3D"mailto:eric_suen_cn@hotmail.com">eric_suen_cn@hotmail.com</A>&gt;=
wrote=20
in message <A=20
=
href=3D"news:b8gmvh$7mv$1@rogue.oti.com">news:b8gmvh$7mv$1@rogue.oti.com<=
/A>...</DIV>
<DIV><FONT face=3D=E5=AE=8B=E4=BD=93 size=3D2>Yes, EMF Edit has some =
bugs, if you select 2 or more=20
items, and click property in</FONT></DIV>
<DIV><FONT face=3D=E5=AE=8B=E4=BD=93 size=3D2>propertysheetpage, even =
you no change the value, the=20
command stack is changed, but</FONT></DIV>
<DIV><FONT face=3D=E5=AE=8B=E4=BD=93 size=3D2>you know, all software =
has bugs, default if you=20
select more than one item, EMF Edit</FONT></DIV>
<DIV><FONT face=3D=E5=AE=8B=E4=BD=93 size=3D2>does not show property =
because their implementation=20
of isCompatibleWith is just simply</FONT></DIV>
<DIV><FONT face=3D=E5=AE=8B=E4=BD=93 size=3D2>return =
false.</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Randy Hudson" &lt;<A=20
href=3D"mailto:none@us.ibm.com">none@us.ibm.com</A>&gt;=20
=
=E5=86=99=E5=85=A5=E6=B6=88=E6=81=AF=E6=96=B0=E9=97=BB:b8eha d$vrc$1@rogue=
..oti.com...</DIV>
<DIV><FONT face=3DArial size=3D2>Last time I checked, EMF Edit does =
not do=20
PropertySource correctly.&nbsp; The commands must be generated =
externally,=20
otherwise Undo is not atomic.&nbsp; To see this, select 2 or more =
items in=20
an EMF edit application and change the property, then =
undo.</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Eric Suen" &lt;<A=20
=
href=3D"mailto:eric_suen_cn@hotmail.com">eric_suen_cn@hotmail.com</A>&gt;=
=20
wrote in message <A=20
=
href=3D"news:b8ebni$srl$1@rogue.oti.com">news:b8ebni$srl$1@rogue.oti.com<=
/A>...</DIV>
<DIV><FONT face=3D=E5=AE=8B=E4=BD=93 size=3D2>In 500+ lines of =
codes, there are more then 200+=20
lines is<BR>comments generated by eclipse, :)&nbsp; and the others =
code is=20
just the simple<BR>wrap, no complex logic!</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3D=E5=AE=8B=E4=BD=93 size=3D2>If I use GEF command =
stack, then if I want the=20
PropertySheetPage support <BR>undo/redo, I must use code like this =
or=20
write my own PropertySheetPage:<BR>&nbsp; PropertySheetPage page =
=3D new=20
PropertySheetPage();<BR>&nbsp;=20
=
page.setRootEntry(GEFPlugin.createUndoablePropertySheetEntry (getCommandSt=
ack()));<BR>am=20
I right?</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3D=E5=AE=8B=E4=BD=93 size=3D2>So, how can I use =
edit code generated by EMF?=20
and in EMF, the property changed in<BR>model, need =
Adapter(ItemProvider)=20
-&gt; AdapterFactory -&gt; Viewer? do you means I =
should<BR>rewrite=20
another framework myself to handle this ? or like the code in=20
logicdesigner, <BR>mix the model logic with PropertySource &amp;=20
PropertyDescriptor?</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3D=E5=AE=8B=E4=BD=93 size=3D2>Maybe there are many =
way to mix EMF &amp; GEF=20
&amp; use GEF command stack, but I just know<BR>my =
way.</FONT></DIV>
<DIV><FONT face=3D=E5=AE=8B=E4=BD=93 size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D=E5=AE=8B=E4=BD=93 size=3D2>BTW, use the default =
EMF command of cause little=20
slow then the command rewrite for<BR>specif application, because =
these=20
command is very common, it will call lots methods<BR>even for very =
simple=20
operation like set property.</FONT></DIV>
<DIV><FONT face=3D=E5=AE=8B=E4=BD=93 size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D=E5=AE=8B=E4=BD=93 =
size=3D2>Regards,</FONT></DIV>
<DIV><FONT face=3D=E5=AE=8B=E4=BD=93 size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D=E5=AE=8B=E4=BD=93 size=3D2>Eric</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Randy Hudson" &lt;<A=20
href=3D"mailto:none@us.ibm.com">none@us.ibm.com</A>&gt;=20
=
=E5=86=99=E5=85=A5=E6=B6=88=E6=81=AF=E6=96=B0=E9=97=BB:b8e7d a$qf9$1@rogue=
..oti.com...</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>"Eric Suen" &lt;</FONT><A=20
href=3D"mailto:eric_suen_cn@hotmail.com"><FONT face=3DArial=20
size=3D2>eric_suen_cn@hotmail.com</FONT></A><FONT face=3DArial =
size=3D2>&gt;=20
wrote in message </FONT><A =
href=3D"news:b8e2e6$nho$1@rogue.oti.com"><FONT=20
face=3DArial =
size=3D2>news:b8e2e6$nho$1@rogue.oti.com</FONT></A><FONT=20
face=3DArial size=3D2>...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&gt; Hi Edmund,<BR>&gt; =
<BR>&gt;=20
&nbsp;&nbsp;&nbsp; &gt;&gt;Any concerns about code =
plagiarism<BR>&gt;=20
&nbsp;&nbsp;&nbsp; You can use these code freely if you wish, =
but I=20
still think GEF &amp; EMF<BR>&gt; should<BR>&gt; use the same =
command=20
API just like WSAD.<BR>&gt; <BR>&gt; &nbsp;&nbsp;&nbsp; use EMF =
command=20
stack instead of GEF is because: EMF has implement some<BR>&gt;=20
common<BR>&gt; command, like set, copy, cut, past, drag &amp; =
drop,=20
reparent, reorder, if I use<BR>&gt; GEF command</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Are any of the reused EMF =
commands=20
complicated for you to implement?&nbsp; For example, here is =
reorder=20
from the Logic example.&nbsp; It is 20 lines of =
code:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>public class ReorderPartCommand =
extends=20
Command {</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>private int oldIndex, =
newIndex;<BR>private=20
LogicSubpart child;<BR>private LogicDiagram parent;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>public =
ReorderPartCommand(LogicSubpart=20
child, LogicDiagram parent, int oldIndex, int newIndex )=20
=
{<BR>&nbsp;super(LogicMessages.ReorderPartCommand_Label); <BR>&nbsp;this.c=
hild=20
=3D child;<BR>&nbsp;this.parent =3D =
parent;<BR>&nbsp;this.oldIndex =3D=20
oldIndex;<BR>&nbsp;this.newIndex =3D newIndex;<BR>}</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>public void execute()=20
=
{<BR>&nbsp;parent.removeChild(child);<BR>&nbsp;parent.addChild(child,=20
newIndex);<BR>}</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>public void undo()=20
=
{<BR>&nbsp;parent.removeChild(child);<BR>&nbsp;parent.addChild(child,=20
oldIndex);<BR>}<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I'm just asking because Edmund =
mentioned=20
that your mixed-mode commandstack is 500+ lines of =
code.&nbsp;Are you=20
actually getting more than 500 lines in return?&nbsp; The other =
concern=20
I have is that when you start piecing together pre-made =
commands, you=20
end up putting too much logic in EditPolicies or somewhere else =
that=20
really should just be in&nbsp;a =
"smarter"&nbsp;command.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I'm sort of familiar with the =
CopyCommand=20
in EMF.&nbsp; This command is really just a factory for cloning=20
objects.&nbsp; You could always use it as a helper to clone =
objects,=20
without using it as a Command.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT><FONT face=3DArial=20
size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&gt; stack, I should rewrite =
all these=20
command myself, in my report designer<BR>&gt; project, =
you<BR>&gt; can=20
found a lot of Action class, but very little Command class =
:)<BR>&gt;=20
<BR>&gt; Regards,<BR>&gt; <BR>&gt; Eric<BR>&gt; <BR>&gt; "Edmund =

Reinhardt" &lt;</FONT><A =
href=3D"mailto:reinhard@ca.ibm.com"><FONT=20
face=3DArial size=3D2>reinhard@ca.ibm.com</FONT></A><FONT =
face=3DArial=20
size=3D2>&gt; =
=C3=90=C2=B4=C3=88=C3=AB=C3=8F=C3=BB=C3=8F=C2=A2=C3=90=C3=82 =C3=8E=C3=85 <=
BR>&gt; :b8csi6$3c1$1@rogue.oti.com...<BR>&gt;=20
&gt; Hi Eric,<BR>&gt; &gt;<BR>&gt; &gt; Nice job of making =
things work=20
for two different worlds! Any concerns<BR>&gt; about<BR>&gt; =
&gt; code=20
plagiarism?<BR>&gt; &gt;<BR>&gt; &gt; If I understand Randy =
correctly,=20
he is saying that you do not need an EMF<BR>&gt; &gt; command=20
stack.<BR>&gt; &gt; A GEF command stack would be =
sufficient.&nbsp; Is=20
there any reason why that<BR>&gt; &gt; wouldn't work for your =
report=20
designer editor?<BR>&gt; &gt;<BR>&gt; &gt; Thanks,<BR>&gt; =
&gt;<BR>&gt;=20
&gt; "Eric Suen" &lt;</FONT><A=20
href=3D"mailto:eric_suen_cn@hotmail.com"><FONT face=3DArial=20
size=3D2>eric_suen_cn@hotmail.com</FONT></A><FONT face=3DArial =
size=3D2>&gt;=20
wrote in message<BR>&gt; &gt; </FONT><A=20
href=3D"news:b87dme$1r7$1@rogue.oti.com"><FONT face=3DArial=20
size=3D2>news:b87dme$1r7$1@rogue.oti.com</FONT></A><FONT =
face=3DArial=20
size=3D2>...<BR>&gt; &gt; &gt; Hi,<BR>&gt; &gt; &gt;<BR>&gt; =
&gt;=20
&gt;&nbsp;&nbsp;&nbsp;&nbsp; I have written some wrap for EMF =
&amp; GEF,=20
Maybe it is not the best<BR>&gt; way,<BR>&gt; &gt; &gt; but it =
works.=20
for more information, you can visite:<BR>&gt; &gt; &gt;&nbsp; =
</FONT><A=20
href=3D"http://sourceforge.net/projects/jeez"><FONT face=3DArial =

=
size=3D2>http://sourceforge.net/projects/jeez</FONT></A><BR><FONT=20
face=3DArial size=3D2>&gt; &gt; &gt;<BR>&gt; &gt; &gt; I think =
the best way=20
is EMF &amp; GEF use the same command interface.<BR>&gt; &gt;=20
&gt;<BR>&gt; &gt; &gt; Regards,<BR>&gt; &gt; &gt;<BR>&gt; &gt; =
&gt;=20
Eric<BR>&gt; &gt; &gt;<BR>&gt; &gt; &gt; "Edmund Reinhardt"=20
&lt;</FONT><A href=3D"mailto:reinhard@ca.ibm.com"><FONT =
face=3DArial=20
size=3D2>reinhard@ca.ibm.com</FONT></A><FONT face=3DArial =
size=3D2>&gt;=20
=
=C3=90=C2=B4=C3=88=C3=AB=C3=8F=C3=BB=C3=8F=C2=A2=C3=90=C3=82 =C3=8E=C3=85 <=
BR>&gt; &gt; &gt; :b86pqn$mc6$1@rogue.oti.com...<BR>&gt;=20
&gt; &gt; &gt; I am designing my model in EMF so it will respond =
to EMF=20
commands<BR>&gt; using<BR>&gt; &gt; &gt; the<BR>&gt; &gt; &gt; =
&gt; EMF=20
command stack for Undo/Redo.<BR>&gt; &gt; &gt; &gt; I then want =
to put a=20
GEF editor on top of that.&nbsp; But GEF is using its<BR>&gt; =
&gt;=20
own<BR>&gt; &gt; &gt; &gt; commands and command stack.<BR>&gt; =
&gt; &gt;=20
&gt; What is the recommended way of gettng EMF models and GEF =
edit parts=20
to<BR>&gt; &gt; &gt; &gt; communicate?<BR>&gt; &gt; &gt; =
&gt;<BR>&gt;=20
&gt; &gt; &gt; Thanks in advance<BR>&gt; &gt; &gt; &gt;<BR>&gt; =
&gt;=20
&gt; &gt;<BR>&gt; &gt; &gt;<BR>&gt; &gt; &gt;<BR>&gt; &gt; =
&gt;<BR>&gt;=20
&gt;<BR>&gt; &gt;<BR>&gt; <BR>&gt;=20
=
</FONT></DIV></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE ></BODY><=
/HTML>

------=_NextPart_000_0023_01C30D02.B5AAEF40--
Previous Topic:How to connect or edit?
Next Topic:unconnected connections
Goto Forum:
  


Current Time: Tue Apr 16 17:52:42 GMT 2024

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

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

Back to the top