Setting Cursor Position in TextEditor [message #482510] |
Wed, 26 August 2009 16:29  |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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!
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03755 seconds