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 11:15 Go to next message
Jamel G. is currently offline Jamel G.
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 11:38 Go to previous messageGo to next message
Jamel G. is currently offline Jamel G.
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 11:46]

Report message to a moderator

Re: TreeViewer Selection problem with ColumnViewerEditorActivationStrategy [message #666507 is a reply to message #666493] Wed, 20 April 2011 11:27 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5230
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 11:58 Go to previous message
Jamel G. is currently offline Jamel G.
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 17:45]

Report message to a moderator

Previous Topic:TreeViewer with checkboxes
Next Topic:Zest status
Goto Forum:
  


Current Time: Wed Jul 23 20:24:21 EDT 2014

Powered by FUDForum. Page generated in 0.01500 seconds