/** * Loads saved preferences for this plugin. If this is the first time through, default values will * be returned. * * @return The preferences. */ private MacroPrefs loadPrefs() { MacroPrefs prefs = new MacroPrefs(); File prefsFile = getPrefsFile(); if (prefsFile.isFile()) { try { prefs.load(prefsFile); } catch (IOException ioe) { app.displayException(ioe); // (Some) defaults will be used } } return prefs; }
public void savePreferences() { saveMacros(); MacroPrefs prefs = new MacroPrefs(); StandardAction a = (StandardAction) app.getAction(NEW_MACRO_ACTION); prefs.newMacroAccelerator = a.getAccelerator(); a = (StandardAction) app.getAction(EDIT_MACROS_ACTION); prefs.editMacrosAccelerator = a.getAccelerator(); File prefsFile = getPrefsFile(); try { prefs.save(prefsFile); } catch (IOException ioe) { app.displayException(ioe); } }