Skip to main content



      Home
Home » Eclipse Projects » GEF » conditional creation and DnD across parts
conditional creation and DnD across parts [message #175601] Tue, 05 April 2005 09:43 Go to next message
Eclipse UserFriend
Originally posted by: sidus68.yahoo.com

Hi!
I have a form which contains one or more containers, and each container
contains various components. The container and the various components are
available from the palette viewer for creation. The container may only be
a child of the form, but not of itself or any other component. Nor must it
be possible to create a component outside of a container (a component must
contain the container as a parent somewhere in its EditPart hierarchy).
- two questions:
(i) am I correct in assuming that a LAYOUT_ROLE with XYLayoutEditPolicy
appropriately subclassed such that getCreateCommand() returns null if the
parent of the container is not the form, or (when creating a component)
the parent is the form?
(ii) components can be dragged within or across containers, but not onto
the form - how do I facilitate this?

Many thanks!
Re: conditional creation and DnD across parts [message #175788 is a reply to message #175601] Wed, 06 April 2005 10:07 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sidus68.yahoo.com

well, I have solved the creation problems, but not sure if my approach is
correct. Have used the LAYOUT_ROLE with XYLayoutEditPolicy appropriately
subclassed such that getCreateCommand() returns null if the target parent
is invappropriate. Further, have removed orphan/add support from the form
to prevent components being dragged outside the container (across
containers works fine).

However, how do I prevent something form being a child of itself (a
container withinn a container)?

Many thanks!
Re: conditional creation and DnD across parts [message #175839 is a reply to message #175788] Wed, 06 April 2005 13:56 Go to previous message
Eclipse UserFriend
"Sidney Lee" <sidus68@yahoo.com> wrote in message
news:a2c9d7e4002f37a1573ac2277559537e$1@www.eclipse.org...
> well, I have solved the creation problems, but not sure if my approach is
> correct. Have used the LAYOUT_ROLE with XYLayoutEditPolicy appropriately
> subclassed such that getCreateCommand() returns null if the target parent
> is invappropriate. Further, have removed orphan/add support from the form
> to prevent components being dragged outside the container (across
> containers works fine).

That's good.

>
> However, how do I prevent something form being a child of itself (a
> container withinn a container)?

Same thing as you did earlier. getCreateCommand() and getAddCommand() for
the ContainerEditPart should return null when the part being created is a
Container.

>
> Many thanks!
>
>
Previous Topic:About GraphicalViewer and EditDomain.
Next Topic:SELECTION PROBLEM!!!!!!!!!!!
Goto Forum:
  


Current Time: Wed Jul 23 16:35:06 EDT 2025

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

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

Back to the top