Community
Participate
Working Groups
Build ID: I20070625-1500 please make the setFocusCell(ViewerCell focusCell) in TableViewerFocusCellManager public for programatically select a cell. i need this in my 3.3 recode for jinto (http://guh-software.de/jinto.html) especially in the search function, which should select the cell with the founded text. my workaround now is to override the class with my own in the same package. but this is a hack :-(
Instead of Opening this API. I'd like to add API like StructuredSelection to set the selected Cell from the outside. Something like: ColumnViewer#setSelection(new StructuredCellSelection()) If we make StructuredCellSelection extend from StructuredSelection you have access to this selection from anywhere you want. I think this would be the cleanest solution.
> If we make StructuredCellSelection extend from StructuredSelection you have > access to this selection from anywhere you want. I think this would be the > cleanest solution. > +1
is there a chance to get it into on of the next releases (3.3.1, 3.3.2)? i know it's more an enhancement than a bug but for me it's useless to have this cool new TableViewer/Cell Selection API if i can't select cell's programatically... also my hack (i described in the first comment) doesn't work, cause i get an IllegalAccessError on runtime when i override the friendly method setFocusCell :-(
(In reply to comment #3) > is there a chance to get it into on of the next releases (3.3.1, 3.3.2)? i know > it's more an enhancement than a bug but for me it's useless to have this cool > new TableViewer/Cell Selection API if i can't select cell's programatically... > also my hack (i described in the first comment) doesn't work, cause i get an > IllegalAccessError on runtime when i override the friendly method setFocusCell > :-( > No. New API is only added in new Major-Releases. May I suggest using Reflection!
> May I suggest using Reflection! sorry, what do you mean with this sentence?
i tried 'everything' to load/invoke the method using reflection. can you give me a tip how i can invoke the setFocusCell(ViewerCell focusCell) method from my class/plugin. i also found this comment: > The trick you tried (declaring a class in the same > package) does not work at runtime, because your class is loaded by a > different classloader (every plug-in has one) and so it is actually in a > different package (though they share the same name). so, is it generally possible to access the method from my overriding class?
Michael, have you tried calling java.lang.Method.setAccessible(true) ?
that works! :-) you made my day! thank's a lot!
no problem :)
Created attachment 90236 [details] work in progress ... started and a point to work on in future
have to delay for 3.5
removing 3.5
multi change because of intenion of stepping back as platform-ui committer
any news on this method: SWTFocusCellManager.setFocusCell(ViewerCell) How long until it's going to be public, I mean it's not a new API, it's 3 years old, just make it public and be done with it already.
Boris, do you think this is a small enough api change to slip it into M6 ?
I don't think this is simply an API change because you also have to trigger a SelectionChanged-Event. So there's a bit more involved than simply adding the public accessor!
Tom, thanks for the info! Adrian, we simply don't have the cycles at this point to address this. If you would like to submit a patch I'd be more than happy to go over it.
Is there any work around for this problem ? I am looking for a way to set focus on viewer cell that is part of table/tableviewer. I have tried all the following things that are commented out below and none of them work for me. ViewerCell currentCell = getCurrentViewerCell(); if (currentCell != null) { // tableViewer.getTable().showColumn( // tableViewer.getTable().getColumn( // currentCell.getColumnIndex())); // tableViewer.getTable().select( // currentCell.getColumnIndex()); // tableViewer.setSelection( // new StructuredSelection( // currentCell.getElement())); // TableViewerEditor tableViewerEditor = // (TableViewerEditor)tableViewer.getColumnViewerEditor(); // TableViewerFocusCellManager focusCellManager = // tableViewerEditor.getFocusCellManager(); // tableViewerEditor.forceFocusCell(currentCell, focusCellManager); // table.setFocus(); }
Created attachment 194897 [details] Snippet demonstrating workaround This is ugly but should work with older versions of JFace. You can try it as a workaround for now.
Boris, Thanks for providing the snippet with work around. It works for now.
Boris, Using the snippet that you provided with the work around, I need to do something like this: When I type on the keyboard a letter, the TextCellEditor (and its Control : an instance of Text) must be in editing mode and the key pressed which is the source of an event must have its value in the field. I modified the activation strategy to listen for any character entered as follows: ColumnViewerEditorActivationStrategy actSupport = new ColumnViewerEditorActivationStrategy(v) { protected boolean isEditorActivationEvent( ColumnViewerEditorActivationEvent event) { return event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL || event.eventType == ColumnViewerEditorActivationEvent.MOUSE_CLICK_SELECTION || (event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED && event.keyCode == SWT.F2) || (event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED && event.keyCode == SWT.CR) || (event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED && event.keyCode == SWT.KEYPAD_CR) || (event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED && Character.isSpaceChar(event.character)) || (event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED && event.keyCode > 31 && event.keyCode < 127) || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC; } }; Now with the above change, Lets say I am on the cell which has a character "A" and as soon as I enter any key (e.g. "Z") the cell changes into Edit mode but the text in the cell still appears to be "A" as opposed to "Z" which I expected. Am I missing something. How can this be accomplished ?
Hi, still this bug status is NEW ? (since 2007 oh, that's prehistoric! ). I've tested proposed workaround in eclipse 4.2.2, workaround didn't fix the problem: right cell is drawn focused but focus rectangle is stick at old row, then key up/down is applied to focus rectangle not to focused cell. I raise this defect again as I can see it in eclipse 4.2.2 on a CheckboxTreeViewer. Thanks.
No one is looking at this area at the moment, but I can have a look at a solid patch. See http://wiki.eclipse.org/Platform_UI/How_to_Contribute PW
Thanks for reply. No need, to work on this. As I found simple workaround that fit my needs: change backgorund of cell.
@Arnaud : Could you please elaborate on what you mean by "change backgorund of cell." ?? May be a pseudo-code will suffice.