Skip to content
This repository was archived by the owner on Oct 4, 2019. It is now read-only.

Commit 6f52073

Browse files
committed
fixes, tidying things up for auto save
1 parent 5fdd88b commit 6f52073

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

src/processing/mode/experimental/AutoSaveUtil.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public File getPastSave(){
6161
}
6262

6363
public void init(){
64-
if(saveTime < 1000) return;
64+
if(saveTime < 10000) saveTime = 10 * 1000;
6565
//saveTime = 10 * 1000; //TODO: remove
6666
timer = new Timer();
6767
timer.schedule(new SaveTask(), saveTime, saveTime);
@@ -76,6 +76,7 @@ public void stop(){
7676
}
7777

7878
private boolean saveSketch() throws IOException{
79+
if(!editor.getSketch().isModified()) return false;
7980
isSaving = true;
8081
Sketch sc = editor.getSketch();
8182

@@ -224,8 +225,8 @@ private class SaveTask extends TimerTask{
224225
@Override
225226
public void run() {
226227
try {
227-
saveSketch();
228-
ExperimentalMode.log("Backup Saved " + editor.getSketch().getMainFilePath());
228+
if(saveSketch())
229+
ExperimentalMode.log("Backup Saved " + editor.getSketch().getMainFilePath());
229230
} catch (IOException e) {
230231
// TODO Auto-generated catch block
231232
e.printStackTrace();

src/processing/mode/experimental/DebugEditor.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ public void actionPerformed(ActionEvent e) {
245245
ta.setECSandThemeforTextArea(errorCheckerService, dmode);
246246
addXQModeUI();
247247
debugToolbarEnabled = new AtomicBoolean(false);
248-
log("Sketch Path: " + path);
248+
log("Sketch Path: " + path);
249249
}
250250

251251
private void addXQModeUI(){
@@ -737,7 +737,6 @@ protected boolean handleOpenInternal(String path) {
737737
if(autosaver != null)
738738
autosaver.stop();
739739
loadAutoSaver();
740-
//System.out.println("LOADDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD");
741740
return didOpen;
742741
}
743742

@@ -878,10 +877,11 @@ public boolean handleSaveAs() {
878877
}
879878

880879
public void loadAutoSaver(){
880+
log("Load Auto Saver()");
881881
if(autosaver != null){
882882
autosaver.stop();
883883
}
884-
autosaver = new AutoSaveUtil(this, dmode.autoSaveInterval);
884+
autosaver = new AutoSaveUtil(this, ExperimentalMode.autoSaveInterval);
885885
if(!autosaver.checkForPastSave()) {
886886
autosaver.init();
887887
return;

src/processing/mode/experimental/ExperimentalMode.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ public File[] getKeywordFiles() {
119119

120120
volatile public static boolean errorCheckEnabled = true, warningsEnabled = true,
121121
codeCompletionsEnabled = true, debugOutputEnabled = false, errorLogsEnabled = false;
122-
public int autoSaveInterval = 5; //in minutes
122+
public static int autoSaveInterval = 5; //in minutes
123123

124-
public final String prefErrorCheck = "pdex.errorCheckEnabled",
124+
public static final String prefErrorCheck = "pdex.errorCheckEnabled",
125125
prefWarnings = "pdex.warningsEnabled",
126126
prefCodeCompletionEnabled = "pdex.ccEnabled",
127127
prefDebugOP = "pdex.dbgOutput", prefErrorLogs = "pdex.writeErrorLogs", prefAutoSaveInterval = "pdex.autoSaveInterval";

0 commit comments

Comments
 (0)