Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » TreeViewer Selection problem with ColumnViewerEditorActivationStrategy
TreeViewer Selection problem with ColumnViewerEditorActivationStrategy [message #666493] Wed, 20 April 2011 15:15 Go to next message
Jamel G. is currently offline Jamel G.Friend
Messages: 12
Registered: April 2011
Junior Member
Hello,

I have a treeviewer in which i'm using cell edition in TreeViewerColumn and when I activate the below code treeviewer.setselection is not working and when i remove the code the selection is working fine.
TreeViewerFocusCellManager focusCellManager = new TreeViewerFocusCellManager(treeViewer, new FocusCellOwnerDrawHighlighter(treeViewer));
ColumnViewerEditorActivationStrategy actSupport = new ColumnViewerEditorActivationStrategy(treeViewer) {
protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event) {
return event.keyCode == SWT.F2;
}
};

TreeViewerEditor.create(treeViewer, focusCellManager, actSupport, ColumnViewerEditor.TABBING_HORIZONTAL | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR | ColumnViewerEditor.TABBING_VERTICAL | ColumnViewerEditor.KEYBOARD_ACTIVATION);


Plz help
Re: TreeViewer Selection problem with ColumnViewerEditorActivationStrategy [message #666503 is a reply to message #666493] Wed, 20 April 2011 15:38 Go to previous messageGo to next message
Jamel G. is currently offline Jamel G.Friend
Messages: 12
Registered: April 2011
Junior Member
After investigation I have found the solution:
				Object selection = ((IStructuredSelection) sel).getFirstElement();
				if (selection instanceof MyObject) {
					treeViewer.setSelection(new StructuredSelection(selection), true);
					ViewerCell cell = treeViewer.getColumnViewerEditor().getFocusCell();
				}


And the selection is shown.

[Updated on: Wed, 20 April 2011 15:46]

Report message to a moderator

Re: TreeViewer Selection problem with ColumnViewerEditorActivationStrategy [message #666507 is a reply to message #666493] Wed, 20 April 2011 15:27 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
The owner draw highlighter remove the selection information using owner
draw.

Tom

Am 20.04.11 17:15, schrieb Jamel:
> Hello,
>
> I have a treeviewer in which i'm using cell edition in TreeViewerColumn
> and when I activate the below code treeviewer.setselection is not
> working and when i remove the code the selection is working fine.
> TreeViewerFocusCellManager focusCellManager = new
> TreeViewerFocusCellManager(treeViewer, new
> FocusCellOwnerDrawHighlighter(treeViewer));
> ColumnViewerEditorActivationStrategy actSupport = new
> ColumnViewerEditorActivationStrategy(treeViewer) {
> protected boolean
> isEditorActivationEvent(ColumnViewerEditorActivationEvent event) {
> return event.keyCode == SWT.F2;
> }
> };
>
> TreeViewerEditor.create(treeViewer, focusCellManager, actSupport,
> ColumnViewerEditor.TABBING_HORIZONTAL |
> ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR |
> ColumnViewerEditor.TABBING_VERTICAL |
> ColumnViewerEditor.KEYBOARD_ACTIVATION);
>
> Plz help
Re: TreeViewer Selection problem with ColumnViewerEditorActivationStrategy [message #666512 is a reply to message #666507] Wed, 20 April 2011 15:58 Go to previous message
Jamel G. is currently offline Jamel G.Friend
Messages: 12
Registered: April 2011
Junior Member
Yes thank you Tom.

The selection is there, it's just not highlighted.

I will extend FocusCellHighlighter and enable the highlight of the selection.

[Updated on: Wed, 20 April 2011 21:45]

Report message to a moderator

Previous Topic:Zest status
Next Topic:Global Validator Before Loading UI
Goto Forum:
  


Current Time: Fri Mar 29 14:54:22 GMT 2024

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

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

Back to the top