protected final void loadPreferences() { if (preferencesFile == null) { return; } // Note, at this point the logging file is still not open! try { getPreferences().load(preferencesFile); } catch (IOException ignored) { logger.warning("Failed to load user preferences from " + preferencesFile); logger.warning("Using application default values..."); } }
public final void savePreferences() { if (preferencesFile == null) { return; } setPreferences(); try { logger.info("Storing user preferences in '" + preferencesFile.getPath() + "'...");/*I18N*/ getPreferences().store(preferencesFile, getAppName() + " " + getAppVersion() + " - User preferences file"); logger.info("User preferences stored");/*I18N*/ } catch (IOException ignored) { logger.warning("Failed to store user preferences");/*I18N*/ } }
protected boolean initLookAndFeel() { try { UIManager.installLookAndFeel("Napkin", "net.sourceforge.napkinlaf.NapkinLookAndFeel"); } catch (Throwable e) { // ignored, because Napkin LAF is no important } String currentLafClassName = UIManager.getLookAndFeel().getClass().getName(); String defaultLafClassName = getDefaultLookAndFeelClassName(); String newLafClassName = getPreferences().getPropertyString(PROPERTY_KEY_APP_UI_LAF, defaultLafClassName); // This should fix a problem occurring in JIDE 3.3.5 with the GTKLookAndFeel (nf, 2012-03-02) if (newLafClassName.equals("com.sun.java.swing.plaf.gtk.GTKLookAndFeel")) { newLafClassName = defaultLafClassName; } if (!uiDefaultsInitialized || !currentLafClassName.equals(newLafClassName)) { try { UIManager.setLookAndFeel(newLafClassName); getPreferences().setPropertyString(PROPERTY_KEY_APP_UI_LAF, newLafClassName); } catch (Throwable ignored) { // ignore } try { loadJideExtension(); } catch (Throwable ignored) { // ignore } return true; } return false; }
protected final void setPreferences() { ////////////////////////////////////////////////////////////// // Store file history fileHistory.copyInto(getPreferences()); ////////////////////////////////////////////////////////////// // Store frame properties getPreferences().setPropertyInt("frame.location.x", getMainFrame().getLocation().x); getPreferences().setPropertyInt("frame.location.y", getMainFrame().getLocation().y); getPreferences().setPropertyInt("frame.size.width", getMainFrame().getSize().width); getPreferences().setPropertyInt("frame.size.height", getMainFrame().getSize().height); getPreferences().setPropertyBool("frame.ui.dblbuf", RepaintManager.currentManager(getMainFrame()).isDoubleBufferingEnabled()); ////////////////////////////////////////////////////////////// getPreferences().setPropertyBool(PROPERTY_KEY_APP_DEBUG_ENABLED, debugEnabled); }
int x = getPreferences().getPropertyInt("frame.location.x", -1); int y = getPreferences().getPropertyInt("frame.location.y", -1); int width = getPreferences().getPropertyInt("frame.size.width", 0); int height = getPreferences().getPropertyInt("frame.size.height", 0); bV = getPreferences().getPropertyBool("view.showToolBar", Boolean.TRUE); command = commandManager.getExecCommand("showToolBar"); if (command != null) { bV = getPreferences().getPropertyBool("view.showStatusBar", Boolean.TRUE); command = commandManager.getExecCommand("showStatusBar"); if (command != null) { fileHistory.initBy(getPreferences()); bV = getPreferences().getPropertyBool(PROPERTY_KEY_APP_DEBUG_ENABLED, Boolean.FALSE); debugEnabled = bV; if (debugEnabled) {
public ProductGrabber(final BasicApp basicApp, final RepositoryManager repositoryManager, final String helpId) { pgConfig = new ProductGrabberConfig(basicApp.getPreferences()); this.repositoryManager = repositoryManager; this.repositoryManager.addListener(new MyRepositoryManagerListener()); addDefaultDataProvider(this.repositoryManager); uiCallBack = new UiCallBack(); this.helpId = helpId; }
final boolean useSystemFontSettings = getPreferences().getPropertyBool( PROPERTY_KEY_APP_UI_USE_SYSTEM_FONT_SETTINGS, currentUseSystemFontSettings); if (currentUseSystemFontSettings != useSystemFontSettings) { final String fontName = getPreferences().getPropertyString(PROPERTY_KEY_APP_UI_FONT_NAME, currentMenuFont.getName()); final int fontSize = getPreferences().getPropertyInt(PROPERTY_KEY_APP_UI_FONT_SIZE, currentMenuFont.getSize()); if (!currentMenuFont.getName().equalsIgnoreCase(fontName) || currentMenuFont.getSize() != fontSize) {
Assert.argument(!lastDirPropertyKey.isEmpty(), "!lastDirPropertyKey.isEmpty()"); String lastDir = getPreferences().getPropertyString(lastDirPropertyKey, SystemUtils.getUserHomeDir().getPath()); File currentDir = new File(lastDir); getPreferences().setPropertyString(lastDirPropertyKey, lastDirPath);
Assert.argument(!lastDirPropertyKey.isEmpty(), "!lastDirPropertyKey.isEmpty()"); String lastDir = getPreferences().getPropertyString(lastDirPropertyKey, SystemUtils.getUserHomeDir().getPath()); File currentDir = new File(lastDir); getPreferences().setPropertyString(lastDirPropertyKey, lastDirPath);
private void initPreferences() { preferences = new PropertyMap(); preferences.setPropertyBool(PROPERTY_KEY_APP_DEBUG_ENABLED, false); preferences.setPropertyString(PROPERTY_KEY_APP_UI_FONT_NAME, "SansSerif"); preferences.setPropertyInt(PROPERTY_KEY_APP_UI_FONT_SIZE, 12); preferences.setPropertyBool(PROPERTY_KEY_APP_LOG_ENABLED, false); preferences.setPropertyString(PROPERTY_KEY_APP_LOG_PREFIX, getAppName()); preferences.setPropertyString(PROPERTY_KEY_APP_LOG_LEVEL, SystemUtils.LLS_INFO); preferences.setPropertyBool(PROPERTY_KEY_APP_LOG_ECHO, false); preferencesFile = new File(appUserDir, "preferences.properties"); loadPreferences(); suppressibleOptionPane = new SuppressibleOptionPane(getPreferences()); }