Skip to content

Commit 041a157

Browse files
Remove Editor.stopHandler
This handler was only always assigned the DefaultStopHandler, which did nothing. It was called in a few places, but since it never does anything, better remove it. For properly supporting stopping of external processes, some better architecture should be added instead.
1 parent cbd822e commit 041a157

File tree

2 files changed

+0
-37
lines changed

2 files changed

+0
-37
lines changed

app/src/processing/app/Base.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -767,8 +767,6 @@ public void handleNewReplace() {
767767
if (!activeEditor.checkModified()) {
768768
return; // sketch was modified, and user canceled
769769
}
770-
// Close the running window, avoid window boogers with multiple sketches
771-
activeEditor.internalCloseRunner();
772770

773771
// Actually replace things
774772
handleNewReplaceImpl();
@@ -793,8 +791,6 @@ public void handleOpenReplace(File file) {
793791
if (!activeEditor.checkModified()) {
794792
return; // sketch was modified, and user canceled
795793
}
796-
// Close the running window, avoid window boogers with multiple sketches
797-
activeEditor.internalCloseRunner();
798794

799795
boolean loaded = activeEditor.handleOpenInternal(file);
800796
if (!loaded) {
@@ -957,9 +953,6 @@ public boolean handleClose(Editor editor) {
957953
return false;
958954
}
959955

960-
// Close the running window, avoid window boogers with multiple sketches
961-
editor.internalCloseRunner();
962-
963956
if (editors.size() == 1) {
964957
// This will store the sketch count as zero
965958
editors.remove(editor);
@@ -1014,10 +1007,6 @@ public boolean handleQuit() {
10141007
}
10151008

10161009
if (handleQuitEach()) {
1017-
// make sure running sketches close before quitting
1018-
for (Editor editor : editors) {
1019-
editor.internalCloseRunner();
1020-
}
10211010
// Save out the current prefs state
10221011
PreferencesData.save();
10231012

app/src/processing/app/Editor.java

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,6 @@ public boolean test(SketchController sketch) {
191191
Runnable presentHandler;
192192
private Runnable runAndSaveHandler;
193193
private Runnable presentAndSaveHandler;
194-
private Runnable stopHandler;
195194
Runnable exportHandler;
196195
private Runnable exportAppHandler;
197196

@@ -1568,7 +1567,6 @@ private void resetHandlers() {
15681567
presentHandler = new BuildHandler(true);
15691568
runAndSaveHandler = new BuildHandler(false, true);
15701569
presentAndSaveHandler = new BuildHandler(true, true);
1571-
stopHandler = new DefaultStopHandler();
15721570
exportHandler = new DefaultExportHandler();
15731571
exportAppHandler = new DefaultExportAppHandler();
15741572
}
@@ -1727,7 +1725,6 @@ public void handleRun(final boolean verbose, Runnable verboseHandler, Runnable n
17271725
}
17281726

17291727
private void handleRun(final boolean verbose, Predicate<SketchController> shouldSavePredicate, Runnable verboseHandler, Runnable nonVerboseHandler) {
1730-
internalCloseRunner();
17311728
if (shouldSavePredicate.test(sketchController)) {
17321729
handleSave(true);
17331730
}
@@ -1795,42 +1792,20 @@ public void addLineHighlight(int line) throws BadLocationException {
17951792
getCurrentTab().getTextArea().setCaretPosition(getCurrentTab().getTextArea().getLineStartOffset(line));
17961793
}
17971794

1798-
private class DefaultStopHandler implements Runnable {
1799-
public void run() {
1800-
// TODO
1801-
// DAM: we should try to kill the compilation or upload process here.
1802-
}
1803-
}
1804-
18051795

18061796
/**
18071797
* Implements Sketch &rarr; Stop, or pressing Stop on the toolbar.
18081798
*/
18091799
private void handleStop() { // called by menu or buttons
18101800
// toolbar.activate(EditorToolbar.STOP);
18111801

1812-
internalCloseRunner();
1813-
18141802
toolbar.deactivateRun();
18151803
// toolbar.deactivate(EditorToolbar.STOP);
18161804

18171805
// focus the PDE again after quitting presentation mode [toxi 030903]
18181806
toFront();
18191807
}
18201808

1821-
1822-
/**
1823-
* Handle internal shutdown of the runner.
1824-
*/
1825-
public void internalCloseRunner() {
1826-
1827-
if (stopHandler != null)
1828-
try {
1829-
stopHandler.run();
1830-
} catch (Exception e) { }
1831-
}
1832-
1833-
18341809
/**
18351810
* Check if the sketch is modified and ask user to save changes.
18361811
* @return false if canceling the close/quit operation
@@ -1912,7 +1887,6 @@ protected boolean checkModified() {
19121887
*/
19131888
protected void handleOpenUnchecked(File file, int codeIndex,
19141889
int selStart, int selStop, int scrollPos) {
1915-
internalCloseRunner();
19161890
handleOpenInternal(file);
19171891
// Replacing a document that may be untitled. If this is an actual
19181892
// untitled document, then editor.untitled will be set by Base.

0 commit comments

Comments
 (0)