Skip to main content



      Home
Home » Eclipse Projects » GEF » architecture struggle with actions vs commands
architecture struggle with actions vs commands [message #104184] Sat, 08 November 2003 09:06 Go to next message
Eclipse UserFriend
Originally posted by: Lamont_Gilbert.Rigidsoftware.com

I have been trying to keep my actions working on editparts and my commands
working on modles, but its getting difficult.

The two commands I added are causing my problems. Group and Paste. Both
of them create new models. I always think to break it down into multiple
commands, but it never works. this is because one command requires the
output of another, and commands dont chain that way. So I though group
was a orphan + create + add sequence. but the result of the create command
can not be seen by the last add, so I had to scrap it and have my own
group command. But it would be nice if all adds passed eventually through
the same command. I just cant make that happen. Same with paste. its
create + add sequence. but result from create cant be seen in add.

so what I end up with is big commands that are a form of fancy create
command. so I have several commands that create and add but from all
different places.

It does not seem very smooth or architecturily sound. anyone doing
anything different they care to share? or have any ideas or
recommendations? Just does not seem that commands are very stackable.

CL
Re: architecture struggle with actions vs commands [message #104215 is a reply to message #104184] Sat, 08 November 2003 20:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

"CL [dnoyeB] Gilbert" <Lamont_Gilbert@Rigidsoftware.com> wrote in message
news:pan.2003.11.08.14.06.22.680542@Rigidsoftware.com...
> I have been trying to keep my actions working on editparts and my commands
> working on modles, but its getting difficult.
>
> The two commands I added are causing my problems. Group and Paste. Both
> of them create new models. I always think to break it down into multiple
> commands, but it never works. this is because one command requires the
> output of another, and commands dont chain that way. So I though group

This is the same problem EMF created. Don't try to use a Command to be a
factory. Just create a factory, and pass it into the paste commend.

> was a orphan + create + add sequence. but the result of the create
command
> can not be seen by the last add, so I had to scrap it and have my own
> group command. But it would be nice if all adds passed eventually through
> the same command. I just cant make that happen. Same with paste. its
> create + add sequence. but result from create cant be seen in add.
>
> so what I end up with is big commands that are a form of fancy create
> command. so I have several commands that create and add but from all
> different places.
>
> It does not seem very smooth or architecturily sound. anyone doing
> anything different they care to share? or have any ideas or
> recommendations? Just does not seem that commands are very stackable.

If you have an existing Create/AddCommand, you could extend it to create a
PasteCommand:

PasteCommand extends Crate/AddCommand {

execute() {
super.setChildren (getPastedObjects());
}

List getPastedObjects() {
//the "factory" part of the command which creates the objects from the
clipboard.
}

}

You might have to override enablement too, I'm not familiar with when the
objects are available.

>
> CL
Re: architecture struggle with actions vs commands [message #104306 is a reply to message #104215] Sun, 09 November 2003 16:25 Go to previous message
Eclipse UserFriend
Originally posted by: Lamont_Gilbert.Rigidsoftware.com

On Sat, 08 Nov 2003 20:47:21 -0500, Randy Hudson wrote:


> "CL [dnoyeB] Gilbert" <Lamont_Gilbert@Rigidsoftware.com> wrote in
> message news:pan.2003.11.08.14.06.22.680542@Rigidsoftware.com...
>> I have been trying to keep my actions working on editparts and my
>> commands working on modles, but its getting difficult.
>>
>> The two commands I added are causing my problems. Group and Paste.
>> Both of them create new models. I always think to break it down into
>> multiple commands, but it never works. this is because one command
>> requires the output of another, and commands dont chain that way. So I
>> though group
>
> This is the same problem EMF created. Don't try to use a Command to be
> a factory. Just create a factory, and pass it into the paste commend.
>
>
I solved the problem with my Group action by passing it a factory. but I
was not sure how well this would work for paste. Ill look into it.

CL
Previous Topic:[draw2d] What are FreeformFigures ?
Next Topic:CenteringLayout
Goto Forum:
  


Current Time: Wed May 07 23:23:05 EDT 2025

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

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

Back to the top