Bug 239770

Summary: [CellEditors] [Viewers] ColumnViewerEditorActivationListener: Provide the reason for an ICellEditorListener#apply/cancel call
Product: [Eclipse Project] Platform Reporter: H. Steenblock <steenblock>
Component: UIAssignee: Platform UI Triaged <platform-ui-triaged>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3 CC: bokowski, te, tom.schindl
Version: 3.3.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Code shows our usage of the ColumnViewerEditorActivationListener none

Description H. Steenblock CLA 2008-07-07 05:10:28 EDT
Created attachment 106698 [details]
Code shows our usage of the ColumnViewerEditorActivationListener

We have to implement a table cell editing mode like Excel does: Change to the next cell below current cell after a CR is pressed.
In the newsgroup Tom Schindl wrotes, that the ICellEditorListener has to be extended.

Please see the attached snippet and the newsgroup conversation.


----------------

Hm,

Yes the listener is appropiate one. The problem is that the CellEditor doesn't inform the ICellEditorListener why the apply/cancle has happend.

There are 2 possibilities:
- because of a focus lost
- because of a default selection

I see that you are subclassing TextCellEditor (which is not supported but well many people do that).

I think you'll need to overload:

CellEditor#keyReleaseOccured(KeyEvent keyEvent)
TextCellEditor#handleDefaultSelection(SelectionEvent event)

It could look like this:

protected void keyReleaseOccured(KeyEvent keyEvent) {
    if(keyEvent.character == '\r') {
       // set global flag to true
    }
    super.keyReleaseOccured(keyEvent);
    if(keyEvent.character == '\r') {
       // set global flag to false
    }
}


The you'll check the global flag in the ColumnViewerEditorActivationListener and activate the next CellEditor using a Display#asyncExec() call. The asyncExec() is need else you'll activate the next editor before the shutdown for the next one has been completed!

Could you please file a bug, attach the snippet and ask whether we could make our API provide the reason for a ICellEditorListener#apply/cancle call.

Tom

H. Steenblock schrieb:
> Dear Community,
>
> we have to implement a table cell editing mode like Excel does:
> 1. activating the cell editor with any numeric key
> 2. set the used key in the current cell
> 3. changing to the next cell below current cell when a CR is pressed.
>
> I prepared a code snippet. Topic 1 and 2 are mostly working, but it isn't clear how to solve 3. (using a olumnViewerEditorActivationListener ??).
>
> Any comments are welcome. Maybe we can use this snippet as a starter for an additional JFaceSnippet.
>
> Regards,
> H. Steenblock
Comment 1 Thomas Schindl CLA 2010-01-28 17:11:17 EST
multi change because of intenion of stepping back as platform-ui committer
Comment 2 Eclipse Webmaster CLA 2019-09-06 16:09:16 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.