Re-order children in compartment [message #171529] |
Tue, 05 February 2008 11:33  |
Eclipse User |
|
|
|
Originally posted by: taggartboy.hotmail.com
Hello,
I have been trying for some time to allow Drag and Drop re-order of
children within a compartment. I have a custom layout manager to layout
the children in the compartment and the compartment is of type
ListCompartmentEditPart which arranges the children in an ordered list.
I am able to drag and drop children of the compartments from one
compartment to another and they are appended to the end of the compartment.
However, I would like to be able to drag one child into a space between
two other children in the compartment and have the children move
accordingly.
I have considered a few ways of achieving this like changing the sorting
keys in the sorting edit policy of the list compartment class to include
an attribute from the model or issuing a move children command but I can't
seem to get either of those to work.
I hope someone has done this before and can guide me or knows how i might
be able to achieve this, thanks.
|
|
|
|
|
|
|
Re: Re-order children in compartment [message #181181 is a reply to message #178346] |
Mon, 07 April 2008 09:10  |
Eclipse User |
|
|
|
Originally posted by: taggartboy.hotmail.com
Hi,
The adding of children within a compartment in order works great, thanks
for the update on the tutorial, I do however have one more question.
When dragging and dropping a node from one compartment to another, nodes
are always placed at the end of the list, I would like to be able to drag
and drop them into a particular order in the compartment.
Currently I have "installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new
DragDropEditPolicy());" installed in the create edit policies method of
the compartment figure along with your edit policy from the GMF/Recipes.
With just the DragDropEditPolicy() installed the nodes go to the bottom
when dragged and with just your edit policy installed the following error
occurrs when I drag a node into the desired position:
************************************************************ ******************
org.eclipse.core.commands.ExecutionException: While executing the
operation, an exception occurred
Caused by: java.lang.IllegalArgumentException: The 'no duplicates'
constraint is violated
at org.eclipse.emf.common.util.BasicEList.add(BasicEList.java:6 69)
at
org.eclipse.gmf.runtime.notation.impl.ViewImpl.insertChildAt (ViewImpl.java:711)
************************************************************ ******************
On the debug it shows that the insertChildAt gets the correct index but
fails with this error and the node is placed at the end of the compartment.
If you have any ideas on how this might be solved please let me know,
Thank you.
Peter.
|
|
|
Powered by
FUDForum. Page generated in 0.05397 seconds