1 | private static void loadPrefs() {↵ | | 1 | private static void loadPrefs() {↵
|
2 | try {↵ | | 2 | try {↵
|
3 | XMLBeanReader doc = new XMLBeanReader();↵ | | 3 | XMLBeanReader doc = new XMLBeanReader();↵
|
4 | ↵ | | 4 | ↵
|
5 | File prefFile = PreferenceUtil.getPreferenceFileToReadFrom(plugin);↵ | | 5 | File prefFile = PreferenceUtil.getPreferenceFileToReadFrom(plugin);↵
|
6 | ↵ | | 6 | ↵
|
7 | doc.load(prefFile, MSSQLPreferenceBean.class.getClassLoader());↵ | | 7 | doc.load(prefFile, SQLScriptPreferenceBean.class.getClassLoader());↵
|
8 | ↵ | | 8 | ↵
|
|
9 | Iterator<?> it = doc.iterator();↵ | | 9 | Iterator<?> it = doc.iterator();↵
|
10 | if (it.hasNext()) {↵ | | 10 | if (it.hasNext()) {↵
|
11 | _prefs = (MSSQLPreferenceBean)it.next();↵ | | 11 | _prefs = (SQLScriptPreferenceBean)it.next();↵
|
12 | }↵ | | 12 | }↵
|
13 | } catch (FileNotFoundException ignore) {↵ | | 13 | } catch (FileNotFoundException ignore) {↵
|
14 | s_log.info(USER_PREFS_FILE_NAME + " not found - will be created");↵ | | 14 | s_log.info(USER_PREFS_FILE_NAME + " not found - will be created");↵
|
15 | } catch (Exception ex) {↵ | | 15 | } catch (Exception ex) {↵
|
16 | s_log.error("Error occured reading from preferences file: "↵ | | 16 | s_log.error("Error occured reading from preferences file: "↵
|
17 | + USER_PREFS_FILE_NAME, ex);↵ | | 17 | + USER_PREFS_FILE_NAME, ex);↵
|
18 | }↵ | | 18 | }↵
|
19 | if (_prefs == null) {↵ | | 19 | if (_prefs == null) {↵
|
20 | _prefs = new MSSQLPreferenceBean();↵ | | 20 | _prefs = new SQLScriptPreferenceBean();↵
|
21 | }↵ | | 21 | }↵
|
|
22 | _prefs.setClientName(Version.getApplicationName() + "/" + plugin.getDescriptiveName());↵ | | 22 | _prefs.setClientName(Version.getApplicationName() + "/" + plugin.getDescriptiveName());↵
|
23 | _prefs.setClientVersion(Version.getShortVersion() + "/" + plugin.getVersion());↵ | | 23 | _prefs.setClientVersion(Version.getShortVersion() + "/" + plugin.getVersion());↵
|
24 | | | 24 |
|