/** * Performs tasks before shut down, such as writing the configuration file. This method can only * be called once, any further call will be ignored (no-op). */ private static synchronized void performShutdownTasks() { // Return if shutdown tasks have already been performed if (shutdownTasksPerformed) return; TreeIOThreadManager.getInstance().interrupt(); // Save snapshot try { MuConfigurations.saveSnapshot(); } catch (Exception e) { LOGGER.warn("Failed to save snapshot", e); } // Save preferences try { MuConfigurations.savePreferences(); } catch (Exception e) { LOGGER.warn("Failed to save configuration", e); } // Save shell history try { ShellHistoryManager.writeHistory(); } catch (Exception e) { LOGGER.warn("Failed to save shell history", e); } // Write credentials file to disk, only if changes were made try { CredentialsManager.writeCredentials(false); } catch (Exception e) { LOGGER.warn("Failed to save credentials", e); } // Write bookmarks file to disk, only if changes were made try { BookmarkManager.writeBookmarks(false); } catch (Exception e) { LOGGER.warn("Failed to save bookmarks", e); } // Saves the current theme. try { ThemeManager.saveCurrentTheme(); } catch (Exception e) { LOGGER.warn("Failed to save user theme", e); } // Saves the file associations. try { CommandManager.writeCommands(); } catch (Exception e) { LOGGER.warn("Failed to save commands", e); } try { CommandManager.writeAssociations(); } catch (Exception e) { LOGGER.warn("Failed to save associations", e); } // Saves the action keymap. try { ActionKeymapIO.saveActionKeymap(); } catch (Exception e) { LOGGER.warn("Failed to save action keymap", e); } // Saves the command bar. try { CommandBarIO.saveCommandBar(); } catch (Exception e) { LOGGER.warn("Failed to save command bar", e); } // Saves the tool bar. try { ToolBarIO.saveToolBar(); } catch (Exception e) { LOGGER.warn("Failed to save toolbar", e); } // Shutdown tasks should only be performed once shutdownTasksPerformed = true; }