Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » OutlineView(setSelection issue)
OutlineView [message #879523] Thu, 31 May 2012 11:11 Go to next message
Kitesurfer () is currently offline Kitesurfer ()Friend
Messages: 87
Registered: December 2009
Member
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 22:00 Go to previous message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4435
Registered: July 2009
Senior Member

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


_
Nitin Dahyabhai
Eclipse Web Tools Platform
Previous Topic:Run eclipse quickfix on a java source code using java program
Next Topic:.xcarchive and .app files are shown as folders in Package explorer.
Goto Forum:
  


Current Time: Fri Apr 26 14:00:55 GMT 2024

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

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

Back to the top