001: /*
002: * The contents of this file are subject to the Mozilla Public License
003: * Version 1.1 (the "License"); you may not use this file except in
004: * compliance with the License. You may obtain a copy of the License at
005: * http://www.mozilla.org/MPL/
006: *
007: * Software distributed under the License is distributed on an "AS IS"
008: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
009: * License for the specific language governing rights and limitations
010: * under the License.
011: *
012: * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool.
013: *
014: * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool.
015: * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved.
016: *
017: * Contributor(s):
018: * Mark A. Kobold [mkobold <at> isqlviewer <dot> com].
019: *
020: * If you didn't download this code from the following link, you should check
021: * if you aren't using an obsolete version: http://www.isqlviewer.com
022: */
023: package org.isqlviewer;
024:
025: import javax.swing.UIManager;
026:
027: import org.isqlviewer.util.StringUtilities;
028:
029: /**
030: * TODO Add PreferenceKeys Overview JavaDoc.
031: * <p>
032: *
033: * @author Mark A. Kobold <mkobold at isqlviewer dot com>
034: * @version 1.0
035: */
036: public final class UserOptions {
037:
038: public static String createStyleKey(String base, String secondary) {
039:
040: return base.concat(".").concat(secondary);
041: }
042:
043: public static final String KEY_STYLE_ITALICS = "italics";
044:
045: public static final String KEY_STYLE_COLOR = "color";
046:
047: public static final String KEY_STYLE_BOLDED = "bolded";
048:
049: /**
050: * Boolean property to determine if it should automatically check for a new version of iSQL-Viewer on startup.
051: */
052: public static final String KEY_USE_WEB_CHK = "advanced.versioncheck-enabled";
053: /**
054: * Integer property that determine if Beta & Stable version are acceptable or just Stable versions.
055: */
056: public static final String KEY_WEB_CHK_TYPE = "advanced.versioncheck-type";
057: /**
058: * String property that is the name of a iSQL service to automatically connect on startup.
059: */
060: public static final String STARTUP_SERVICE = "jdbc.auto-service";
061: /**
062: * Boolean property for configuring JDBC tracing when connected to an iSQL service.
063: */
064: public static final String KEY_JDBC_TRACE_ENABLED = "jdbc.trace-enabled";
065: /**
066: * Boolean property that ensures a final commit is called to a service if nessecary, upon disconnection.
067: */
068: public static final String KEY_JDBC_COMMIT_ON_CLOSE = "jdbc.autocommit-enabled";
069: /**
070: * Boolean property to determine if JDBC activity is verbose or not.
071: */
072: public static final String KEY_JDBC_VERBOSE = "jdbc.verbose-enabled";
073: /**
074: * Boolean property to echo or not echo queries as they are executed.
075: */
076: public static final String KEY_QUERY_ECHO = "jdbc.echo-query";
077: /**
078: * Boolean property to ensure that when queries are executed that the connection is available.
079: */
080: public static final String KEY_JDBC_KEEPALIVE = "jdbc.keepalive-enabled";
081: /**
082: * Boolean property to tell database connection that you want genereated keys if available from ResultSets.
083: */
084: public static final String KEY_JDBC_GENERATE_KEYS = "jdbc.resultsetkeys-enabled";
085: /**
086: * Integer property for the number of seconds that should pass before a connection timesout.
087: */
088: public static final String KEY_LOGIN_TIMEOUT = "jdbc.timeout-login";
089: /**
090: * Integer property for the number of seconds that should pass before a statement execution timesout.
091: */
092: public static final String KEY_QUERY_TIMEOUT = "jdbc.timeout-query";
093: /**
094: * Boolean property to echo the number of rows recieved from a ResultSet object.
095: */
096: public static final String KEY_ROW_CNT_ECHO = "jdbc.echo-rowcount";
097: /**
098: * Integer property for configuring resultset holdability.
099: *
100: * @see java.sql.Connection#setHoldability(int)
101: */
102: public static final String KEY_JDBC_HOLDABILITY = "jdbc.resultset-holdability";
103: /**
104: * Boolean property to turn on/off escaping processing in the JDBC driver.
105: */
106: public static final String KEY_JDBC_ESCAPE = "jdbc.escapeProc-enabled";
107: /**
108: * Boolean property to debug JDBC activity.
109: */
110: public static final String KEY_JDBC_DEBUG = "jdbc.debug-enabled";
111: /**
112: * Boolean property for enabling reverse fetching of ResultSet data.
113: */
114: public static final String KEY_JDBC_RFETCH = "jdbc.reverseFetch-enabled";
115: /**
116: * Integer property to configure the maximum number of rows a Statement object should return.
117: */
118: public static final String KEY_JDBC_MAX_ROWS = "jdbc.max-rows";
119: /**
120: * Integer property to configure the maximum field size a Statement object should return.
121: */
122: public static final String KEY_JDBC_MAX_FIELD_SZ = "jdbc.max-fieldsize";
123: /**
124: * Integer property to determine how deep to process chained SQLExceptions & SQLWarnings.
125: */
126: public static final String KEY_WARNING_CHAIN_LENGTH = "jdbc.max-warnings";
127: /**
128: * Boolean property that determines if the resultset toolbar is enabled or not.
129: */
130: public static final String KEY_TB_RESSET_VISIBLE = "toolbar.resultset-visible";
131: /**
132: * Boolean property that determines if the main toolbar is enabled or not.
133: */
134: public static final String KEY_TB_FILE_VISIBLE = "toolbar.file-visible";
135: /**
136: * Boolean property that determines if the SQL editor toolbar is enabled or not.
137: */
138: public static final String KEY_TB_HISTORY_VISIBLE = "toolbar.history-visible";
139: /**
140: * String property that determines the location of the resultset toolbar e.g. NORTH,SOUTH,EAST,WEST
141: */
142: public static final String KEY_TB_RESSET_DOCK = "toolbar.resultset-dock";
143: /**
144: * String property that determines the location of the main toolbar e.g. NORTH,SOUTH,EAST,WEST
145: */
146: public static final String KEY_TB_FILE_DOCK = "toolbar.file-dock";
147: /**
148: * String property that determines the location of the SQL Editor toolbar e.g. NORTH,SOUTH,EAST,WEST
149: */
150: public static final String KEY_TB_HISTORY_DOCK = "toolbar.history-dock";
151: /**
152: * Boolean property for wether all classes are shown in the service manager or only those in the classpath.
153: */
154: public static final String KEY_SERVICE_DRIVERS_VISIBLE = "general.alldrivers-visible";
155: /**
156: * Boolean property for switching tabs when a new service is selected in the service manager.
157: */
158: public static final String KEY_SERVICE_SWITCH_ON_CHANGE = "servicemanager.switchtab-enabled";
159: /**
160: * Boolean property to ensure that the JDBC driver listing is always sorted or not.
161: */
162: public static final String KEY_DRIVERS_AUTOSORT = "general.driversort-enabled";
163: /**
164: * Boolean property that allows the current driver.properties file to overwritten when a new version is installed.
165: */
166: public static final String KEY_DRIVERS_AUTOUPDATE = "general.driverupdate-enabled";
167: /**
168: * Boolean property to scan service paths for service files when iSQL-Viewer is started.
169: */
170: public static final String KEY_SERVICE_AUTODETECT = "general.servicescan-enabled";
171: /**
172: * String property of the fully qualified class name of the desired LookAndFeel to use.
173: */
174: public static final String KEY_LOOK_N_FEEL = "general.plaf-class";
175: /**
176: * Boolean property for using large 24x24 or smaller 16x16 icons.
177: */
178: public static final String KEY_USE_LARGE_ICONS = "general.large-icons";
179: /**
180: * Boolean property that enables a single click sort of tables otherwise a double-click is required.
181: */
182: public static final String SINGLE_CLICK_SORTING = "general.1clicksort-enabled";
183: /**
184: * String property that is the format for the tabs of ResultSets so that they can be easily identified.
185: */
186: public static final String KEY_RESSET_TAB_FMT = "general.results-format";
187: /**
188: * Boolean property for saving session oriented information such as last selection, and window locations.
189: */
190: public static final String KEY_ENABLE_METRICS = "general.metrics-enabled";
191: /**
192: * String property that is a localized path of directories and files to load classes from.
193: */
194: public static final String KEY_EXTRA_CLASSPATH = "advanced.classpath";
195: /**
196: * String property that is a localized path of directories to load iSQL services.
197: */
198: public static final String KEY_SERVICES_PATH = "advanced.servicepath";
199: /**
200: * Color property to that is used to highlight null values returned from ResultSet objects.
201: */
202: public static final String KEY_NULL_HIGHLIGHT = "general.null-color";
203: /**
204: * Boolean property that will reuse that same tab when refreshing a previously executed statement.
205: */
206: public static final String REUSE_TAB_ON_REFRESH = "general.refresh-reuse";
207: /**
208: * Boolean property that will clear the SQL Editor upon execution of an SQL statement.
209: */
210: public static final String KEY_EDITOR_AUTO_CLEAR = "editor.autoclear-enabled";
211:
212: /**
213: * Boolean for enabling/disabling context-sensitive help in the main editor.
214: */
215: public static final String EDITOR_CONTEXT_HELP = "editor.context-help.enabled";
216: /**
217: * Boolean for enabling/disabling syntax highlighting in the main editor.
218: */
219: public static final String EDITOR_SYNTAX_HELP = "editor.syntax-help.enabled";
220: /**
221: * Boolean property to determine if the caret style is row:column or :location.
222: */
223: public static final String KEY_EDITOR_CARET_STYLE = "editor.caretoffset-enabled";
224: /**
225: * Color property for the SQL editor's foreground.
226: */
227: public static final String STYLE_BASE_COLOR = "editor.default-color";
228: /**
229: * Color property for the SQL editor's background.
230: */
231: public static final String EDITOR_DEFAULT_COLOR = "editor.background-color";
232: /**
233: * Color property for syntax highlighting of table,views, and procedure names along other JDBC objects.
234: */
235: public static final String STYLE_LOCAL_OBJ = "editor.local-obj";
236: /**
237: * Color property for syntax highlighting of SQL keywords.
238: */
239: public static final String STYLE_SQL_KEWORDS = "editor.sql-keywords";
240: /**
241: * Color property for syntax highlighting single line comments.
242: */
243: public static final String STYLE_SLINE_CMNTS = "editor.sline-comments";
244: /**
245: * Color property for syntax highlighting of string literals.
246: */
247: public static final String STYLE_LITERALS = "editor.literals";
248: /**
249: * Color property for syntax highlighting of sql functions.
250: */
251: public static final String STYLE_FUNCTIONS = "editor.functions";
252: /**
253: * Color property for syntax highlighting of sql & parameters.
254: */
255: public static final String STYLE_PARAMETERS = "editor.parameters";
256: /**
257: * Style preference for tablespace words like catalogs, and schema names.
258: */
259: public static final String STYLE_TABLESPACE = "editor.tablespace";
260:
261: public static final String STYLE_PROCEDURES = "editor.procedures";
262: public static final String STYLE_FOREIGN_OBJ = "editor.foreign-obj";
263: /**
264: * Font property for the SQL editor.
265: */
266: public static final String KEY_EDITOR_FONT = "editor.font";
267: /**
268: * Color property for syntax highlighting of multi-line commets such as /** comments
269: */
270: public static final String STYLE_MLINE_CMNTS = "editor.multicomment-color";
271: /**
272: * Color property for the Syste console foreground color.
273: */
274: public static final String KEY_CONSOLE_FG_COLOR = "console.foreground-color";
275: /**
276: * Default color for the console foreground.
277: */
278: public static final String DEF_CONSOLE_FG_COLOR = StringUtilities
279: .getHTMLColor(UIManager.getColor("TextArea.foreground"));
280:
281: /**
282: * Color property for the System console background color.
283: */
284: public static final String KEY_CONSOLE_BG_COLOR = "console.background-color";
285: /**
286: * Default color for the console background.
287: */
288: public static final String DEF_CONSOLE_BG_COLOR = StringUtilities
289: .getHTMLColor(UIManager.getColor("TextArea.background"));
290:
291: /**
292: * Color property of text that is printed using the System.out PrintStream.
293: */
294: public static final String KEY_CONSOLE_SYS_COLOR = "console.sys-color";
295: /**
296: * Color property of text that is printed using the System.err PrintStream.
297: */
298: public static final String KEY_CONSOLE_ERR_COLOR = "console.err-color";
299: /**
300: * Default HTML color for displaying errors in the iSQL-Viewer console.
301: */
302: public static final String DEF_CONSOLE_ERR_COLOR = "#FF0000";
303:
304: /**
305: * Color property for displaying text printed using the JDBC tracing streams.
306: */
307: public static final String KEY_CONSOLE_SQL_COLOR = "console.sql-color";
308: /**
309: * Font property for the iSQL console component.
310: */
311: public static final String KEY_CONSOLE_FONT = "console.font";
312: /**
313: * Default font property to use if none is previously set.
314: */
315: public static final String DEF_CONSOLE_FONT = "Monospaced,11";
316:
317: public static final String DEF_CONSOLE_SQL_COLOR = "#0000FF";
318:
319: /**
320: * String property that is the format of time in which to prepend to text being displayed.
321: */
322: public static final String KEY_CONSOLE_TIME_FMT = "console/timestamp-format";
323: /**
324: * Default time format if no preference is previously set.
325: */
326: public static final String DEF_CONSOLE_TIME_FMT = "[HH:mm:ss]";
327:
328: /**
329: * Integer property that determines which kind of history set to use.
330: */
331: public static final String KEY_HISTORY_STYLE = "history.style";
332: /**
333: * Integer property for the maximum number of days to keep a history item.
334: */
335: public static final String KEY_HISTORY_MAX_DAYS = "history.max-days";
336: /**
337: * Integer property for the maximum number of history items to manage at a time.
338: */
339: public static final String KEY_HISTORY_MAX_COUNT = "history.max-count";
340: /**
341: * Boolean property for browsing history items to be circular or not.
342: */
343: public static final String KEY_HISTORY_CONTINUOUS = "history.circular-enabled";
344: /**
345: * Boolean property that will discard duplicate history items.
346: */
347: public static final String KEY_HISTORY_DISCARD_DUPES = "history.duplicates-enabled";
348: /**
349: * Boolean property for enabling/disabling the use of CRC32 when detecting duplicate history items.
350: */
351: public static final String KEY_HISTORY_USECRC32 = "history.crc32-enabled";
352: /**
353: * Boolean property to determine if the history items of the current session are kept when manually cleared.
354: */
355: public static final String KEY_HISTORY_CLEAR_SESSION = "history.sessionclear-enabled";
356: /**
357: * Boolean property that enables a history that is not persisted to disk.
358: */
359: public static final String KEY_HISTORY_SESSION_ONLY = "history.persistent-enabled";
360: /**
361: * Boolean property that enabled the showing of hidden files when selecting a file or directory.
362: */
363: public static final String KEY_SHOW_HIDDEN_FILES = "general.hiddenfiles-enabled";
364: /**
365: * Integer property that sets the maximum number of ResultSets before unlocked tabs are reused.
366: */
367: public static final String MAX_QUERY_VIEWS = "general.max-resultsets";
368: /**
369: * Integer property of how tables are spread out across mutliple pages.
370: */
371: public static final String KEY_PRINT_GRID_STYLE = "print.table-style";
372: /**
373: * Boolean property to use color over monochrome when printing.
374: */
375: public static final String KEY_PRINT_USE_COLOR = "print.color-enabled";
376: /**
377: * Boolean property to include the table gridlines when printing.
378: */
379: public static final String KEY_PRINT_GRID = "print.grid-enabled";
380: /**
381: * Boolean property to include footer information on each page when printing.
382: */
383: public static final String KEY_PRINT_FOOTER = "print.footer-enabled";
384: /**
385: * Boolean property to include header information on each page when printing.
386: */
387: public static final String KEY_PRINT_HEADER = "print.header-enabled";
388: /**
389: * Boolean property that indicates the global preference of keeping iSQL service passwords secure.
390: */
391: public static final String KEY_ENABLE_SECURITY = "general.security-enabled";
392: /**
393: * String property that is used to seperate SQL statements when parsing batch files.
394: */
395: public static final String KEY_BATCH_SEPERATOR = "batch.seperator-char";
396: /**
397: * String property that is used to ignore data based on this value.
398: */
399: public static final String KEY_BATCH_COMMENT = "batch.comment-char";
400: /**
401: * String property used to identify string literals when parsing batch files.
402: */
403: public static final String KEY_BATCH_LITERAL = "batch.literal-char";
404: /**
405: * Integer property that indicates how statements are seperated in batch files.
406: */
407: public static final String KEY_BATCH_SEPERATOR_STYLE = "batch.seperator-style";
408: /**
409: * Integer property for the kind of comments to support when parsing batch files.
410: */
411: public static final String KEY_BATCH_COMMENT_STYLE = "batch.comment-style";
412: /**
413: * Integer property for the kind of literal style to used for parsing batch files.
414: */
415: public static final String KEY_BATCH_LITERAL_STYLE = "batch.literal-style";
416: /**
417: * Boolean property that will force all text into lower case form when parsing batch files.
418: */
419: public static final String KEY_BATCH_FORCE_LC = "batch.lowercase-enable";
420: /**
421: * Integer property to determine the page size of larger tables so that they can render faster.
422: */
423: public static final String TABLE_PAGING_SIZE = "general.tablepage-size";
424: /**
425: * String property for the preferred input/output format of Time values.
426: */
427: public static final String KEY_FORMAT_TIME = "general.time-format";
428: /**
429: * String property for the preferred input/output format of Timestamp values
430: */
431: public static final String KEY_FORMAT_TIMESTAMP = "general.timestamp-format";
432: /**
433: * String property for the preferred input/output format of Date values.
434: */
435: public static final String KEY_FORMAT_DATE = "general.date-format";
436: /**
437: * Boolean property to allow the double-click execution of SQL bookmarks.
438: */
439: public static final String KEY_BOOKMARK_ACTIVATE_STYLE = "bookmark.activation-style";
440: /**
441: * String property that is the preferred location of the bookmark drawer, ie Right, Left.
442: */
443: public static final String KEY_BOOKMARK_LOCATION = "bookmark.location";
444: /**
445: * Boolean property that determines wether to warn the user before deleting bookmarks, and folders.
446: */
447: public static final String KEY_BOOKMARK_DELETE_WARNING = "bookmarks.deletewarning-enabled";
448: /**
449: * Boolean property to enable debugging withing the ScriptManager.
450: */
451: public static final String KEY_SCRIPT_DEBUG = "scripting.debug-enabled";
452: /**
453: * String property of a localized path of directories to load scripts from.
454: */
455: public static final String KEY_SCRIPT_PATHS = "scripting.path";
456: /**
457: * Boolean property to filter out files that are not known to the script manager.
458: */
459: public static final String KEY_SCRIPT_FILTER_FILES = "scripting.filefilter-enabled";
460: /**
461: * String property for the preferred HTTP proxy host.
462: */
463: public static final String KEY_HTTP_PROXY_HOST = "advanced.httpproxy-host";
464: /**
465: * Integer property for the HTTP proxy port of use on the proxy host.
466: */
467: public static final String KEY_HTTP_PROXY_PORT = "advanced.httpproxy-port";
468: /**
469: * String property of the HTTP proxy user name to use.
470: */
471: public static final String KEY_HTTP_PROXY_USER = "advanced.httpproxy-user";
472: /**
473: * String property for the HTTP proxy password to use.
474: */
475: public static final String KEY_HTTP_PROXY_PASSW = "advanced.httpproxy-pass";
476: /**
477: * This value will indicate the prefix of session proeprties so it is easy to filter them out when preferences are
478: * saved to disk.
479: */
480: public static final String KEY_SESSION_PREFIX = "session.";
481: /**
482: * String value that is that last accessed file used.
483: */
484: public static final String KEY_SES_LAST_FILE = "session.last-location";
485: /**
486: * Boolean property to enable ASCII compatibility for UNICODE characters whenever nessecary.
487: * <p>
488: * Generally if this preference is true, there will be automatic encoding and decoding of ASCII UNICODE escape
489: * sequences of the form '\ uXXXX' where XXXX is the UNICODE value.
490: */
491: public static final String KEY_USE_ASCII_COMPATIBILITY = "general.ascii2native-enabled";
492: /**
493: * Boolean property to show statement that return an update count as a tab.
494: * <p>
495: * When a query is executed in the main SQLWOrkbench, this is true a tab will be created showing the updated count,
496: * and will have to be removed manually. otherwise if this is false the update count will be echoed to the
497: * System.out which ends up in the console window.
498: */
499: public static final String KEEP_UPDATE_RESULTS = "general.showupdatetab-enabled";
500:
501: private UserOptions() {
502:
503: // nothing to do here.//
504: }
505:
506: }
|