Skip to content

Commit 7d277b3

Browse files
matthijskooijmanfacchinm
authored andcommitted
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 8e0d007 commit 7d277b3

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
@@ -762,8 +762,6 @@ public void handleNewReplace() {
762762
if (!activeEditor.checkModified()) {
763763
return; // sketch was modified, and user canceled
764764
}
765-
// Close the running window, avoid window boogers with multiple sketches
766-
activeEditor.internalCloseRunner();
767765

768766
// Actually replace things
769767
handleNewReplaceImpl();
@@ -788,8 +786,6 @@ public void handleOpenReplace(File file) {
788786
if (!activeEditor.checkModified()) {
789787
return; // sketch was modified, and user canceled
790788
}
791-
// Close the running window, avoid window boogers with multiple sketches
792-
activeEditor.internalCloseRunner();
793789

794790
boolean loaded = activeEditor.handleOpenInternal(file);
795791
if (!loaded) {
@@ -947,9 +943,6 @@ public boolean handleClose(Editor editor) {
947943
return false;
948944
}
949945

950-
// Close the running window, avoid window boogers with multiple sketches
951-
editor.internalCloseRunner();
952-
953946
if (editors.size() == 1) {
954947
storeSketches();
955948

@@ -1005,10 +998,6 @@ public boolean handleQuit() {
1005998
}
1006999

10071000
if (handleQuitEach()) {
1008-
// make sure running sketches close before quitting
1009-
for (Editor editor : editors) {
1010-
editor.internalCloseRunner();
1011-
}
10121001
// Save out the current prefs state
10131002
PreferencesData.save();
10141003

app/src/processing/app/Editor.java

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@ public boolean test(SketchController sketch) {
194194
Runnable presentHandler;
195195
private Runnable runAndSaveHandler;
196196
private Runnable presentAndSaveHandler;
197-
private Runnable stopHandler;
198197
Runnable exportHandler;
199198
private Runnable exportAppHandler;
200199
private Runnable timeoutUploadHandler;
@@ -1558,7 +1557,6 @@ private void resetHandlers() {
15581557
presentHandler = new BuildHandler(true);
15591558
runAndSaveHandler = new BuildHandler(false, true);
15601559
presentAndSaveHandler = new BuildHandler(true, true);
1561-
stopHandler = new DefaultStopHandler();
15621560
exportHandler = new DefaultExportHandler();
15631561
exportAppHandler = new DefaultExportAppHandler();
15641562
timeoutUploadHandler = new TimeoutUploadHandler();
@@ -1718,7 +1716,6 @@ public void handleRun(final boolean verbose, Runnable verboseHandler, Runnable n
17181716
}
17191717

17201718
private void handleRun(final boolean verbose, Predicate<SketchController> shouldSavePredicate, Runnable verboseHandler, Runnable nonVerboseHandler) {
1721-
internalCloseRunner();
17221719
if (shouldSavePredicate.test(sketchController)) {
17231720
handleSave(true);
17241721
}
@@ -1787,42 +1784,20 @@ public void addLineHighlight(int line) throws BadLocationException {
17871784
getCurrentTab().getTextArea().setCaretPosition(getCurrentTab().getTextArea().getLineStartOffset(line));
17881785
}
17891786

1790-
private class DefaultStopHandler implements Runnable {
1791-
public void run() {
1792-
// TODO
1793-
// DAM: we should try to kill the compilation or upload process here.
1794-
}
1795-
}
1796-
17971787

17981788
/**
17991789
* Implements Sketch &rarr; Stop, or pressing Stop on the toolbar.
18001790
*/
18011791
private void handleStop() { // called by menu or buttons
18021792
// toolbar.activate(EditorToolbar.STOP);
18031793

1804-
internalCloseRunner();
1805-
18061794
toolbar.deactivateRun();
18071795
// toolbar.deactivate(EditorToolbar.STOP);
18081796

18091797
// focus the PDE again after quitting presentation mode [toxi 030903]
18101798
toFront();
18111799
}
18121800

1813-
1814-
/**
1815-
* Handle internal shutdown of the runner.
1816-
*/
1817-
public void internalCloseRunner() {
1818-
1819-
if (stopHandler != null)
1820-
try {
1821-
stopHandler.run();
1822-
} catch (Exception e) { }
1823-
}
1824-
1825-
18261801
/**
18271802
* Check if the sketch is modified and ask user to save changes.
18281803
* @return false if canceling the close/quit operation
@@ -1904,7 +1879,6 @@ protected boolean checkModified() {
19041879
*/
19051880
protected void handleOpenUnchecked(File file, int codeIndex,
19061881
int selStart, int selStop, int scrollPos) {
1907-
internalCloseRunner();
19081882
handleOpenInternal(file);
19091883
// Replacing a document that may be untitled. If this is an actual
19101884
// untitled document, then editor.untitled will be set by Base.

0 commit comments

Comments
 (0)