Handler for File → Quit. @return false if canceled, true otherwise.
()
| 979 | * @return false if canceled, true otherwise. |
| 980 | */ |
| 981 | public boolean handleQuit() { |
| 982 | // If quit is canceled, this will be replaced anyway |
| 983 | // by a later handleQuit() that is not canceled. |
| 984 | storeScreenDimensions(); |
| 985 | storeSketches(); |
| 986 | try { |
| 987 | Editor.serialMonitor.close(); |
| 988 | } catch (Exception e) { |
| 989 | // ignore |
| 990 | } |
| 991 | |
| 992 | // kill uploader (if still alive) |
| 993 | UploaderUtils uploaderInstance = new UploaderUtils(); |
| 994 | Uploader uploader = uploaderInstance.getUploaderByPreferences(false); |
| 995 | if (uploader != null && Uploader.programmerPid != null && Uploader.programmerPid.isAlive()) { |
| 996 | // kill the stuck programmer |
| 997 | Uploader.programmerPid.destroyForcibly(); |
| 998 | } |
| 999 | |
| 1000 | if (handleQuitEach()) { |
| 1001 | // Save out the current prefs state |
| 1002 | PreferencesData.save(); |
| 1003 | |
| 1004 | if (!OSUtils.isMacOS()) { |
| 1005 | // If this was fired from the menu or an AppleEvent (the Finder), |
| 1006 | // then Mac OS X will send the terminate signal itself. |
| 1007 | System.exit(0); |
| 1008 | } |
| 1009 | return true; |
| 1010 | } |
| 1011 | return false; |
| 1012 | } |
| 1013 | |
| 1014 | |
| 1015 | /** |
no test coverage detected