mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-21 15:54:39 +01:00
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:
parent
8e0d007ce2
commit
7d277b359c
@ -762,8 +762,6 @@ public class Base {
|
|||||||
if (!activeEditor.checkModified()) {
|
if (!activeEditor.checkModified()) {
|
||||||
return; // sketch was modified, and user canceled
|
return; // sketch was modified, and user canceled
|
||||||
}
|
}
|
||||||
// Close the running window, avoid window boogers with multiple sketches
|
|
||||||
activeEditor.internalCloseRunner();
|
|
||||||
|
|
||||||
// Actually replace things
|
// Actually replace things
|
||||||
handleNewReplaceImpl();
|
handleNewReplaceImpl();
|
||||||
@ -788,8 +786,6 @@ public class Base {
|
|||||||
if (!activeEditor.checkModified()) {
|
if (!activeEditor.checkModified()) {
|
||||||
return; // sketch was modified, and user canceled
|
return; // sketch was modified, and user canceled
|
||||||
}
|
}
|
||||||
// Close the running window, avoid window boogers with multiple sketches
|
|
||||||
activeEditor.internalCloseRunner();
|
|
||||||
|
|
||||||
boolean loaded = activeEditor.handleOpenInternal(file);
|
boolean loaded = activeEditor.handleOpenInternal(file);
|
||||||
if (!loaded) {
|
if (!loaded) {
|
||||||
@ -947,9 +943,6 @@ public class Base {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close the running window, avoid window boogers with multiple sketches
|
|
||||||
editor.internalCloseRunner();
|
|
||||||
|
|
||||||
if (editors.size() == 1) {
|
if (editors.size() == 1) {
|
||||||
storeSketches();
|
storeSketches();
|
||||||
|
|
||||||
@ -1005,10 +998,6 @@ public class Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (handleQuitEach()) {
|
if (handleQuitEach()) {
|
||||||
// make sure running sketches close before quitting
|
|
||||||
for (Editor editor : editors) {
|
|
||||||
editor.internalCloseRunner();
|
|
||||||
}
|
|
||||||
// Save out the current prefs state
|
// Save out the current prefs state
|
||||||
PreferencesData.save();
|
PreferencesData.save();
|
||||||
|
|
||||||
|
@ -194,7 +194,6 @@ public class Editor extends JFrame implements RunnerListener {
|
|||||||
Runnable presentHandler;
|
Runnable presentHandler;
|
||||||
private Runnable runAndSaveHandler;
|
private Runnable runAndSaveHandler;
|
||||||
private Runnable presentAndSaveHandler;
|
private Runnable presentAndSaveHandler;
|
||||||
private Runnable stopHandler;
|
|
||||||
Runnable exportHandler;
|
Runnable exportHandler;
|
||||||
private Runnable exportAppHandler;
|
private Runnable exportAppHandler;
|
||||||
private Runnable timeoutUploadHandler;
|
private Runnable timeoutUploadHandler;
|
||||||
@ -1558,7 +1557,6 @@ public class Editor extends JFrame implements RunnerListener {
|
|||||||
presentHandler = new BuildHandler(true);
|
presentHandler = new BuildHandler(true);
|
||||||
runAndSaveHandler = new BuildHandler(false, true);
|
runAndSaveHandler = new BuildHandler(false, true);
|
||||||
presentAndSaveHandler = new BuildHandler(true, true);
|
presentAndSaveHandler = new BuildHandler(true, true);
|
||||||
stopHandler = new DefaultStopHandler();
|
|
||||||
exportHandler = new DefaultExportHandler();
|
exportHandler = new DefaultExportHandler();
|
||||||
exportAppHandler = new DefaultExportAppHandler();
|
exportAppHandler = new DefaultExportAppHandler();
|
||||||
timeoutUploadHandler = new TimeoutUploadHandler();
|
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) {
|
private void handleRun(final boolean verbose, Predicate<SketchController> shouldSavePredicate, Runnable verboseHandler, Runnable nonVerboseHandler) {
|
||||||
internalCloseRunner();
|
|
||||||
if (shouldSavePredicate.test(sketchController)) {
|
if (shouldSavePredicate.test(sketchController)) {
|
||||||
handleSave(true);
|
handleSave(true);
|
||||||
}
|
}
|
||||||
@ -1787,13 +1784,6 @@ public class Editor extends JFrame implements RunnerListener {
|
|||||||
getCurrentTab().getTextArea().setCaretPosition(getCurrentTab().getTextArea().getLineStartOffset(line));
|
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 → Stop, or pressing Stop on the toolbar.
|
* Implements Sketch → 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
|
private void handleStop() { // called by menu or buttons
|
||||||
// toolbar.activate(EditorToolbar.STOP);
|
// toolbar.activate(EditorToolbar.STOP);
|
||||||
|
|
||||||
internalCloseRunner();
|
|
||||||
|
|
||||||
toolbar.deactivateRun();
|
toolbar.deactivateRun();
|
||||||
// toolbar.deactivate(EditorToolbar.STOP);
|
// toolbar.deactivate(EditorToolbar.STOP);
|
||||||
|
|
||||||
@ -1810,19 +1798,6 @@ public class Editor extends JFrame implements RunnerListener {
|
|||||||
toFront();
|
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.
|
* Check if the sketch is modified and ask user to save changes.
|
||||||
* @return false if canceling the close/quit operation
|
* @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,
|
protected void handleOpenUnchecked(File file, int codeIndex,
|
||||||
int selStart, int selStop, int scrollPos) {
|
int selStart, int selStop, int scrollPos) {
|
||||||
internalCloseRunner();
|
|
||||||
handleOpenInternal(file);
|
handleOpenInternal(file);
|
||||||
// Replacing a document that may be untitled. If this is an actual
|
// Replacing a document that may be untitled. If this is an actual
|
||||||
// untitled document, then editor.untitled will be set by Base.
|
// untitled document, then editor.untitled will be set by Base.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user