views:

152

answers:

1

Hey folks,

I'd like to comfort the user by automatically jump to the next cell in a tableviewer, when a previous editing is completed. The user needs to modify start- endtimes in a list of entries. I was wondering how am I supposed to manually (programatically) trigger the CellEditor for a specific cell. I haven't seen that before in Eclipse, so "monkey see, monkey do" doesn't seem to help this time. :)

Thanks for your time

+1  A: 

Not a complete answer but maybe helpful enough for your problem..

First you need to detect when the editing is completed. Difficult, if the cell editor allows for text inputs, easier, if it provides a combo box for selecting an element.

You can add a ICellEditorListener to a CellEditor. The listener is called whenever the editor value has changed. And this is the trigger to check if the editing is completed and, if yes, proceed to the 'next' cell editor (so you have to define a cell editor sequence to lookup the next one. A simple Map could be enough).

Hope it helps!

Andreas_D
Wow, that's a good answer, Andreas. I was fiddeling around with a code snippet from Schindl, which uses lots of hocus-pocus (making fields public by reflection, adding tons of listeners, etc.). But this attempt of yours sounds good. I'll try it.
pimpf0r
With a ColumnViewerEditorActivationListener I react on the afterEditorDeactivated, obtain the current cell from the event source and invoke the editElement on the viewer after finding the corresponding neighbor by using ViewerCell.getNeighbor.
pimpf0r
so it works? Congratulations :)
Andreas_D