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 14:49 Go to next message
TK Gospodinov is currently offline TK Gospodinov
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 08:13 Go to previous messageGo to next message
Dani Megert is currently offline Dani Megert
Messages: 3801
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 16:42 Go to previous message
TK Gospodinov is currently offline TK Gospodinov
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 Jul 24 11:35:05 EDT 2014

Powered by FUDForum. Page generated in 0.02155 seconds