mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
make autosave params configurable
This commit is contained in:
@@ -2,4 +2,5 @@
|
|||||||
#org.diylc.presenter.InstantiationManager.MAX_RECENT_COMPONENTS=20
|
#org.diylc.presenter.InstantiationManager.MAX_RECENT_COMPONENTS=20
|
||||||
#org.diylc.swing.plugins.canvas.CanvasPanel.USE_HARDWARE_ACCELLERATION=true
|
#org.diylc.swing.plugins.canvas.CanvasPanel.USE_HARDWARE_ACCELLERATION=true
|
||||||
#org.diylc.swingframework.ruler.Ruler.USE_HARDWARE_ACCELLERATION=true
|
#org.diylc.swingframework.ruler.Ruler.USE_HARDWARE_ACCELLERATION=true
|
||||||
#org.diylc.swing.gui.editor.PropertyEditorDialog.SHOW_DEFAULT_BOXES=true
|
#org.diylc.swing.gui.editor.PropertyEditorDialog.SHOW_DEFAULT_BOXES=true
|
||||||
|
#org.diylc.swing.plugins.autosave.AutoSavePlugin.MAX_TOTAL_SIZE_MB=64
|
||||||
@@ -44,8 +44,8 @@ public class AutoSavePlugin implements IPlugIn {
|
|||||||
|
|
||||||
private static final Logger LOG = Logger.getLogger(AutoSavePlugin.class);
|
private static final Logger LOG = Logger.getLogger(AutoSavePlugin.class);
|
||||||
|
|
||||||
protected static final long autoSaveFrequencyMs = 60 * 1000;
|
public static long BACKUP_FREQ_MS = 60 * 1000;
|
||||||
protected static final int maxTotalSizeMb = 64;
|
public static int MAX_TOTAL_SIZE_MB = 64;
|
||||||
|
|
||||||
private ExecutorService executor;
|
private ExecutorService executor;
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ public class AutoSavePlugin implements IPlugIn {
|
|||||||
@Override
|
@Override
|
||||||
public void processMessage(EventType eventType, Object... params) {
|
public void processMessage(EventType eventType, Object... params) {
|
||||||
if (eventType == EventType.PROJECT_MODIFIED) {
|
if (eventType == EventType.PROJECT_MODIFIED) {
|
||||||
if (System.currentTimeMillis() - lastSave > autoSaveFrequencyMs) {
|
if (System.currentTimeMillis() - lastSave > BACKUP_FREQ_MS) {
|
||||||
executor.execute(new Runnable() {
|
executor.execute(new Runnable() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -124,7 +124,7 @@ public class AutoSavePlugin implements IPlugIn {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
long totalSize = 0;
|
long totalSize = 0;
|
||||||
long maxTotalSize = maxTotalSizeMb * 1024 * 1024;
|
long maxTotalSize = MAX_TOTAL_SIZE_MB * 1024 * 1024;
|
||||||
for (File f : files)
|
for (File f : files)
|
||||||
totalSize += f.length();
|
totalSize += f.length();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|||||||
@@ -2636,7 +2636,7 @@
|
|||||||
</org.diylc.appframework.update.Change>
|
</org.diylc.appframework.update.Change>
|
||||||
<org.diylc.appframework.update.Change>
|
<org.diylc.appframework.update.Change>
|
||||||
<changeType>NEW_FEATURE</changeType>
|
<changeType>NEW_FEATURE</changeType>
|
||||||
<description>Auto-save plugin now works by periodically creating project backups in user\.diylc\autoSave directory and maintains file history, keeping the last X versions of the file. Maximum size for all backups is configurable and pre-set to 64MB</description>
|
<description>Auto-save plugin now works by periodically creating project backups in user\.diylc\autoSave directory and maintains file history, keeping the last X versions of the file. Maximum size for all backups combined is configurable and pre-set to 64MB</description>
|
||||||
</org.diylc.appframework.update.Change>
|
</org.diylc.appframework.update.Change>
|
||||||
<org.diylc.appframework.update.Change>
|
<org.diylc.appframework.update.Change>
|
||||||
<changeType>IMPROVEMENT</changeType>
|
<changeType>IMPROVEMENT</changeType>
|
||||||
|
|||||||
Reference in New Issue
Block a user