Community
Participate
Working Groups
If I add "org.eclipse.e4.tools.emf.liveeditor" to my e4 application I can directly edit the live model of the running application. Unfortunately changes in the order of parts are not reflected. Example: Create an e4 application with 2 part in one stack -> run it and try to change the order via the live model editor.
Talked with Tom via IRC, this seems to be a problem of the renderer.
The problem exists for both sash and stack.
This is probably because there are no event handlers for a "move" operation?
I think that this would work if the 'move' were broken down into a 'remove' followed by an 'add(index)'...we can look into an optimized 'move' later... Tom, if the editor isn't using this implementation of 'move' could you modify it so that it does and see if this issue is 'fixed' ?
... well the editor is only doing an add() on the final destination because this is an implicit remove on the source feature. If I get your request right you want me to call remove on the source and an add on the target?
Eric, I've now tried to reorder inside a Stack using ModelService#move() but this fails when moving inside a the same Container. -------8<------- java.lang.IllegalArgumentException: The 'no duplicates' constraint is violated at org.eclipse.emf.common.util.AbstractEList.add(AbstractEList.java:342) at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.move(ModelServiceImpl.java:301) at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.move(ModelServiceImpl.java:284) at org.eclipse.e4.tools.emf.ui.common.Util.moveElementByIndex(Util.java:91) -------8<------- The call looks like this: ------8<------ public static boolean moveElementByIndex(EModelService modelService, MUIElement element, int index) { modelService.move(element, element.getParent(), index); return true; } ------8<------ I also think that our ModelServiceImpl.move can fail with an IndexOutOfBoundsException when the index passed is too high (I think you should check the index value passed in!)
One more note on this I think remove/add is a very bad thing in case of reordering inside a container because it mean dispose/create. The EventSystem should simply support Notification.MOVE which means a reordering in the SAME List => no dispose/recreate needed!
Ok. The comment about dispose/recreate is not correct, I've now checked in a new a fix for Stacks
I've now switched the implementation for ALL ElementContainers and the Drag&Drop