OutlineView [message #879523] |
Thu, 31 May 2012 07:11  |
Eclipse User |
|
|
|
Hello,
I have a plugin where I programmatically position the Outline view to the cursorposition in the editor (after a cursormove or mouseposition).
I do this by determining the specific TreeViewItem object, and perform a :
prvTreeViewer.setSelection(new StructuredSelection(lcObjectToSelect), false);
This statement however goes to (and selects) the piece of text where the TreeViewItem relates to ... whereas I want to keep the cursor where it is, and don't have the editor repositioned, or redrawn etc at all.
I already tried :
prvTreeViewer.setSelection(new StructuredSelection(lcObjectToSelect), true);
and
prvTreeViewer.setSelection(new StructuredSelection(lcObjectToSelect);
result is the same.
I already tried saving the offset, and after the setSelection position again on the offset ... this also result in "movements" on the editor (it sometimes goes up or down) ... so not ideal.
So ... how do I select a TreeViewItem programmatically with the editor NOT changing at all (regarding cursorposition and visible lines of code) ?
Thanks.
|
|
|
Re: OutlineView [message #881594 is a reply to message #879523] |
Mon, 04 June 2012 18:00  |
Eclipse User |
|
|
|
On 5/31/2012 7:11 AM, Kitesurfer Mising name wrote:
> Hello,
> I have a plugin where I programmatically position the Outline view to
> the cursorposition in the editor (after a cursormove or mouseposition).
> I do this by determining the specific TreeViewItem object, and perform a :
> prvTreeViewer.setSelection(new StructuredSelection(lcObjectToSelect),
> false);
>
> This statement however goes to (and selects) the piece of text where the
> TreeViewItem relates to ... whereas I want to keep the cursor where it
> is, and don't have the editor repositioned, or redrawn etc at all.
> I already tried :
> prvTreeViewer.setSelection(new StructuredSelection(lcObjectToSelect),
> true);
> and
> prvTreeViewer.setSelection(new StructuredSelection(lcObjectToSelect);
> result is the same.
>
> I already tried saving the offset, and after the setSelection position
> again on the offset ... this also result in "movements" on the editor
> (it sometimes goes up or down) ... so not ideal.
>
> So ... how do I select a TreeViewItem programmatically with the editor
> NOT changing at all (regarding cursorposition and visible lines of code) ?
Debug it down to the point where the cursor is moved; I expect you'll
find that your source editor is still listening to tree selections while
it's applying the selection to the tree.
--
---
Nitin Dahyabhai
Eclipse WTP Source Editing and JSDT
IBM Rational
|
|
|
Powered by
FUDForum. Page generated in 0.03111 seconds