Search in sources :

Example 1 with DoAutomaticSave

use of org.freeplane.features.url.mindmapmode.DoAutomaticSave in project freeplane by freeplane.

the class MMapModel method scheduleTimerForAutomaticSaving.

public void scheduleTimerForAutomaticSaving() {
    if (!(UrlManager.getController() instanceof MFileManager)) {
        return;
    }
    final int numberOfTempFiles = Integer.parseInt(ResourceController.getResourceController().getProperty("number_of_different_files_for_automatic_save"));
    if (numberOfTempFiles == 0) {
        return;
    }
    final boolean filesShouldBeDeletedAfterShutdown = ResourceController.getResourceController().getBooleanProperty("delete_automatic_saves_at_exit");
    final int delay = ResourceController.getResourceController().getTimeProperty("time_for_automatic_save");
    if (delay == 0) {
        return;
    }
    final boolean useSingleBackupDirectory = ResourceController.getResourceController().getBooleanProperty("single_backup_directory");
    final String singleBackupDirectory = ResourceController.getResourceController().getProperty("single_backup_directory_path");
    final Timer timer = SysUtils.createTimer("TimerForAutomaticSaving");
    timer.schedule(new DoAutomaticSave(this, numberOfTempFiles, filesShouldBeDeletedAfterShutdown, useSingleBackupDirectory, singleBackupDirectory), delay, delay);
    this.setTimerForAutomaticSaving(timer);
}
Also used : Timer(java.util.Timer) MFileManager(org.freeplane.features.url.mindmapmode.MFileManager) DoAutomaticSave(org.freeplane.features.url.mindmapmode.DoAutomaticSave)

Aggregations

Timer (java.util.Timer)1 DoAutomaticSave (org.freeplane.features.url.mindmapmode.DoAutomaticSave)1 MFileManager (org.freeplane.features.url.mindmapmode.MFileManager)1