MCPcopy Create free account
hub / github.com/bobbylight/RText / doExit

Method doExit

src/main/java/org/fife/rtext/RText.java:415–457  ·  view source on GitHub ↗

Called when the user attempts to close the application, whether from an "Exit" menu item, closing the main application window, or any other means. The user is prompted to save any dirty documents, and this RText instance is closed.

()

Source from the content-addressed store, hash-verified

413 * RText instance is closed.
414 */
415 @Override
416 public void doExit() {
417
418 // Attempt to close all open documents.
419 boolean allDocumentsClosed = getMainView().closeAllDocuments();
420
421 // Assuming all documents closed okay (ie, the user
422 // didn't click "Cancel")...
423 if (allDocumentsClosed) {
424
425 // If there will be no more rtext's running, stop the JVM.
426 if (StoreKeeper.getInstanceCount()==1) {
427 savePreferences();
428 boolean saved = RTextEditorPane.saveTemplates();
429 if (!saved) {
430 String title = getString("ErrorDialogTitle");
431 String text = getString("TemplateSaveError");
432 JOptionPane.showMessageDialog(this, text, title,
433 JOptionPane.ERROR_MESSAGE);
434 }
435 // Save file chooser "Favorite Directories". It is
436 // important to check that the chooser exists here, as
437 // if it doesn't, there's no need to do this! If we
438 // don't, the saveFileChooseFavorites() method will
439 // create the file chooser itself just to save the
440 // favorites!
441 if (chooser!=null) {
442 RTextUtilities.saveFileChooserFavorites(this);
443 }
444 System.exit(0);
445 }
446
447 // If there will still be some RText instances running, just
448 // stop this instance.
449 else {
450 setVisible(false);
451 StoreKeeper.removeRTextInstance(this);
452 this.dispose();
453 }
454
455 }
456
457 }
458
459
460 /**

Callers

nothing calls this directly

Calls 9

getMainViewMethod · 0.95
getInstanceCountMethod · 0.95
savePreferencesMethod · 0.95
removeRTextInstanceMethod · 0.95
closeAllDocumentsMethod · 0.80
getStringMethod · 0.45
setVisibleMethod · 0.45
disposeMethod · 0.45

Tested by

no test coverage detected