Switched ChangeDetector to use the last modified times from processing (when the file was last saved or loaded) and compare with the system's last modified time. Added supporting code in SketchCode to get these times. Added a tiny fix in Sketch to allow processing to actually start

This commit is contained in:
Patrick Vares
2015-01-29 18:39:29 -05:00
parent 26d3bccc68
commit 0a94239a38
3 changed files with 6 additions and 6 deletions

View File

@@ -14,7 +14,8 @@ public class ChangeDetector implements WindowFocusListener {
private Editor editor;
// private boolean enabled = true;
private boolean enabled = false; // broken on OS X
//REMOVE on for testing
private boolean enabled = true; // broken on OS X
private boolean skip = false;
@@ -39,9 +40,6 @@ public class ChangeDetector implements WindowFocusListener {
}
private void checkFileChangeAsync() {
if(1==1){
return;
}
Thread th = new Thread(new Runnable() {
@Override
public void run() {
@@ -159,7 +157,7 @@ public class ChangeDetector implements WindowFocusListener {
reloadSketch(sc);
return;
}
//if a file's tab was visited after the file was
//if a file's tab was saved before the file was
if (sketchFile.lastModified() > sc.lastModified()) {
reloadSketch(sc);
return;

View File

@@ -1210,12 +1210,13 @@ public class Sketch {
current = code[which];
currentIndex = which;
current.visited = System.currentTimeMillis();
//REMOVE
try {
editor.setCode(current);
// editor.header.rebuild();
editor.header.repaint();
} catch (NullPointerException e) {
e.printStackTrace();
//e.printStackTrace();
}
}

View File

@@ -296,6 +296,7 @@ public class SketchCode {
System.err.println();
}
lastModified = file.lastModified();
setModified(false);
}