Skip to main content



      Home
Home » Eclipse Projects » JFace » Re: TableViewer Selectiona nd Focus out of synch
Re: TableViewer Selectiona nd Focus out of synch [message #15306] Thu, 18 June 2009 09:53 Go to next message
Eclipse UserFriend
Please follow up on JFace-newsgroup.

Tom

Tom Schindl schrieb:
> Rainer Rieder schrieb:
>> I recon by the lack of replies that either I didn't ask right/polite
>> enough or that the topic is farely complex.
>>
>> I just presume the later and tell what I found out so far:
>>
>> 1. I forgot to mention that my CellEditor ist activated by every numeric
>> or alphanumeric input in the EditorActivationStrategy. I think this is
>> vital to reproduce the problem. In my Application the first coulmn is
>> input enabled and can be used to mark records witrh different chars (
>> e.g. 'x' == Delete this record ).
>>
>>
>> protected boolean
>> isEditorActivationEvent(ColumnViewerEditorActivationEvent event) {
>> return event.eventType ==
>> ColumnViewerEditorActivationEvent.TRAVERSAL
>> || (event.eventType ==
>> ColumnViewerEditorActivationEvent.MOUSE_CLICK_SELECTION &&
>> (((MouseEvent)event.sourceEvent).button == 1))
>> || (event.eventType ==
>> ColumnViewerEditorActivationEvent.KEY_PRESSED
>> && ((event.keyCode >= 'a' && event.keyCode <=
>> 'z')||
>> (event.keyCode >= '0' && event.keyCode <=
>> '9') ||
>> (event.keyCode == ' ') ||
>> (event.keyCode == SWT.BS) ||
>> (event.keyCode == SWT.DEL))) ||
>> event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC;
>> }
>>
>> 2. If I take out the SWT.VIRTUAL from the table ( and the
>> ILazyContentprovider from the Model ) a similar Problem occures:
>> Suppose I have the First Table-Column Edit-Enabled and I mark row 1 with
>> an 'x' ( just by typing x on the cell). Then I press TAB to move to the
>> Cell below and type 'x' to mark row 2: the Cell goes into edit-mode, but
>> afterward the table-control additionaly searches the column for the
>> first appearance of x which selects row 1 again although in edit-mode in
>> row 2.
>> This behaviour is diffrent from the original problem with SWT.VIRTUAL
>> and can be eliminated by overwriting
>> setEnableEditorActivationWithKeyboard in
>> ColumnViewerEditorActivationStrategy ( I had to use reflection on
>> ColumnViewer.triggerEditorActivationEvent ). When the KeyEvent ist
>> consumed ( by event.doit = false ) after activation, the table-control
>> does not search for a cell-value with the typed char.
>>
>>
>>
>>
>
> Why did you have to do that. Why are you not using the key event passed
> into the strategy and cancel it there?
>
> ------8<------
> ColumnViewerEditorActivationStrategy actSupport =
> new ColumnViewerEditorActivationStrategy(v) {
> protected boolean isEditorActivationEvent(
> ColumnViewerEditorActivationEvent event) {
>
> if( event.sourceEvent instanceof KeyEvent ) {
> ((KeyEvent)event.sourceEvent).doit = false;
> }
>
> // ....
> ------8<------
>
> Tom
Re: TableViewer Selectiona nd Focus out of synch [message #15373 is a reply to message #15306] Fri, 19 June 2009 07:47 Go to previous messageGo to next message
Eclipse UserFriend
Thank you for the code-snipped that's a much more elegant approach. I
didn't think that I could influence the Event-Execution in the
"isEditorActivationEvent" Method.

I'm going to have an eye on bug 263427 ( maybe try to investigate if I can
find the time ). So far all the tests have prooven to work with a
reasonable performance without the VIRTUAL-Flag on.
Re: TableViewer Selectiona nd Focus out of synch [message #15406 is a reply to message #15373] Fri, 19 June 2009 07:55 Go to previous message
Eclipse UserFriend
Hi,

IIRC the reason we can't use setSelection() is that this would is a
greedy operation and would make VIRTUAL probably useable because if you
set the selection to table.setSelection(table.getItemCount()-1) we would
materialize the whole table :-(

The SWT problem is described here:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=255855

Tom

Rainer Rieder schrieb:
> Thank you for the code-snipped that's a much more elegant approach. I
> didn't think that I could influence the Event-Execution in the
> "isEditorActivationEvent" Method.
>
> I'm going to have an eye on bug 263427 ( maybe try to investigate if I
> can find the time ). So far all the tests have prooven to work with a
> reasonable performance without the VIRTUAL-Flag on.
>
Previous Topic:Re: TableViewer Selectiona nd Focus out of synch
Next Topic:Problem with scrollbar after ScrolledForm relayout
Goto Forum:
  


Current Time: Thu Mar 13 13:56:19 EDT 2025

Powered by FUDForum. Page generated in 0.02275 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top