Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Difficult SourceViewer behaviour
Difficult SourceViewer behaviour [message #460198] Sun, 17 December 2006 18:41 Go to next message
Eclipse UserFriend
Originally posted by: florianwendland.freenet.de

Hello all,
I have some difficult questions for the handling of an SourceViewer.
IMHO, there are difficulty.

1. I didn't want the cursor to be set to the index 0 when i add a new
document. In my rcp, were able to edit an document shared, so that one
user can write in the first line und one in the last. The reseting of
the cursor on the index 0 is not good for this application.

2. If the document is larger than the visible region of the Viewer, and
a changing is processed underneath the visible area, the document
alllways jumps to index 0 and not the the newly computed cursor index.
For setting the cursor, I used this:

theEditor.setCaretOffset(caret); //may be last line

So, if one character underneath the visible region was inserted, the
visisble area allways begins with line 0 (index 0), but the caret was
set to linbe 470, for example.

Is it possible to get this behaviour for an SourceViewer? May i have to
subclass the SourceViewer to implement the behaviour on my own?

Thx
Florian
Re: Difficult SourceViewer behaviour [message #460212 is a reply to message #460198] Mon, 18 December 2006 03:34 Go to previous message
Eclipse UserFriend
Florian Wendland wrote:

> Hello all,
> I have some difficult questions for the handling of an SourceViewer.
> IMHO, there are difficulty.
>
> 1. I didn't want the cursor to be set to the index 0 when i add a new
> document. In my rcp, were able to edit an document shared, so that one
> user can write in the first line und one in the last. The reseting of
> the cursor on the index 0 is not good for this application.

Your editor or viewer is free to set the caret somewhere when a new
document is set.

>
> 2. If the document is larger than the visible region of the Viewer,
> and a changing is processed underneath the visible area, the document
> alllways jumps to index 0 and not the the newly computed cursor index.
> For setting the cursor, I used this:
>
> theEditor.setCaretOffset(caret); //may be last line

There is no such method in the text editor hierarchy. And as you can see
e.g. in the Java editor the caret doesn't jump to 0 when a method
outside the viewport is removed via Package Explorer.

Dani

>
> So, if one character underneath the visible region was inserted, the
> visisble area allways begins with line 0 (index 0), but the caret was
> set to linbe 470, for example.
>
> Is it possible to get this behaviour for an SourceViewer? May i have
> to subclass the SourceViewer to implement the behaviour on my own?

>
> Thx
> Florian
Previous Topic:Project Natures/Builders
Next Topic:listening to preference changes
Goto Forum:
  


Current Time: Tue Apr 15 05:36:30 EDT 2025

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

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

Back to the top