Skip to content

Commit 61255f2

Browse files
committed
turn off file change detection (processing#2852)
1 parent 41c7cc3 commit 61255f2

File tree

4 files changed

+25
-45
lines changed

4 files changed

+25
-45
lines changed

app/src/processing/app/Editor.java

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2359,7 +2359,8 @@ protected boolean handleOpenInternal(String path) {
23592359
Base.showWarning("Error", "Could not create the sketch.", e);
23602360
return false;
23612361
}
2362-
if (Preferences.getBoolean("editor.watcher")) {
2362+
// Disabling for 3.0a4
2363+
if (false && Preferences.getBoolean("editor.watcher")) {
23632364
initFileChangeListener();
23642365
}
23652366

@@ -2397,12 +2398,11 @@ public void setWatcherSave() {
23972398
private void initFileChangeListener() {
23982399
try {
23992400
WatchService watchService = FileSystems.getDefault().newWatchService();
2400-
watcherKey = sketch
2401-
.getFolder()
2402-
.toPath()
2403-
.register(watchService, StandardWatchEventKinds.ENTRY_CREATE,
2404-
StandardWatchEventKinds.ENTRY_DELETE,
2405-
StandardWatchEventKinds.ENTRY_MODIFY);
2401+
Path sp = sketch.getFolder().toPath();
2402+
watcherKey = sp.register(watchService,
2403+
StandardWatchEventKinds.ENTRY_CREATE,
2404+
StandardWatchEventKinds.ENTRY_DELETE,
2405+
StandardWatchEventKinds.ENTRY_MODIFY);
24062406
} catch (IOException e) {
24072407
e.printStackTrace();
24082408
}
@@ -2460,8 +2460,9 @@ private void processFileEvents(List<WatchEvent<?>> events) {
24602460
for (WatchEvent<?> e : events) {
24612461
boolean sketchFile = false;
24622462
Path file = ((Path) e.context()).getFileName();
2463+
System.out.println(file);
24632464
for (String s : getMode().getExtensions()) {
2464-
//if it is a change to a file with a known extension
2465+
// if it is a change to a file with a known extension
24652466
if (file.toString().endsWith(s)) {
24662467
sketchFile = true;
24672468
break;
@@ -2472,11 +2473,11 @@ private void processFileEvents(List<WatchEvent<?>> events) {
24722473
continue;
24732474
}
24742475

2475-
int response = Base
2476-
.showYesNoQuestion(Editor.this,
2477-
"File Modified",
2478-
"Your sketch has been modified externally",
2479-
"Would you like to reload the sketch?");
2476+
int response =
2477+
Base.showYesNoQuestion(Editor.this,
2478+
"File Modified",
2479+
"Your sketch has been modified externally",
2480+
"Would you like to reload the sketch?");
24802481
if (response == 0) {
24812482
//grab the 'main' code in case this reload tries to delete everything
24822483
File sc = sketch.getMainFile();
@@ -2486,17 +2487,15 @@ private void processFileEvents(List<WatchEvent<?>> events) {
24862487
header.rebuild();
24872488
} catch (Exception f) {
24882489
if (sketch.getCodeCount() < 1) {
2489-
Base
2490-
.showWarning("Canceling Reload",
2491-
"You cannot delete the last code file in a sketch!");
2490+
Base.showWarning("Canceling Reload",
2491+
"You cannot delete the last code file in a sketch.");
24922492
//if they deleted the last file, re-save the SketchCode
24932493
try {
24942494
//make a blank file
24952495
sc.createNewFile();
24962496
} catch (IOException e1) {
24972497
//if that didn't work, tell them it's un-recoverable
2498-
Base.showError("Reload failed",
2499-
"The sketch contians no code files", e1);
2498+
Base.showError("Reload failed", "The sketch contains no code files", e1);
25002499
//don't try to reload again after the double fail
25012500
//this editor is probably trashed by this point, but a save-as might be possible
25022501
break;

app/src/processing/app/SingleInstance.java

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
/*
44
Part of the Processing project - http://processing.org
55
6+
Copyright (c) 2012-14 The Processing Foundation
67
Copyright (c) 2011-12 Ben Fry and Casey Reas
78
89
This program is free software; you can redistribute it and/or modify
@@ -54,7 +55,6 @@ public class SingleInstance {
5455
*/
5556
static boolean alreadyRunning(String[] args) {
5657
return Preferences.get(SERVER_PORT) != null && sendArguments(args);
57-
// sendArguments(args, 5000));
5858
}
5959

6060

@@ -125,41 +125,20 @@ public void run() {
125125

126126
static boolean sendArguments(String[] args) { //, long timeout) {
127127
try {
128-
//int port = Integer.parseInt(Preferences.get("server.port"));
129-
//String key = Preferences.get("server.key");
130128
int port = Preferences.getInteger(SERVER_PORT);
131129
String key = Preferences.get(SERVER_KEY);
132130

133-
// long endTime = System.currentTimeMillis() + timeout;
134-
//
135-
// Socket socket = null;
136-
// while (socket == null && System.currentTimeMillis() < endTime) {
137-
// try {
138-
// socket = new Socket(InetAddress.getByName(null), port);
139-
// } catch (Exception ioe) {
140-
// try {
141-
// Thread.sleep(50);
142-
// } catch (InterruptedException ie) {
143-
// Thread.yield();
144-
// }
145-
// }
146-
// }
147131
Socket socket = null;
148132
try {
149133
socket = new Socket(InetAddress.getByName(null), port);
150134
} catch (Exception ignored) { }
151135

152136
if (socket != null) {
153137
PrintWriter writer = PApplet.createWriter(socket.getOutputStream());
154-
// bw.write(key + "\n");
155138
writer.println(key);
156139
for (String arg : args) {
157-
// if (filename != null) {
158-
//// bw.write(filename + "\n");
159-
// writer.println(filename);
160140
writer.println(arg);
161141
}
162-
// bw.close();
163142
writer.flush();
164143
writer.close();
165144
return true;

core/todo.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
0231 core (3.0a4 or 3.0b1)
2-
_ TGAs created with saveFrame() have an alpha channel, which breaks Movie Maker
3-
_ https://github.com/processing/processing/issues/2851
42

53

64
applet/component

todo.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ X make a new preference setting for the default mode
1111
X this will set folks to the PDE X mode, and prevent conflicts w/ 2.0
1212
X change last.sketch.mode to mode.last
1313
X fix OS X default File menu to be the same order as the other File menu
14+
X TGAs from saveFrame() create transparent/black movies with Movie Maker
15+
X https://github.com/processing/processing/issues/2851
1416

1517

1618
before launch
@@ -41,10 +43,9 @@ _ check on pull for mnemonics
4143
_ https://github.com/processing/processing/pull/2382
4244

4345

44-
_ remove toolbar menu references and code to rebuild
45-
46-
4746
high
47+
_ "Your sketch has been modified externally" appear without reason
48+
_ https://github.com/processing/processing/issues/2852
4849
_ export application ubuntu -> windows not working (2.2.1)
4950
_ https://github.com/processing/processing/issues/2698
5051
_ might be something with libraries (native or otherwise)
@@ -93,6 +94,9 @@ _ https://github.com/processing/processing/issues/2199
9394

9495

9596
medium
97+
_ remove toolbar menu references and code to rebuild
98+
_ fix single instance server on OS X to load double-clicked files
99+
_ when run from Eclipse, the single instance thing punts
96100
_ 'recent' menu needs to recognize the p5 app folder
97101
_ also should recognize the user's home dir
98102
_ possibility of libraries folder inside a particular sketch?

0 commit comments

Comments
 (0)