mirror of
https://github.com/arduino/Arduino.git
synced 2024-11-29 10:24:12 +01:00
Cleanup IDE quit()
There were two different routines andling more or less the same operations. Let the IDE call "real" quit when the last Editor windows is being closed.
This commit is contained in:
parent
b7728beb52
commit
e1a5be7354
@ -925,45 +925,20 @@ public class Base {
|
||||
*/
|
||||
public boolean handleClose(Editor editor) {
|
||||
// Check if modified
|
||||
// boolean immediate = editors.size() == 1;
|
||||
if (!editor.checkModified()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (editors.size() == 1) {
|
||||
storeScreenDimensions();
|
||||
storeSketches();
|
||||
|
||||
// This will store the sketch count as zero
|
||||
editors.remove(editor);
|
||||
try {
|
||||
Editor.serialMonitor.close();
|
||||
} catch (Exception e) {
|
||||
//ignore
|
||||
}
|
||||
rebuildRecentSketchesMenuItems();
|
||||
|
||||
// Save out the current prefs state
|
||||
PreferencesData.save();
|
||||
|
||||
// Since this wasn't an actual Quit event, call System.exit()
|
||||
System.exit(0);
|
||||
handleQuit();
|
||||
|
||||
} else {
|
||||
// More than one editor window open,
|
||||
// proceed with closing the current window.
|
||||
editor.setVisible(false);
|
||||
editor.dispose();
|
||||
// for (int i = 0; i < editorCount; i++) {
|
||||
// if (editor == editors[i]) {
|
||||
// for (int j = i; j < editorCount-1; j++) {
|
||||
// editors[j] = editors[j+1];
|
||||
// }
|
||||
// editorCount--;
|
||||
// // Set to null so that garbage collection occurs
|
||||
// editors[editorCount] = null;
|
||||
// }
|
||||
// }
|
||||
|
||||
editors.remove(editor);
|
||||
}
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user