mirror of
https://github.com/processing/processing4.git
synced 2026-02-11 17:40:48 +01:00
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:
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -296,6 +296,7 @@ public class SketchCode {
|
||||
System.err.println();
|
||||
}
|
||||
|
||||
lastModified = file.lastModified();
|
||||
setModified(false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user