Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Compound Command issues
Compound Command issues [message #142652] Tue, 13 July 2004 20:08 Go to next message
Eclipse UserFriend
Originally posted by: brian.fernandes.codito.com

Hi Guys,

I've recently been experimenting with multiple selection in my diagram; and
I'm facing a few issues.

I have models : Diagram, Lane, Box and Child.

Diagram is the main root model.
Lane exists within Diagram.
Box can only exist within Lane
Child can only exist within Box.

Now, if you try to move an existing Box into another Box, the Box's Layout
EditPolicy detects this in the createAddCommand and returns a null command.
No command is executed and therefore; you won't be able to move a Box into
another Box.

Now, if you select a Box(A) AND a Child (which exists in another Box(B) )
and attempt to move this into another Box(C), the createAddCommand will
return null for attempting to move A into C. However, moving the Child into
C is allowed and an (add) command is created.

The users chosen operation partially executes. Since the compound command
can execute, the Box A is orphaned from it's parent lane, but it is NOT
added to C (- the add command was not created, which is correct). So A
disappears from the diagram. The Child however, is added to C. I would like
"all or nothing" either all commands are executed - or none are. With what
is happening now, I'm losing A from the diagram AND a partial command is
being executed.

How do I implement an "all or nothing" approach ? Should I place the model
constrint checks elsewhere ? in getTargetEditPart for instance ? Or should I
override ConstrainedLayoutEditPolicy#getAddCommand and return null if any of
the commands in the compund command are null or unexecutable ?
Or am I barking up the wrong tree ?


Thanks in advance,
Brian.
Re: Compound Command issues [message #142767 is a reply to message #142652] Thu, 15 July 2004 06:58 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eostroukhov.hotmail.com

Simply return UnexecutableCommand.INSTANCE. Returning null signals that the
edit part does nothing in respond to request while the
UnexecutableCommand.INSTANCE signals that the operation cannot be performed.

"Brian Fernandes" <brian.fernandes@codito.com> wrote in message
news:cd1f3n$u2p$1@eclipse.org...
> Hi Guys,
>
> I've recently been experimenting with multiple selection in my diagram;
and
> I'm facing a few issues.
>
> I have models : Diagram, Lane, Box and Child.
>
> Diagram is the main root model.
> Lane exists within Diagram.
> Box can only exist within Lane
> Child can only exist within Box.
>
> Now, if you try to move an existing Box into another Box, the Box's Layout
> EditPolicy detects this in the createAddCommand and returns a null
command.
> No command is executed and therefore; you won't be able to move a Box into
> another Box.
>
> Now, if you select a Box(A) AND a Child (which exists in another Box(B) )
> and attempt to move this into another Box(C), the createAddCommand will
> return null for attempting to move A into C. However, moving the Child
into
> C is allowed and an (add) command is created.
>
> The users chosen operation partially executes. Since the compound command
> can execute, the Box A is orphaned from it's parent lane, but it is NOT
> added to C (- the add command was not created, which is correct). So A
> disappears from the diagram. The Child however, is added to C. I would
like
> "all or nothing" either all commands are executed - or none are. With what
> is happening now, I'm losing A from the diagram AND a partial command is
> being executed.
>
> How do I implement an "all or nothing" approach ? Should I place the model
> constrint checks elsewhere ? in getTargetEditPart for instance ? Or should
I
> override ConstrainedLayoutEditPolicy#getAddCommand and return null if any
of
> the commands in the compund command are null or unexecutable ?
> Or am I barking up the wrong tree ?
>
>
> Thanks in advance,
> Brian.
>
>
>
Re: Compound Command issues [message #142788 is a reply to message #142767] Thu, 15 July 2004 10:20 Go to previous message
Eclipse UserFriend
Originally posted by: brian.fernandes.codito.com

"Eugene Ostroukhov" <eostroukhov@hotmail.com> wrote in message
news:cd59t8$qes$1@eclipse.org...
> Simply return UnexecutableCommand.INSTANCE. Returning null signals that
the
> edit part does nothing in respond to request while the
> UnexecutableCommand.INSTANCE signals that the operation cannot be
performed.

thanks Eugene.
I had a solution worked out by overriding getTargetEditPart in the layout
EditPolicies of the concerened EditParts; however, this seems to be a much
cleaner & clearer approach.

Thanks,
Brian.

>
> "Brian Fernandes" <brian.fernandes@codito.com> wrote in message
> news:cd1f3n$u2p$1@eclipse.org...
> > Hi Guys,
> >
> > I've recently been experimenting with multiple selection in my diagram;
> and
> > I'm facing a few issues.
> >
> > I have models : Diagram, Lane, Box and Child.
> >
> > Diagram is the main root model.
> > Lane exists within Diagram.
> > Box can only exist within Lane
> > Child can only exist within Box.
> >
> > Now, if you try to move an existing Box into another Box, the Box's
Layout
> > EditPolicy detects this in the createAddCommand and returns a null
> command.
> > No command is executed and therefore; you won't be able to move a Box
into
> > another Box.
> >
> > Now, if you select a Box(A) AND a Child (which exists in another
Box(B) )
> > and attempt to move this into another Box(C), the createAddCommand will
> > return null for attempting to move A into C. However, moving the Child
> into
> > C is allowed and an (add) command is created.
> >
> > The users chosen operation partially executes. Since the compound
command
> > can execute, the Box A is orphaned from it's parent lane, but it is NOT
> > added to C (- the add command was not created, which is correct). So A
> > disappears from the diagram. The Child however, is added to C. I would
> like
> > "all or nothing" either all commands are executed - or none are. With
what
> > is happening now, I'm losing A from the diagram AND a partial command is
> > being executed.
> >
> > How do I implement an "all or nothing" approach ? Should I place the
model
> > constrint checks elsewhere ? in getTargetEditPart for instance ? Or
should
> I
> > override ConstrainedLayoutEditPolicy#getAddCommand and return null if
any
> of
> > the commands in the compund command are null or unexecutable ?
> > Or am I barking up the wrong tree ?
> >
> >
> > Thanks in advance,
> > Brian.
> >
> >
> >
>
>
Previous Topic:How to mix GEF's selection display into the PropertySheet with other selections from different Views
Next Topic:Good Beginning Examples
Goto Forum:
  


Current Time: Fri Apr 26 15:06:38 GMT 2024

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

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

Back to the top