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.
This commit is contained in:
Matthijs Kooijman 2015-12-17 16:18:02 +01:00 committed by Martino Facchin
parent 8e0d007ce2
commit 7d277b359c
2 changed files with 0 additions and 37 deletions

View File

@ -762,8 +762,6 @@ public class Base {
if (!activeEditor.checkModified()) {
return; // sketch was modified, and user canceled
}
// Close the running window, avoid window boogers with multiple sketches
activeEditor.internalCloseRunner();
// Actually replace things
handleNewReplaceImpl();
@ -788,8 +786,6 @@ public class Base {
if (!activeEditor.checkModified()) {
return; // sketch was modified, and user canceled
}
// Close the running window, avoid window boogers with multiple sketches
activeEditor.internalCloseRunner();
boolean loaded = activeEditor.handleOpenInternal(file);
if (!loaded) {
@ -947,9 +943,6 @@ public class Base {
return false;
}
// Close the running window, avoid window boogers with multiple sketches
editor.internalCloseRunner();
if (editors.size() == 1) {
storeSketches();
@ -1005,10 +998,6 @@ public class Base {
}
if (handleQuitEach()) {
// make sure running sketches close before quitting
for (Editor editor : editors) {
editor.internalCloseRunner();
}
// Save out the current prefs state
PreferencesData.save();

View File

@ -194,7 +194,6 @@ public class Editor extends JFrame implements RunnerListener {
Runnable presentHandler;
private Runnable runAndSaveHandler;
private Runnable presentAndSaveHandler;
private Runnable stopHandler;
Runnable exportHandler;
private Runnable exportAppHandler;
private Runnable timeoutUploadHandler;
@ -1558,7 +1557,6 @@ public class Editor extends JFrame implements RunnerListener {
presentHandler = new BuildHandler(true);
runAndSaveHandler = new BuildHandler(false, true);
presentAndSaveHandler = new BuildHandler(true, true);
stopHandler = new DefaultStopHandler();
exportHandler = new DefaultExportHandler();
exportAppHandler = new DefaultExportAppHandler();
timeoutUploadHandler = new TimeoutUploadHandler();
@ -1718,7 +1716,6 @@ public class Editor extends JFrame implements RunnerListener {
}
private void handleRun(final boolean verbose, Predicate<SketchController> shouldSavePredicate, Runnable verboseHandler, Runnable nonVerboseHandler) {
internalCloseRunner();
if (shouldSavePredicate.test(sketchController)) {
handleSave(true);
}
@ -1787,13 +1784,6 @@ public class Editor extends JFrame implements RunnerListener {
getCurrentTab().getTextArea().setCaretPosition(getCurrentTab().getTextArea().getLineStartOffset(line));
}
private class DefaultStopHandler implements Runnable {
public void run() {
// TODO
// DAM: we should try to kill the compilation or upload process here.
}
}
/**
* Implements Sketch &rarr; Stop, or pressing Stop on the toolbar.
@ -1801,8 +1791,6 @@ public class Editor extends JFrame implements RunnerListener {
private void handleStop() { // called by menu or buttons
// toolbar.activate(EditorToolbar.STOP);
internalCloseRunner();
toolbar.deactivateRun();
// toolbar.deactivate(EditorToolbar.STOP);
@ -1810,19 +1798,6 @@ public class Editor extends JFrame implements RunnerListener {
toFront();
}
/**
* Handle internal shutdown of the runner.
*/
public void internalCloseRunner() {
if (stopHandler != null)
try {
stopHandler.run();
} catch (Exception e) { }
}
/**
* Check if the sketch is modified and ask user to save changes.
* @return false if canceling the close/quit operation
@ -1904,7 +1879,6 @@ public class Editor extends JFrame implements RunnerListener {
*/
protected void handleOpenUnchecked(File file, int codeIndex,
int selStart, int selStop, int scrollPos) {
internalCloseRunner();
handleOpenInternal(file);
// Replacing a document that may be untitled. If this is an actual
// untitled document, then editor.untitled will be set by Base.