void load(IApplication app) { _prefs = app.getSquirrelPreferences(); _plugins = app.getPluginManager().getPluginInformation(); _appArgs = ApplicationArguments.getInstance().getRawArguments(); _version = Version.getVersion(); _pluginLoc = new ApplicationFiles().getPluginsDirectory().getAbsolutePath(); URL[] urls = app.getPluginManager().getPluginURLs(); _pluginURLs = new URLWrapper[urls.length]; for (int i = 0; i < urls.length; ++i) { _pluginURLs[i] = new URLWrapper(urls[i]); } }
/** Load from preferences file. */ private void loadPrefs() { try { XMLBeanReader doc = new XMLBeanReader(); FileWrapper prefFile = PreferenceUtil.getPreferenceFileToReadFrom(plugin); doc.load(prefFile, _prefs.getClass().getClassLoader()); Iterator<Object> it = doc.iterator(); if (it.hasNext()) { _prefs = (IQueryTokenizerPreferenceBean) it.next(); } } catch (FileNotFoundException ignore) { s_log.info(USER_PREFS_FILE_NAME + " not found - will be created"); } catch (Exception ex) { s_log.error("Error occurred reading from preferences file: " + USER_PREFS_FILE_NAME, ex); } _prefs.setClientName(Version.getApplicationName() + "/" + plugin.getDescriptiveName()); _prefs.setClientVersion(Version.getShortVersion() + "/" + plugin.getVersion()); }