Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Remember the scroll bar position in a TextEditor(I need to remember and restore the scroll bar position in a TextEditor when the contents are saved)
Remember the scroll bar position in a TextEditor [message #644697] Mon, 13 December 2010 19:49 Go to next message
TK Gospodinov is currently offline TK GospodinovFriend
Messages: 5
Registered: July 2009
Location: Kansas City, MO
Junior Member
I've implemented a code editor for Eclipse that works great, but whenever I save its contents it puts the cursor and scrolls to the top. I want to remember the cursor and scroll bar position when the editor contents are saved just like the Eclipse Java editor does. I overrode AbstractTextEditor#performSave, AbstractTextEditor#performSaveAs, and AbstractTextEditor#editorSaved, calling AbstractTextEditor#rememberSelection and AbstractTextEditor#restoreSelection as a workaround. That saves the selection, but not the scroll position. I bet the framework can handle that, but I can't figure out how. Please help.
Re: Remember the scroll bar position in a TextEditor [message #644852 is a reply to message #644697] Tue, 14 December 2010 13:13 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
TK Gospodinov wrote:
> I've implemented a code editor for Eclipse that works great, but
> whenever I save its contents it puts the cursor and scrolls to the
> top. I want to remember the cursor and scroll bar position when the
> editor contents are saved just like the Eclipse Java editor does. I
> overrode AbstractTextEditor#performSave,
> AbstractTextEditor#performSaveAs, and AbstractTextEditor#editorSaved,
> calling AbstractTextEditor#rememberSelection and
> AbstractTextEditor#restoreSelection as a workaround. That saves the
> selection, but not the scroll position. I bet the framework can handle
> that, but I can't figure out how. Please help.
Saving should not change the current selection. I assume that you do
something wrong when saving the file e.g. setting the editor's
input/document or something like that.

Dani
Re: Remember the scroll bar position in a TextEditor [message #644941 is a reply to message #644852] Tue, 14 December 2010 21:42 Go to previous message
TK Gospodinov is currently offline TK GospodinovFriend
Messages: 5
Registered: July 2009
Location: Kansas City, MO
Junior Member
Thanks for your reply. I don't have any custom code around saving the files, it's all handled by the framework.
Previous Topic:Menu visibility control
Next Topic:Software update does not update properly on Windows
Goto Forum:
  


Current Time: Thu Apr 25 04:51:34 GMT 2024

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

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

Back to the top