Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Setting Cursor Position in TextEditor
Setting Cursor Position in TextEditor [message #482510] Wed, 26 August 2009 16:29 Go to next message
Eclipse UserFriend
I would like to set the cursor position in a class which extends
TextEditor.
This is how i tried to do this:
public void setOffset(int offset) {

setHighlightRange(offset,0,true);
}

I thought that eclipse that a highlight length of '0' would simply be
considered a cursor movement. Sometimes it works, but at other times it
doesn't. If i cincrease the length (middle arg), it also only works
sometimes. At other times, the cursor will not move. Looking at the code
of the setHighlightRange, it appears to call

fSourceViewer.setVisibleRegion(offset, length)

where fSourceView is an ISourceViewer. Setting the visible region does not
appear to be what i want....
Any ideas.
Thanks!
Re: Setting Cursor Position in TextEditor [message #482655 is a reply to message #482510] Thu, 27 August 2009 08:51 Go to previous message
Eclipse UserFriend
Seth wrote:
> I would like to set the cursor position in a class which extends
> TextEditor.
See: org.eclipse.ui.texteditor.ITextEditor.selectAndReveal(int, int).

Dani
> This is how i tried to do this:
> public void setOffset(int offset) {
> setHighlightRange(offset,0,true);
> }
>
> I thought that eclipse that a highlight length of '0' would simply be
> considered a cursor movement.Sometimes it works, but at other times it
> doesn't. If i cincrease the length (middle arg), it also only works
> sometimes. At other times, the cursor will not move. Looking at the
> code of the setHighlightRange, it appears to call
>
> fSourceViewer.setVisibleRegion(offset, length)
>
> where fSourceView is an ISourceViewer. Setting the visible region does
> not appear to be what i want....
> Any ideas.
> Thanks!
>
>
Previous Topic:Multiple Key Bindings to Single Action
Next Topic:TimeZone.getDefault() returns GMT
Goto Forum:
  


Current Time: Tue Jul 22 15:22:26 EDT 2025

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

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

Back to the top