Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Automatically saving content while typing best approach opinions needed.
Automatically saving content while typing best approach opinions needed. [message #299945] Tue, 28 February 2006 07:12 Go to next message
Eclipse UserFriend
Originally posted by: eclipse.bettsockentraeger.de

Hello,

I'm currently writing a small note taking plugin for myself. It
basically is just a note taker. Now I don't want this to obey to the
normal editor lifecycle of saving rather I want the content to be saved
as the content is entered into the editor to prevent data loss during
crashes.
The problem I'm having is what strategy is best to save the content.
Using an input listener and saving on each stroke seems to be a
performance hog and doesn't seem to be very scalable.
So I have made out the following two alternatives:
1. Saving periodically in a background thread. Like every second or
every minute (customizable with a preference page) This does not
prevent dataloss in case of a crash but minimizes it.
2. Save on certain characters which denote line endings, word endings.
This can become problematic since this will be language specific I
imagine. Not sure if chinese or japanese use '.', \n and the like. Is a
whitespace universially understood in all languages? I'm also not sure
if using wordboundaries as save marks does not result in too many save
operations if a user is a fast typer.

So what do you think? What is the best approach to this problem? Do you
have any other alternatives I haven't come up with yet?

Best regards
and thanks for any help

Stefan
Re: Automatically saving content while typing best approach opinions needed. [message #299949 is a reply to message #299945] Tue, 28 February 2006 07:44 Go to previous messageGo to next message
Eclipse UserFriend
You can combine your option 1) with the ISaveablePart interface.

Schedule a job to run every minute, and have it's run method something like:

public void run() {
if (myNoteEditor.isDirty()) {
display.asyncExec(new Runnable() {
public void run() {
if (myNoteEditor.isDirty()) {
myNoteEditor.doSave(SomeNullProgressMonitor);
}
}
});
}
}
Re: Automatically saving content while typing best approach opinions needed. [message #300140 is a reply to message #299945] Thu, 02 March 2006 13:27 Go to previous message
Eclipse UserFriend
Originally posted by: douglas.pollock.magma.ca

Stefan Langer wrote:
> I'm currently writing a small note taking plugin for myself. It
> basically is just a note taker. Now I don't want this to obey to the
> normal editor lifecycle of saving rather I want the content to be saved
> as the content is entered into the editor to prevent data loss during
> crashes.

You can also take a look at the work on Bug 34076.



cheers,
d.
Previous Topic:How to update the preferences page?
Next Topic:about org.eclipse.help.* extension points
Goto Forum:
  


Current Time: Tue Jul 15 04:09:02 EDT 2025

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

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

Back to the top