Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » table cell editor does not deactivate and commit the value when save command is invoked
table cell editor does not deactivate and commit the value when save command is invoked [message #709123] Wed, 03 August 2011 10:20 Go to previous message
SlowStrider Mising name is currently offline SlowStrider Mising name
Messages: 89
Registered: July 2009
Member
I have a TableViewer inside an Eclipse editor. When I am editing a cell and press the save button in the main toolbar or press ctrl-S, the cell editing does not deactivate so that the new value is not yet written to the model when I try to save my model which confuses the user.

The weird thing is that if I click any other cell, or any control inside the editor itself, the cell seems to lose focus and cell editing does get deactivated and the new value is written to the model. I also have the same TableViewer inside a preference page and the apply/ok buttons do not give this problem.

It seems that no focus lost event occurs when you click something in the main toolbar but it does occur when you click anything in the same editor window even another toolbar.

Is there any way to solve this problem, preferably without having to change my save command handler?



Some details which may be of importance:

I have set some cell editor/traversal strategies with code that I found in a JFace snippet. I know that this at least enables tab traversal/single click activation where I want it.


...
    ColumnViewerEditorActivationStrategy actSupport =
        new ColumnViewerEditorActivationStrategy(viewer) {

          protected boolean isEditorActivationEvent(
              ColumnViewerEditorActivationEvent event) {
            ViewerColumn viewerColumn =
                columns[((ViewerCell) event.getSource())
                    .getColumnIndex()];

            return event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL
                || (event.eventType == ColumnViewerEditorActivationEvent.MOUSE_CLICK_SELECTION && !doubleClickActivationMap
                    .get(viewerColumn))
                || event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION
                // This doesn't seem to work
                || (event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED && (event.keyCode == SWT.CR || event.keyCode == SWT.F2))
                || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC;
          }
        };

    TableViewerEditor.create(viewer, actSupport,
        ColumnViewerEditor.TABBING_HORIZONTAL
            | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR
            | ColumnViewerEditor.TABBING_VERTICAL
            | ColumnViewerEditor.KEYBOARD_ACTIVATION);

...

 
Read Message
Read Message
Previous Topic:How to view sources of internal plugins
Next Topic:Customizing Eclipse Wizards
Goto Forum:
  


Current Time: Sat May 18 12:22:14 EDT 2013

Powered by FUDForum. Page generated in 0.01741 seconds