Example usage for java.util.prefs Preferences userNodeForPackage

List of usage examples for java.util.prefs Preferences userNodeForPackage

Introduction

In this page you can find the example usage for java.util.prefs Preferences userNodeForPackage.

Prototype

public static Preferences userNodeForPackage(Class<?> c) 

Source Link

Document

Returns the preference node from the calling user's preference tree that is associated (by convention) with the specified class's package.

Usage

From source file:fll.subjective.SubjectiveFrame.java

/**
 * Get the initial directory to which file dialogs should open. This supports
 * opening to a better directory across sessions.
 * /*from w ww.  ja  v a2 s  . c o m*/
 * @return the File for the initial directory
 */
private static File getInitialDirectory() {
    final Preferences preferences = Preferences.userNodeForPackage(SubjectiveFrame.class);
    final String path = preferences.get(INITIAL_DIRECTORY_PREFERENCE_KEY, null);

    File dir = null;
    if (null != path) {
        dir = new File(path);
    }
    return dir;
}

From source file:net.sf.jabref.JabRefPreferences.java

private JabRefPreferences() {
    try {//from ww  w. ja v  a 2 s .c om
        if (new File("jabref.xml").exists()) {
            importPreferences("jabref.xml");
        }
    } catch (JabRefException e) {
        LOGGER.warn("Could not import preferences from jabref.xml: " + e.getMessage(), e);
    }

    // load user preferences
    prefs = Preferences.userNodeForPackage(JabRefMain.class);

    defaults.put(TEXMAKER_PATH, JabRefDesktop.getNativeDesktop().detectProgramPath("texmaker", "Texmaker"));
    defaults.put(WIN_EDT_PATH,
            JabRefDesktop.getNativeDesktop().detectProgramPath("WinEdt", "WinEdt Team\\WinEdt"));
    defaults.put(LATEX_EDITOR_PATH, JabRefDesktop.getNativeDesktop().detectProgramPath("LEd", "LEd"));
    defaults.put(TEXSTUDIO_PATH, JabRefDesktop.getNativeDesktop().detectProgramPath("texstudio", "TeXstudio"));

    defaults.put(BIBLATEX_DEFAULT_MODE, false);

    if (OS.OS_X) {
        defaults.put(EMACS_PATH, "emacsclient");
        defaults.put(EMACS_23, true);
        defaults.put(EMACS_ADDITIONAL_PARAMETERS, "-n -e");
        defaults.put(FONT_FAMILY, "SansSerif");
        defaults.put(WIN_LOOK_AND_FEEL, UIManager.getSystemLookAndFeelClassName());

    } else if (OS.WINDOWS) {
        defaults.put(WIN_LOOK_AND_FEEL, "com.jgoodies.looks.windows.WindowsLookAndFeel");
        defaults.put(EMACS_PATH, "emacsclient.exe");
        defaults.put(EMACS_23, true);
        defaults.put(EMACS_ADDITIONAL_PARAMETERS, "-n -e");
        defaults.put(FONT_FAMILY, "Arial");

    } else {
        // Linux
        defaults.put(WIN_LOOK_AND_FEEL, "com.jgoodies.plaf.plastic.Plastic3DLookAndFeel");
        defaults.put(FONT_FAMILY, "SansSerif");

        defaults.put(EMACS_PATH, "gnuclient");
        defaults.put(EMACS_23, false);
        defaults.put(EMACS_ADDITIONAL_PARAMETERS, "-batch -eval");
    }
    defaults.put(PUSH_TO_APPLICATION, "TeXstudio");

    defaults.put(RECENT_FILES, "");
    defaults.put(EXTERNAL_FILE_TYPES, "");
    defaults.put(KEY_PATTERN_REGEX, "");
    defaults.put(KEY_PATTERN_REPLACEMENT, "");

    // Proxy
    defaults.put(PROXY_USE, Boolean.FALSE);
    defaults.put(PROXY_HOSTNAME, "");
    defaults.put(PROXY_PORT, "80");
    defaults.put(PROXY_USE_AUTHENTICATION, Boolean.FALSE);
    defaults.put(PROXY_USERNAME, "");
    defaults.put(PROXY_PASSWORD, "");

    defaults.put(USE_DEFAULT_LOOK_AND_FEEL, Boolean.TRUE);
    defaults.put(LYXPIPE, USER_HOME + File.separator + ".lyx/lyxpipe");
    defaults.put(VIM, "vim");
    defaults.put(VIM_SERVER, "vim");
    defaults.put(POS_X, 0);
    defaults.put(POS_Y, 0);
    defaults.put(SIZE_X, 1024);
    defaults.put(SIZE_Y, 768);
    defaults.put(WINDOW_MAXIMISED, Boolean.FALSE);
    defaults.put(AUTO_RESIZE_MODE, JTable.AUTO_RESIZE_ALL_COLUMNS);
    defaults.put(PREVIEW_PANEL_HEIGHT, 200);
    defaults.put(ENTRY_EDITOR_HEIGHT, 400);
    defaults.put(TABLE_COLOR_CODES_ON, Boolean.FALSE);
    defaults.put(NAMES_AS_IS, Boolean.FALSE); // "Show names unchanged"
    defaults.put(NAMES_FIRST_LAST, Boolean.FALSE); // "Show 'Firstname Lastname'"
    defaults.put(NAMES_NATBIB, Boolean.TRUE); // "Natbib style"
    defaults.put(ABBR_AUTHOR_NAMES, Boolean.TRUE); // "Abbreviate names"
    defaults.put(NAMES_LAST_ONLY, Boolean.TRUE); // "Show last names only"
    // system locale as default
    defaults.put(LANGUAGE, Locale.getDefault().getLanguage());

    // Sorting preferences
    defaults.put(TABLE_PRIMARY_SORT_FIELD, "author");
    defaults.put(TABLE_PRIMARY_SORT_DESCENDING, Boolean.FALSE);
    defaults.put(TABLE_SECONDARY_SORT_FIELD, "year");
    defaults.put(TABLE_SECONDARY_SORT_DESCENDING, Boolean.TRUE);
    defaults.put(TABLE_TERTIARY_SORT_FIELD, "title");
    defaults.put(TABLE_TERTIARY_SORT_DESCENDING, Boolean.FALSE);

    defaults.put(REFORMAT_FILE_ON_SAVE_AND_EXPORT, Boolean.FALSE);

    // export order
    defaults.put(EXPORT_IN_ORIGINAL_ORDER, Boolean.FALSE);
    defaults.put(EXPORT_IN_SPECIFIED_ORDER, Boolean.FALSE);

    // export order: if EXPORT_IN_SPECIFIED_ORDER, then use following criteria
    defaults.put(EXPORT_PRIMARY_SORT_FIELD, "bibtexkey");
    defaults.put(EXPORT_PRIMARY_SORT_DESCENDING, Boolean.FALSE);
    defaults.put(EXPORT_SECONDARY_SORT_FIELD, "author");
    defaults.put(EXPORT_SECONDARY_SORT_DESCENDING, Boolean.FALSE);
    defaults.put(EXPORT_TERTIARY_SORT_FIELD, "title");
    defaults.put(EXPORT_TERTIARY_SORT_DESCENDING, Boolean.TRUE);

    defaults.put(NEWLINE, System.lineSeparator());

    defaults.put(SIDE_PANE_COMPONENT_NAMES, "");
    defaults.put(SIDE_PANE_COMPONENT_PREFERRED_POSITIONS, "");

    defaults.put(COLUMN_NAMES, "entrytype;author/editor;title;year;journal/booktitle;bibtexkey");
    defaults.put(COLUMN_WIDTHS, "75;300;470;60;130;100");
    defaults.put(PersistenceTableColumnListener.ACTIVATE_PREF_KEY,
            PersistenceTableColumnListener.DEFAULT_ENABLED);
    defaults.put(XMP_PRIVACY_FILTERS, "pdf;timestamp;keywords;owner;note;review");
    defaults.put(USE_XMP_PRIVACY_FILTER, Boolean.FALSE);
    defaults.put(NUMBER_COL_WIDTH, GUIGlobals.NUMBER_COL_LENGTH);
    defaults.put(WORKING_DIRECTORY, USER_HOME);
    defaults.put(EXPORT_WORKING_DIRECTORY, USER_HOME);
    // Remembers working directory of last import
    defaults.put(IMPORT_WORKING_DIRECTORY, USER_HOME);
    defaults.put(FILE_WORKING_DIRECTORY, USER_HOME);
    defaults.put(AUTO_OPEN_FORM, Boolean.TRUE);
    defaults.put(BACKUP, Boolean.TRUE);
    defaults.put(OPEN_LAST_EDITED, Boolean.TRUE);
    defaults.put(LAST_EDITED, "");
    defaults.put(LAST_FOCUSED, "");
    defaults.put(STRINGS_POS_X, 0);
    defaults.put(STRINGS_POS_Y, 0);
    defaults.put(STRINGS_SIZE_X, 600);
    defaults.put(STRINGS_SIZE_Y, 400);
    defaults.put(DUPLICATES_POS_X, 0);
    defaults.put(DUPLICATES_POS_Y, 0);
    defaults.put(DUPLICATES_SIZE_X, 800);
    defaults.put(DUPLICATES_SIZE_Y, 600);
    defaults.put(MERGEENTRIES_POS_X, 0);
    defaults.put(MERGEENTRIES_POS_Y, 0);
    defaults.put(MERGEENTRIES_SIZE_X, 800);
    defaults.put(MERGEENTRIES_SIZE_Y, 600);
    defaults.put(PREAMBLE_POS_X, 0);
    defaults.put(PREAMBLE_POS_Y, 0);
    defaults.put(PREAMBLE_SIZE_X, 600);
    defaults.put(PREAMBLE_SIZE_Y, 400);
    defaults.put(DEFAULT_SHOW_SOURCE, Boolean.FALSE);
    defaults.put(DEFAULT_AUTO_SORT, Boolean.FALSE);
    defaults.put(SEARCH_CASE_SENSITIVE, Boolean.FALSE);
    defaults.put(SEARCH_MODE_FILTER, Boolean.TRUE);

    defaults.put(SEARCH_REG_EXP, Boolean.FALSE);
    defaults.put(SEARCH_PANE_POS_X, 0);
    defaults.put(SEARCH_PANE_POS_Y, 0);

    defaults.put(MERGE_ENTRIES_DIFF_MODE, 2);

    defaults.put(EDITOR_EMACS_KEYBINDINGS, Boolean.FALSE);
    defaults.put(EDITOR_EMACS_KEYBINDINGS_REBIND_CA, Boolean.TRUE);
    defaults.put(EDITOR_EMACS_KEYBINDINGS_REBIND_CF, Boolean.TRUE);
    defaults.put(AUTO_COMPLETE, Boolean.TRUE);
    AutoCompletePreferences.putDefaults(defaults);
    defaults.put(GROUP_FLOAT_SELECTIONS, Boolean.TRUE);
    defaults.put(GROUP_INTERSECT_SELECTIONS, Boolean.TRUE);
    defaults.put(GROUP_INVERT_SELECTIONS, Boolean.FALSE);
    defaults.put(GROUP_SHOW_OVERLAPPING, Boolean.FALSE);
    defaults.put(GROUP_SELECT_MATCHES, Boolean.FALSE);
    defaults.put(GROUPS_DEFAULT_FIELD, "keywords");
    defaults.put(GROUP_SHOW_ICONS, Boolean.TRUE);
    defaults.put(GROUP_SHOW_DYNAMIC, Boolean.TRUE);
    defaults.put(GROUP_EXPAND_TREE, Boolean.TRUE);
    defaults.put(GROUP_AUTO_SHOW, Boolean.TRUE);
    defaults.put(GROUP_AUTO_HIDE, Boolean.TRUE);
    defaults.put(GROUP_SHOW_NUMBER_OF_ELEMENTS, Boolean.FALSE);
    defaults.put(AUTO_ASSIGN_GROUP, Boolean.TRUE);
    defaults.put(GROUP_KEYWORD_SEPARATOR, ", ");
    defaults.put(EDIT_GROUP_MEMBERSHIP_MODE, Boolean.FALSE);
    defaults.put(HIGHLIGHT_GROUPS_MATCHING, "");
    defaults.put(TOOLBAR_VISIBLE, Boolean.TRUE);
    defaults.put(DEFAULT_ENCODING, StandardCharsets.UTF_8.name());
    defaults.put(GROUPS_VISIBLE_ROWS, 8);
    defaults.put(DEFAULT_OWNER, System.getProperty("user.name"));
    defaults.put(MEMORY_STICK_MODE, Boolean.FALSE);
    defaults.put(RENAME_ON_MOVE_FILE_TO_FILE_DIR, Boolean.TRUE);

    // The general fields stuff is made obsolete by the CUSTOM_TAB_... entries.
    defaults.put(GENERAL_FIELDS, "crossref;keywords;file;doi;url;urldate;" + "pdf;comment;owner");

    defaults.put(FONT_STYLE, java.awt.Font.PLAIN);
    defaults.put(FONT_SIZE, 12);
    defaults.put(OVERRIDE_DEFAULT_FONTS, Boolean.FALSE);
    defaults.put(MENU_FONT_SIZE, 11);
    defaults.put(TABLE_ROW_PADDING, GUIGlobals.TABLE_ROW_PADDING);
    defaults.put(TABLE_SHOW_GRID, Boolean.FALSE);
    // Main table color settings:
    defaults.put(TABLE_BACKGROUND, "255:255:255");
    defaults.put(TABLE_REQ_FIELD_BACKGROUND, "230:235:255");
    defaults.put(TABLE_OPT_FIELD_BACKGROUND, "230:255:230");
    defaults.put(TABLE_TEXT, "0:0:0");
    defaults.put(GRID_COLOR, "210:210:210");
    defaults.put(GRAYED_OUT_BACKGROUND, "210:210:210");
    defaults.put(GRAYED_OUT_TEXT, "40:40:40");
    defaults.put(VERY_GRAYED_OUT_BACKGROUND, "180:180:180");
    defaults.put(VERY_GRAYED_OUT_TEXT, "40:40:40");
    defaults.put(MARKED_ENTRY_BACKGROUND0, "255:255:180");
    defaults.put(MARKED_ENTRY_BACKGROUND1, "255:220:180");
    defaults.put(MARKED_ENTRY_BACKGROUND2, "255:180:160");
    defaults.put(MARKED_ENTRY_BACKGROUND3, "255:120:120");
    defaults.put(MARKED_ENTRY_BACKGROUND4, "255:75:75");
    defaults.put(MARKED_ENTRY_BACKGROUND5, "220:255:220");
    defaults.put(VALID_FIELD_BACKGROUND_COLOR, "255:255:255");
    defaults.put(INVALID_FIELD_BACKGROUND_COLOR, "255:0:0");
    defaults.put(ACTIVE_FIELD_EDITOR_BACKGROUND_COLOR, "220:220:255");
    defaults.put(FIELD_EDITOR_TEXT_COLOR, "0:0:0");

    defaults.put(INCOMPLETE_ENTRY_BACKGROUND, "250:175:175");

    defaults.put(CTRL_CLICK, Boolean.FALSE);
    defaults.put(DISABLE_ON_MULTIPLE_SELECTION, Boolean.FALSE);
    defaults.put(URL_COLUMN, Boolean.TRUE);
    defaults.put(PREFER_URL_DOI, Boolean.FALSE);
    defaults.put(FILE_COLUMN, Boolean.TRUE);
    defaults.put(ARXIV_COLUMN, Boolean.FALSE);

    defaults.put(EXTRA_FILE_COLUMNS, Boolean.FALSE);
    defaults.put(LIST_OF_FILE_COLUMNS, "");

    // OpenOffice/LibreOffice
    if (OS.WINDOWS) {
        defaults.put(JabRefPreferences.OO_PATH, OpenOfficePreferences.DEFAULT_WINDOWS_PATH);
        defaults.put(JabRefPreferences.OO_EXECUTABLE_PATH, OpenOfficePreferences.DEFAULT_WINDOWS_PATH
                + OpenOfficePreferences.WINDOWS_EXECUTABLE_SUBPATH + OpenOfficePreferences.WINDOWS_EXECUTABLE);
        defaults.put(JabRefPreferences.OO_JARS_PATH,
                OpenOfficePreferences.DEFAULT_WINDOWS_PATH + OpenOfficePreferences.WINDOWS_JARS_SUBPATH);
    } else if (OS.OS_X) {
        defaults.put(JabRefPreferences.OO_PATH, OpenOfficePreferences.DEFAULT_OSX_PATH);
        defaults.put(JabRefPreferences.OO_EXECUTABLE_PATH, OpenOfficePreferences.DEFAULT_OSX_PATH
                + OpenOfficePreferences.OSX_EXECUTABLE_SUBPATH + OpenOfficePreferences.OSX_EXECUTABLE);
        defaults.put(JabRefPreferences.OO_JARS_PATH,
                OpenOfficePreferences.DEFAULT_OSX_PATH + OpenOfficePreferences.OSX_JARS_SUBPATH);
    } else { // Linux
        defaults.put(JabRefPreferences.OO_PATH, "/opt/openoffice.org3");
        defaults.put(JabRefPreferences.OO_EXECUTABLE_PATH, "/usr/lib/openoffice/program/soffice");
        defaults.put(JabRefPreferences.OO_JARS_PATH, "/opt/openoffice.org/basis3.0");
    }

    defaults.put(JabRefPreferences.OO_SYNC_WHEN_CITING, false);
    defaults.put(JabRefPreferences.OO_SHOW_PANEL, false);
    defaults.put(JabRefPreferences.OO_USE_ALL_OPEN_BASES, true);
    defaults.put(JabRefPreferences.OO_BIBLIOGRAPHY_STYLE_FILE, StyleLoader.DEFAULT_AUTHORYEAR_STYLE_PATH);
    defaults.put(JabRefPreferences.OO_EXTERNAL_STYLE_FILES, "");
    defaults.put(STYLES_POS_X, 0);
    defaults.put(STYLES_POS_Y, 0);
    defaults.put(STYLES_SIZE_X, 600);
    defaults.put(STYLES_SIZE_Y, 400);

    defaults.put(SpecialFieldsUtils.PREF_SPECIALFIELDSENABLED,
            SpecialFieldsUtils.PREF_SPECIALFIELDSENABLED_DEFAULT);
    defaults.put(SpecialFieldsUtils.PREF_SHOWCOLUMN_PRIORITY,
            SpecialFieldsUtils.PREF_SHOWCOLUMN_PRIORITY_DEFAULT);
    defaults.put(SpecialFieldsUtils.PREF_SHOWCOLUMN_QUALITY,
            SpecialFieldsUtils.PREF_SHOWCOLUMN_QUALITY_DEFAULT);
    defaults.put(SpecialFieldsUtils.PREF_SHOWCOLUMN_RANKING,
            SpecialFieldsUtils.PREF_SHOWCOLUMN_RANKING_DEFAULT);
    defaults.put(SpecialFieldsUtils.PREF_SHOWCOLUMN_RELEVANCE,
            SpecialFieldsUtils.PREF_SHOWCOLUMN_RELEVANCE_DEFAULT);
    defaults.put(SpecialFieldsUtils.PREF_SHOWCOLUMN_PRINTED,
            SpecialFieldsUtils.PREF_SHOWCOLUMN_PRINTED_DEFAULT);
    defaults.put(SpecialFieldsUtils.PREF_SHOWCOLUMN_READ, SpecialFieldsUtils.PREF_SHOWCOLUMN_READ_DEFAULT);
    defaults.put(SpecialFieldsUtils.PREF_AUTOSYNCSPECIALFIELDSTOKEYWORDS,
            SpecialFieldsUtils.PREF_AUTOSYNCSPECIALFIELDSTOKEYWORDS_DEFAULT);
    defaults.put(SpecialFieldsUtils.PREF_SERIALIZESPECIALFIELDS,
            SpecialFieldsUtils.PREF_SERIALIZESPECIALFIELDS_DEFAULT);

    defaults.put(USE_OWNER, Boolean.FALSE);
    defaults.put(OVERWRITE_OWNER, Boolean.FALSE);
    defaults.put(DIALOG_WARNING_FOR_DUPLICATE_KEY, Boolean.TRUE);
    defaults.put(DIALOG_WARNING_FOR_EMPTY_KEY, Boolean.TRUE);
    defaults.put(DISPLAY_KEY_WARNING_DIALOG_AT_STARTUP, Boolean.TRUE);
    defaults.put(AVOID_OVERWRITING_KEY, Boolean.FALSE);
    defaults.put(WARN_BEFORE_OVERWRITING_KEY, Boolean.TRUE);
    defaults.put(CONFIRM_DELETE, Boolean.TRUE);
    defaults.put(GRAY_OUT_NON_HITS, Boolean.TRUE);
    defaults.put(SEARCH_MODE_FLOAT, Boolean.FALSE);
    defaults.put(DEFAULT_LABEL_PATTERN, "[authors3][year]");
    defaults.put(PREVIEW_ENABLED, Boolean.TRUE);
    defaults.put(ACTIVE_PREVIEW, 0);
    defaults.put(PREVIEW_0, "<font face=\"sans-serif\">"
            + "<b><i>\\bibtextype</i><a name=\"\\bibtexkey\">\\begin{bibtexkey} (\\bibtexkey)</a>"
            + "\\end{bibtexkey}</b><br>__NEWLINE__"
            + "\\begin{author} \\format[Authors(LastFirst,Initials,Semicolon,Amp),HTMLChars]{\\author}<BR>\\end{author}__NEWLINE__"
            + "\\begin{editor} \\format[Authors(LastFirst,Initials,Semicolon,Amp),HTMLChars]{\\editor} "
            + "<i>(\\format[IfPlural(Eds.,Ed.)]{\\editor})</i><BR>\\end{editor}__NEWLINE__"
            + "\\begin{title} \\format[HTMLChars]{\\title} \\end{title}<BR>__NEWLINE__"
            + "\\begin{chapter} \\format[HTMLChars]{\\chapter}<BR>\\end{chapter}__NEWLINE__"
            + "\\begin{journal} <em>\\format[HTMLChars]{\\journal}, </em>\\end{journal}__NEWLINE__"
            // Include the booktitle field for @inproceedings, @proceedings, etc.
            + "\\begin{booktitle} <em>\\format[HTMLChars]{\\booktitle}, </em>\\end{booktitle}__NEWLINE__"
            + "\\begin{school} <em>\\format[HTMLChars]{\\school}, </em>\\end{school}__NEWLINE__"
            + "\\begin{institution} <em>\\format[HTMLChars]{\\institution}, </em>\\end{institution}__NEWLINE__"
            + "\\begin{publisher} <em>\\format[HTMLChars]{\\publisher}, </em>\\end{publisher}__NEWLINE__"
            + "\\begin{year}<b>\\year</b>\\end{year}\\begin{volume}<i>, \\volume</i>\\end{volume}"
            + "\\begin{pages}, \\format[FormatPagesForHTML]{\\pages} \\end{pages}__NEWLINE__"
            + "\\begin{abstract}<BR><BR><b>Abstract: </b> \\format[HTMLChars]{\\abstract} \\end{abstract}__NEWLINE__"
            + "\\begin{review}<BR><BR><b>Review: </b> \\format[HTMLChars]{\\review} \\end{review}"
            + "</dd>__NEWLINE__<p></p></font>");
    defaults.put(PREVIEW_1, "<font face=\"sans-serif\">"
            + "<b><i>\\bibtextype</i><a name=\"\\bibtexkey\">\\begin{bibtexkey} (\\bibtexkey)</a>"
            + "\\end{bibtexkey}</b><br>__NEWLINE__"
            + "\\begin{author} \\format[Authors(LastFirst,Initials,Semicolon,Amp),HTMLChars]{\\author}<BR>\\end{author}__NEWLINE__"
            + "\\begin{editor} \\format[Authors(LastFirst,Initials,Semicolon,Amp),HTMLChars]{\\editor} "
            + "<i>(\\format[IfPlural(Eds.,Ed.)]{\\editor})</i><BR>\\end{editor}__NEWLINE__"
            + "\\begin{title} \\format[HTMLChars]{\\title} \\end{title}<BR>__NEWLINE__"
            + "\\begin{chapter} \\format[HTMLChars]{\\chapter}<BR>\\end{chapter}__NEWLINE__"
            + "\\begin{journal} <em>\\format[HTMLChars]{\\journal}, </em>\\end{journal}__NEWLINE__"
            // Include the booktitle field for @inproceedings, @proceedings, etc.
            + "\\begin{booktitle} <em>\\format[HTMLChars]{\\booktitle}, </em>\\end{booktitle}__NEWLINE__"
            + "\\begin{school} <em>\\format[HTMLChars]{\\school}, </em>\\end{school}__NEWLINE__"
            + "\\begin{institution} <em>\\format[HTMLChars]{\\institution}, </em>\\end{institution}__NEWLINE__"
            + "\\begin{publisher} <em>\\format[HTMLChars]{\\publisher}, </em>\\end{publisher}__NEWLINE__"
            + "\\begin{year}<b>\\year</b>\\end{year}\\begin{volume}<i>, \\volume</i>\\end{volume}"
            + "\\begin{pages}, \\format[FormatPagesForHTML]{\\pages} \\end{pages}"
            + "</dd>__NEWLINE__<p></p></font>");

    // TODO: Currently not possible to edit this setting:
    defaults.put(PREVIEW_PRINT_BUTTON, Boolean.FALSE);
    defaults.put(DO_NOT_RESOLVE_STRINGS_FOR, "url");
    defaults.put(RESOLVE_STRINGS_ALL_FIELDS, Boolean.FALSE);
    defaults.put(PUT_BRACES_AROUND_CAPITALS, "");//"title;journal;booktitle;review;abstract");
    defaults.put(NON_WRAPPABLE_FIELDS, "pdf;ps;url;doi;file");
    defaults.put(GENERATE_KEYS_AFTER_INSPECTION, Boolean.TRUE);
    defaults.put(MARK_IMPORTED_ENTRIES, Boolean.TRUE);
    defaults.put(UNMARK_ALL_ENTRIES_BEFORE_IMPORTING, Boolean.TRUE);
    defaults.put(WARN_ABOUT_DUPLICATES_IN_INSPECTION, Boolean.TRUE);
    defaults.put(USE_TIME_STAMP, Boolean.FALSE);
    defaults.put(OVERWRITE_TIME_STAMP, Boolean.FALSE);

    // default time stamp follows ISO-8601. Reason: https://xkcd.com/1179/
    defaults.put(TIME_STAMP_FORMAT, "yyyy-MM-dd");

    defaults.put(TIME_STAMP_FIELD, InternalBibtexFields.TIMESTAMP);
    defaults.put(UPDATE_TIMESTAMP, Boolean.FALSE);

    defaults.put(GENERATE_KEYS_BEFORE_SAVING, Boolean.FALSE);

    defaults.put(RemotePreferences.USE_REMOTE_SERVER, Boolean.TRUE);
    defaults.put(RemotePreferences.REMOTE_SERVER_PORT, 6050);

    defaults.put(PERSONAL_JOURNAL_LIST, "");
    defaults.put(EXTERNAL_JOURNAL_LISTS, "");
    defaults.put(CITE_COMMAND, "\\cite"); // obsoleted by the app-specific ones (not any more?)
    defaults.put(FLOAT_MARKED_ENTRIES, Boolean.TRUE);

    defaults.put(LAST_USED_EXPORT, "");
    defaults.put(SIDE_PANE_WIDTH, -1);

    defaults.put(IMPORT_INSPECTION_DIALOG_WIDTH, 650);
    defaults.put(IMPORT_INSPECTION_DIALOG_HEIGHT, 650);
    defaults.put(SEARCH_DIALOG_WIDTH, 650);
    defaults.put(SEARCH_DIALOG_HEIGHT, 500);
    defaults.put(SHOW_FILE_LINKS_UPGRADE_WARNING, Boolean.TRUE);
    defaults.put(AUTOLINK_EXACT_KEY_ONLY, Boolean.FALSE);
    defaults.put(NUMERIC_FIELDS, "mittnum;author");
    defaults.put(RUN_AUTOMATIC_FILE_SEARCH, Boolean.FALSE);
    defaults.put(USE_LOCK_FILES, Boolean.TRUE);
    defaults.put(AUTO_SAVE, Boolean.TRUE);
    defaults.put(AUTO_SAVE_INTERVAL, 5);
    defaults.put(PROMPT_BEFORE_USING_AUTOSAVE, Boolean.TRUE);
    defaults.put(ENFORCE_LEGAL_BIBTEX_KEY, Boolean.TRUE);
    // Curly brackets ({}) are the default delimiters, not quotes (") as these cause trouble when they appear within the field value:
    // Currently, JabRef does not escape them
    defaults.put(VALUE_DELIMITERS2, 1);
    defaults.put(KEY_GEN_FIRST_LETTER_A, Boolean.TRUE);
    defaults.put(KEY_GEN_ALWAYS_ADD_LETTER, Boolean.FALSE);
    defaults.put(EMAIL_SUBJECT, Localization.lang("References"));
    defaults.put(OPEN_FOLDERS_OF_ATTACHED_FILES, Boolean.FALSE);
    defaults.put(ALLOW_FILE_AUTO_OPEN_BROWSE, Boolean.TRUE);
    defaults.put(WEB_SEARCH_VISIBLE, Boolean.FALSE);
    defaults.put(SELECTED_FETCHER_INDEX, 0);
    defaults.put(BIB_LOC_AS_PRIMARY_DIR, Boolean.FALSE);
    defaults.put(DB_CONNECT_SERVER_TYPE, "MySQL");
    defaults.put(DB_CONNECT_HOSTNAME, "localhost");
    defaults.put(DB_CONNECT_DATABASE, "jabref");
    defaults.put(DB_CONNECT_USERNAME, "root");

    defaults.put(AKS_AUTO_NAMING_PDFS_AGAIN, Boolean.TRUE);
    insertCleanupPreset(defaults, CLEANUP_DEFAULT_PRESET);

    // defaults for DroppedFileHandler UI
    defaults.put(DroppedFileHandler.DFH_LEAVE, Boolean.FALSE);
    defaults.put(DroppedFileHandler.DFH_COPY, Boolean.TRUE);
    defaults.put(DroppedFileHandler.DFH_MOVE, Boolean.FALSE);
    defaults.put(DroppedFileHandler.DFH_RENAME, Boolean.FALSE);

    //defaults.put("lastAutodetectedImport", "");
    //defaults.put("autoRemoveExactDuplicates", Boolean.FALSE);
    //defaults.put("confirmAutoRemoveExactDuplicates", Boolean.TRUE);
    //defaults.put("tempDir", System.getProperty("java.io.tmpdir"));
    LOGGER.debug("Temporary directory: " + System.getProperty("java.io.tempdir"));
    //defaults.put("keyPattern", new LabelPattern(KEY_PATTERN));

    defaults.put(PREF_IMPORT_ALWAYSUSE, Boolean.FALSE);
    defaults.put(PREF_IMPORT_DEFAULT_PDF_IMPORT_STYLE, ImportSettingsTab.DEFAULT_STYLE);

    // use BibTeX key appended with filename as default pattern
    defaults.put(PREF_IMPORT_FILENAMEPATTERN, ImportSettingsTab.DEFAULT_FILENAMEPATTERNS[1]);

    customExports = new CustomExportList(new ExportComparator());
    customImports = new CustomImportList(this);

    updateSpecialFieldHandling();
    WRAPPED_USERNAME = '[' + get(DEFAULT_OWNER) + ']';
    MARKING_WITH_NUMBER_PATTERN = "\\[" + get(DEFAULT_OWNER).replaceAll("\\\\", "\\\\\\\\") + ":(\\d+)\\]";

    String defaultExpression = "**/.*[bibtexkey].*\\\\.[extension]";
    defaults.put(DEFAULT_REG_EXP_SEARCH_EXPRESSION_KEY, defaultExpression);
    defaults.put(REG_EXP_SEARCH_EXPRESSION_KEY, defaultExpression);
    defaults.put(AUTOLINK_USE_REG_EXP_SEARCH_KEY, Boolean.FALSE);
    defaults.put(USE_IEEE_ABRV, Boolean.FALSE);
    defaults.put(USE_CONVERT_TO_EQUATION, Boolean.FALSE);
    defaults.put(USE_CASE_KEEPER_ON_SEARCH, Boolean.TRUE);
    defaults.put(USE_UNIT_FORMATTER_ON_SEARCH, Boolean.TRUE);
}

From source file:com.holycityaudio.SpinCAD.SpinCADFile.java

private void saveRecentBankFileList() {
    StringBuilder sb = new StringBuilder(128);
    if (recentBankFileList != null) {
        int k = recentBankFileList.listModel.getSize() - 1;
        for (int index = 0; index <= k; index++) {
            File file = recentBankFileList.listModel.getElementAt(k - index);
            if (sb.length() > 0) {
                sb.append(File.pathSeparator);
            }/*from   ww w.j  a va2  s . co  m*/
            sb.append(file.getPath());
        }
        Preferences p = Preferences.userNodeForPackage(RecentFileList.class);
        p.put("RecentBankFileList.fileList", sb.toString());
    }
}

From source file:com.holycityaudio.SpinCAD.SpinCADFile.java

private void loadRecentBankFileList() {
    Preferences p = Preferences.userNodeForPackage(RecentFileList.class);
    String listOfFiles = p.get("RecentBankFileList.fileList", null);
    if (fc == null) {
        String savedPath = prefs.get("MRUBankFolder", "");
        File MRUBankFolder = new File(savedPath);
        fc = new JFileChooser(MRUBankFolder);
        recentBankFileList = new RecentFileList(fc);
        if (listOfFiles != null) {
            String[] files = listOfFiles.split(File.pathSeparator);
            for (String fileRef : files) {
                File file = new File(fileRef);
                if (file.exists()) {
                    recentBankFileList.listModel.add(file);
                }//ww w .j a v  a  2 s. c  om
            }
        }
        fc.setAccessory(recentBankFileList);
        fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
    }
}

From source file:net.sf.jabref.preferences.JabRefPreferences.java

private JabRefPreferences() {
    try {//from w  w w .ja va  2s  . co  m
        if (new File("jabref.xml").exists()) {
            importPreferences("jabref.xml");
        }
    } catch (JabRefException e) {
        LOGGER.warn("Could not import preferences from jabref.xml: " + e.getMessage(), e);
    }

    // load user preferences
    prefs = Preferences.userNodeForPackage(JabRefMain.class);

    defaults.put(TEXMAKER_PATH, JabRefDesktop.getNativeDesktop().detectProgramPath("texmaker", "Texmaker"));
    defaults.put(WIN_EDT_PATH,
            JabRefDesktop.getNativeDesktop().detectProgramPath("WinEdt", "WinEdt Team\\WinEdt"));
    defaults.put(LATEX_EDITOR_PATH, JabRefDesktop.getNativeDesktop().detectProgramPath("LEd", "LEd"));
    defaults.put(TEXSTUDIO_PATH, JabRefDesktop.getNativeDesktop().detectProgramPath("texstudio", "TeXstudio"));

    defaults.put(BIBLATEX_DEFAULT_MODE, false);

    if (OS.OS_X) {
        defaults.put(EMACS_PATH, "emacsclient");
        defaults.put(EMACS_23, true);
        defaults.put(EMACS_ADDITIONAL_PARAMETERS, "-n -e");
        defaults.put(FONT_FAMILY, "SansSerif");
        defaults.put(WIN_LOOK_AND_FEEL, UIManager.getSystemLookAndFeelClassName());

    } else if (OS.WINDOWS) {
        defaults.put(WIN_LOOK_AND_FEEL, "com.jgoodies.looks.windows.WindowsLookAndFeel");
        defaults.put(EMACS_PATH, "emacsclient.exe");
        defaults.put(EMACS_23, true);
        defaults.put(EMACS_ADDITIONAL_PARAMETERS, "-n -e");
        defaults.put(FONT_FAMILY, "Arial");

    } else {
        // Linux
        defaults.put(WIN_LOOK_AND_FEEL, "com.jgoodies.plaf.plastic.Plastic3DLookAndFeel");
        defaults.put(FONT_FAMILY, "SansSerif");

        defaults.put(EMACS_PATH, "gnuclient");
        defaults.put(EMACS_23, false);
        defaults.put(EMACS_ADDITIONAL_PARAMETERS, "-batch -eval");
    }
    defaults.put(PUSH_TO_APPLICATION, "TeXstudio");

    defaults.put(RECENT_FILES, "");
    defaults.put(EXTERNAL_FILE_TYPES, "");
    defaults.put(KEY_PATTERN_REGEX, "");
    defaults.put(KEY_PATTERN_REPLACEMENT, "");

    // Proxy
    defaults.put(PROXY_USE, Boolean.FALSE);
    defaults.put(PROXY_HOSTNAME, "");
    defaults.put(PROXY_PORT, "80");
    defaults.put(PROXY_USE_AUTHENTICATION, Boolean.FALSE);
    defaults.put(PROXY_USERNAME, "");
    defaults.put(PROXY_PASSWORD, "");

    defaults.put(USE_DEFAULT_LOOK_AND_FEEL, Boolean.TRUE);
    defaults.put(LYXPIPE, USER_HOME + File.separator + ".lyx/lyxpipe");
    defaults.put(VIM, "vim");
    defaults.put(VIM_SERVER, "vim");
    defaults.put(POS_X, 0);
    defaults.put(POS_Y, 0);
    defaults.put(SIZE_X, 1024);
    defaults.put(SIZE_Y, 768);
    defaults.put(WINDOW_MAXIMISED, Boolean.FALSE);
    defaults.put(AUTO_RESIZE_MODE, JTable.AUTO_RESIZE_ALL_COLUMNS);
    defaults.put(PREVIEW_PANEL_HEIGHT, 200);
    defaults.put(ENTRY_EDITOR_HEIGHT, 400);
    defaults.put(TABLE_COLOR_CODES_ON, Boolean.FALSE);
    defaults.put(NAMES_AS_IS, Boolean.FALSE); // "Show names unchanged"
    defaults.put(NAMES_FIRST_LAST, Boolean.FALSE); // "Show 'Firstname Lastname'"
    defaults.put(NAMES_NATBIB, Boolean.TRUE); // "Natbib style"
    defaults.put(ABBR_AUTHOR_NAMES, Boolean.TRUE); // "Abbreviate names"
    defaults.put(NAMES_LAST_ONLY, Boolean.TRUE); // "Show last names only"
    // system locale as default
    defaults.put(LANGUAGE, Locale.getDefault().getLanguage());

    // Sorting preferences
    defaults.put(TABLE_PRIMARY_SORT_FIELD, FieldName.AUTHOR);
    defaults.put(TABLE_PRIMARY_SORT_DESCENDING, Boolean.FALSE);
    defaults.put(TABLE_SECONDARY_SORT_FIELD, FieldName.YEAR);
    defaults.put(TABLE_SECONDARY_SORT_DESCENDING, Boolean.TRUE);
    defaults.put(TABLE_TERTIARY_SORT_FIELD, FieldName.TITLE);
    defaults.put(TABLE_TERTIARY_SORT_DESCENDING, Boolean.FALSE);

    defaults.put(REFORMAT_FILE_ON_SAVE_AND_EXPORT, Boolean.FALSE);

    // export order
    defaults.put(EXPORT_IN_ORIGINAL_ORDER, Boolean.FALSE);
    defaults.put(EXPORT_IN_SPECIFIED_ORDER, Boolean.FALSE);

    // export order: if EXPORT_IN_SPECIFIED_ORDER, then use following criteria
    defaults.put(EXPORT_PRIMARY_SORT_FIELD, BibEntry.KEY_FIELD);
    defaults.put(EXPORT_PRIMARY_SORT_DESCENDING, Boolean.FALSE);
    defaults.put(EXPORT_SECONDARY_SORT_FIELD, FieldName.AUTHOR);
    defaults.put(EXPORT_SECONDARY_SORT_DESCENDING, Boolean.FALSE);
    defaults.put(EXPORT_TERTIARY_SORT_FIELD, FieldName.TITLE);
    defaults.put(EXPORT_TERTIARY_SORT_DESCENDING, Boolean.TRUE);

    defaults.put(NEWLINE, System.lineSeparator());

    defaults.put(SIDE_PANE_COMPONENT_NAMES, "");
    defaults.put(SIDE_PANE_COMPONENT_PREFERRED_POSITIONS, "");

    defaults.put(COLUMN_NAMES, "entrytype;author/editor;title;year;journal/booktitle;bibtexkey");
    defaults.put(COLUMN_WIDTHS, "75;300;470;60;130;100");
    defaults.put(PersistenceTableColumnListener.ACTIVATE_PREF_KEY,
            PersistenceTableColumnListener.DEFAULT_ENABLED);
    defaults.put(XMP_PRIVACY_FILTERS, "pdf;timestamp;keywords;owner;note;review");
    defaults.put(USE_XMP_PRIVACY_FILTER, Boolean.FALSE);
    defaults.put(NUMBER_COL_WIDTH, 32);
    defaults.put(WORKING_DIRECTORY, USER_HOME);
    defaults.put(EXPORT_WORKING_DIRECTORY, USER_HOME);
    // Remembers working directory of last import
    defaults.put(IMPORT_WORKING_DIRECTORY, USER_HOME);
    defaults.put(FILE_WORKING_DIRECTORY, USER_HOME);
    defaults.put(AUTO_OPEN_FORM, Boolean.TRUE);
    defaults.put(BACKUP, Boolean.TRUE);
    defaults.put(OPEN_LAST_EDITED, Boolean.TRUE);
    defaults.put(LAST_EDITED, "");
    defaults.put(LAST_FOCUSED, "");
    defaults.put(STRINGS_POS_X, 0);
    defaults.put(STRINGS_POS_Y, 0);
    defaults.put(STRINGS_SIZE_X, 600);
    defaults.put(STRINGS_SIZE_Y, 400);
    defaults.put(DUPLICATES_POS_X, 0);
    defaults.put(DUPLICATES_POS_Y, 0);
    defaults.put(DUPLICATES_SIZE_X, 800);
    defaults.put(DUPLICATES_SIZE_Y, 600);
    defaults.put(MERGEENTRIES_POS_X, 0);
    defaults.put(MERGEENTRIES_POS_Y, 0);
    defaults.put(MERGEENTRIES_SIZE_X, 800);
    defaults.put(MERGEENTRIES_SIZE_Y, 600);
    defaults.put(PREAMBLE_POS_X, 0);
    defaults.put(PREAMBLE_POS_Y, 0);
    defaults.put(PREAMBLE_SIZE_X, 600);
    defaults.put(PREAMBLE_SIZE_Y, 400);
    defaults.put(DEFAULT_SHOW_SOURCE, Boolean.FALSE);
    defaults.put(DEFAULT_AUTO_SORT, Boolean.FALSE);
    defaults.put(SEARCH_CASE_SENSITIVE, Boolean.FALSE);
    defaults.put(SEARCH_MODE_FILTER, Boolean.TRUE);

    defaults.put(SEARCH_REG_EXP, Boolean.FALSE);
    defaults.put(SEARCH_PANE_POS_X, 0);
    defaults.put(SEARCH_PANE_POS_Y, 0);

    defaults.put(MERGE_ENTRIES_DIFF_MODE, 2);

    defaults.put(EDITOR_EMACS_KEYBINDINGS, Boolean.FALSE);
    defaults.put(EDITOR_EMACS_KEYBINDINGS_REBIND_CA, Boolean.TRUE);
    defaults.put(EDITOR_EMACS_KEYBINDINGS_REBIND_CF, Boolean.TRUE);
    defaults.put(AUTO_COMPLETE, Boolean.TRUE);
    AutoCompletePreferences.putDefaults(defaults);
    defaults.put(GROUP_FLOAT_SELECTIONS, Boolean.TRUE);
    defaults.put(GROUP_INTERSECT_SELECTIONS, Boolean.TRUE);
    defaults.put(GROUP_INVERT_SELECTIONS, Boolean.FALSE);
    defaults.put(GROUP_SHOW_OVERLAPPING, Boolean.FALSE);
    defaults.put(GROUPS_DEFAULT_FIELD, FieldName.KEYWORDS);
    defaults.put(GROUP_SHOW_ICONS, Boolean.TRUE);
    defaults.put(GROUP_SHOW_DYNAMIC, Boolean.TRUE);
    defaults.put(GROUP_EXPAND_TREE, Boolean.TRUE);
    defaults.put(GROUP_AUTO_SHOW, Boolean.TRUE);
    defaults.put(GROUP_AUTO_HIDE, Boolean.TRUE);
    defaults.put(GROUP_SHOW_NUMBER_OF_ELEMENTS, Boolean.FALSE);
    defaults.put(AUTO_ASSIGN_GROUP, Boolean.TRUE);
    defaults.put(KEYWORD_SEPARATOR, ", ");
    defaults.put(EDIT_GROUP_MEMBERSHIP_MODE, Boolean.FALSE);
    defaults.put(HIGHLIGHT_GROUPS_MATCHING, "all");
    defaults.put(TOOLBAR_VISIBLE, Boolean.TRUE);
    defaults.put(DEFAULT_ENCODING, StandardCharsets.UTF_8.name());
    defaults.put(GROUPS_VISIBLE_ROWS, 8);
    defaults.put(DEFAULT_OWNER, System.getProperty("user.name"));
    defaults.put(MEMORY_STICK_MODE, Boolean.FALSE);
    defaults.put(RENAME_ON_MOVE_FILE_TO_FILE_DIR, Boolean.TRUE);

    // The general fields stuff is made obsolete by the CUSTOM_TAB_... entries.
    defaults.put(GENERAL_FIELDS, "crossref;keywords;file;doi;url;urldate;" + "pdf;comment;owner");

    defaults.put(FONT_STYLE, java.awt.Font.PLAIN);
    defaults.put(FONT_SIZE, 12);
    defaults.put(OVERRIDE_DEFAULT_FONTS, Boolean.FALSE);
    defaults.put(MENU_FONT_SIZE, 11);
    defaults.put(TABLE_ROW_PADDING, 9);
    defaults.put(TABLE_SHOW_GRID, Boolean.FALSE);
    // Main table color settings:
    defaults.put(TABLE_BACKGROUND, "255:255:255");
    defaults.put(TABLE_REQ_FIELD_BACKGROUND, "230:235:255");
    defaults.put(TABLE_OPT_FIELD_BACKGROUND, "230:255:230");
    defaults.put(TABLE_TEXT, "0:0:0");
    defaults.put(GRID_COLOR, "210:210:210");
    defaults.put(GRAYED_OUT_BACKGROUND, "210:210:210");
    defaults.put(GRAYED_OUT_TEXT, "40:40:40");
    defaults.put(VERY_GRAYED_OUT_BACKGROUND, "180:180:180");
    defaults.put(VERY_GRAYED_OUT_TEXT, "40:40:40");
    defaults.put(MARKED_ENTRY_BACKGROUND0, "255:255:180");
    defaults.put(MARKED_ENTRY_BACKGROUND1, "255:220:180");
    defaults.put(MARKED_ENTRY_BACKGROUND2, "255:180:160");
    defaults.put(MARKED_ENTRY_BACKGROUND3, "255:120:120");
    defaults.put(MARKED_ENTRY_BACKGROUND4, "255:75:75");
    defaults.put(MARKED_ENTRY_BACKGROUND5, "220:255:220");
    defaults.put(VALID_FIELD_BACKGROUND_COLOR, "255:255:255");
    defaults.put(INVALID_FIELD_BACKGROUND_COLOR, "255:0:0");
    defaults.put(ACTIVE_FIELD_EDITOR_BACKGROUND_COLOR, "220:220:255");
    defaults.put(FIELD_EDITOR_TEXT_COLOR, "0:0:0");

    defaults.put(INCOMPLETE_ENTRY_BACKGROUND, "250:175:175");

    defaults.put(CTRL_CLICK, Boolean.FALSE);
    defaults.put(DISABLE_ON_MULTIPLE_SELECTION, Boolean.FALSE);
    defaults.put(URL_COLUMN, Boolean.TRUE);
    defaults.put(PREFER_URL_DOI, Boolean.FALSE);
    defaults.put(FILE_COLUMN, Boolean.TRUE);
    defaults.put(ARXIV_COLUMN, Boolean.FALSE);

    defaults.put(EXTRA_FILE_COLUMNS, Boolean.FALSE);
    defaults.put(LIST_OF_FILE_COLUMNS, "");

    // OpenOffice/LibreOffice
    if (OS.WINDOWS) {
        defaults.put(JabRefPreferences.OO_PATH, OpenOfficePreferences.DEFAULT_WINDOWS_PATH);
        defaults.put(JabRefPreferences.OO_EXECUTABLE_PATH, OpenOfficePreferences.DEFAULT_WINDOWS_PATH
                + OpenOfficePreferences.WINDOWS_EXECUTABLE_SUBPATH + OpenOfficePreferences.WINDOWS_EXECUTABLE);
        defaults.put(JabRefPreferences.OO_JARS_PATH,
                OpenOfficePreferences.DEFAULT_WINDOWS_PATH + OpenOfficePreferences.WINDOWS_JARS_SUBPATH);
    } else if (OS.OS_X) {
        defaults.put(JabRefPreferences.OO_PATH, OpenOfficePreferences.DEFAULT_OSX_PATH);
        defaults.put(JabRefPreferences.OO_EXECUTABLE_PATH, OpenOfficePreferences.DEFAULT_OSX_PATH
                + OpenOfficePreferences.OSX_EXECUTABLE_SUBPATH + OpenOfficePreferences.OSX_EXECUTABLE);
        defaults.put(JabRefPreferences.OO_JARS_PATH,
                OpenOfficePreferences.DEFAULT_OSX_PATH + OpenOfficePreferences.OSX_JARS_SUBPATH);
    } else { // Linux
        defaults.put(JabRefPreferences.OO_PATH, "/opt/openoffice.org3");
        defaults.put(JabRefPreferences.OO_EXECUTABLE_PATH, "/usr/lib/openoffice/program/soffice");
        defaults.put(JabRefPreferences.OO_JARS_PATH, "/opt/openoffice.org/basis3.0");
    }

    defaults.put(JabRefPreferences.OO_SYNC_WHEN_CITING, false);
    defaults.put(JabRefPreferences.OO_SHOW_PANEL, false);
    defaults.put(JabRefPreferences.OO_USE_ALL_OPEN_BASES, true);
    defaults.put(JabRefPreferences.OO_BIBLIOGRAPHY_STYLE_FILE, StyleLoader.DEFAULT_AUTHORYEAR_STYLE_PATH);
    defaults.put(JabRefPreferences.OO_EXTERNAL_STYLE_FILES, "");
    defaults.put(STYLES_POS_X, 0);
    defaults.put(STYLES_POS_Y, 0);
    defaults.put(STYLES_SIZE_X, 600);
    defaults.put(STYLES_SIZE_Y, 400);

    defaults.put(SpecialFieldsUtils.PREF_SPECIALFIELDSENABLED,
            SpecialFieldsUtils.PREF_SPECIALFIELDSENABLED_DEFAULT);
    defaults.put(SpecialFieldsUtils.PREF_SHOWCOLUMN_PRIORITY,
            SpecialFieldsUtils.PREF_SHOWCOLUMN_PRIORITY_DEFAULT);
    defaults.put(SpecialFieldsUtils.PREF_SHOWCOLUMN_QUALITY,
            SpecialFieldsUtils.PREF_SHOWCOLUMN_QUALITY_DEFAULT);
    defaults.put(SpecialFieldsUtils.PREF_SHOWCOLUMN_RANKING,
            SpecialFieldsUtils.PREF_SHOWCOLUMN_RANKING_DEFAULT);
    defaults.put(SpecialFieldsUtils.PREF_SHOWCOLUMN_RELEVANCE,
            SpecialFieldsUtils.PREF_SHOWCOLUMN_RELEVANCE_DEFAULT);
    defaults.put(SpecialFieldsUtils.PREF_SHOWCOLUMN_PRINTED,
            SpecialFieldsUtils.PREF_SHOWCOLUMN_PRINTED_DEFAULT);
    defaults.put(SpecialFieldsUtils.PREF_SHOWCOLUMN_READ, SpecialFieldsUtils.PREF_SHOWCOLUMN_READ_DEFAULT);
    defaults.put(SpecialFieldsUtils.PREF_AUTOSYNCSPECIALFIELDSTOKEYWORDS,
            SpecialFieldsUtils.PREF_AUTOSYNCSPECIALFIELDSTOKEYWORDS_DEFAULT);
    defaults.put(SpecialFieldsUtils.PREF_SERIALIZESPECIALFIELDS,
            SpecialFieldsUtils.PREF_SERIALIZESPECIALFIELDS_DEFAULT);

    defaults.put(USE_OWNER, Boolean.FALSE);
    defaults.put(OVERWRITE_OWNER, Boolean.FALSE);
    defaults.put(DIALOG_WARNING_FOR_DUPLICATE_KEY, Boolean.TRUE);
    defaults.put(DIALOG_WARNING_FOR_EMPTY_KEY, Boolean.TRUE);
    defaults.put(DISPLAY_KEY_WARNING_DIALOG_AT_STARTUP, Boolean.TRUE);
    defaults.put(AVOID_OVERWRITING_KEY, Boolean.FALSE);
    defaults.put(WARN_BEFORE_OVERWRITING_KEY, Boolean.TRUE);
    defaults.put(CONFIRM_DELETE, Boolean.TRUE);
    defaults.put(GRAY_OUT_NON_HITS, Boolean.TRUE);
    defaults.put(SEARCH_MODE_FLOAT, Boolean.FALSE);
    defaults.put(DEFAULT_LABEL_PATTERN, "[auth][year]");
    defaults.put(PREVIEW_ENABLED, Boolean.TRUE);
    defaults.put(ACTIVE_PREVIEW, 0);
    defaults.put(PREVIEW_0, "<font face=\"sans-serif\">"
            + "<b><i>\\bibtextype</i><a name=\"\\bibtexkey\">\\begin{bibtexkey} (\\bibtexkey)</a>"
            + "\\end{bibtexkey}</b><br>__NEWLINE__"
            + "\\begin{author} \\format[Authors(LastFirst,Initials,Semicolon,Amp),HTMLChars]{\\author}<BR>\\end{author}__NEWLINE__"
            + "\\begin{editor} \\format[Authors(LastFirst,Initials,Semicolon,Amp),HTMLChars]{\\editor} "
            + "<i>(\\format[IfPlural(Eds.,Ed.)]{\\editor})</i><BR>\\end{editor}__NEWLINE__"
            + "\\begin{title} \\format[HTMLChars]{\\title} \\end{title}<BR>__NEWLINE__"
            + "\\begin{chapter} \\format[HTMLChars]{\\chapter}<BR>\\end{chapter}__NEWLINE__"
            + "\\begin{journal} <em>\\format[HTMLChars]{\\journal}, </em>\\end{journal}__NEWLINE__"
            // Include the booktitle field for @inproceedings, @proceedings, etc.
            + "\\begin{booktitle} <em>\\format[HTMLChars]{\\booktitle}, </em>\\end{booktitle}__NEWLINE__"
            + "\\begin{school} <em>\\format[HTMLChars]{\\school}, </em>\\end{school}__NEWLINE__"
            + "\\begin{institution} <em>\\format[HTMLChars]{\\institution}, </em>\\end{institution}__NEWLINE__"
            + "\\begin{publisher} <em>\\format[HTMLChars]{\\publisher}, </em>\\end{publisher}__NEWLINE__"
            + "\\begin{year}<b>\\year</b>\\end{year}\\begin{volume}<i>, \\volume</i>\\end{volume}"
            + "\\begin{pages}, \\format[FormatPagesForHTML]{\\pages} \\end{pages}__NEWLINE__"
            + "\\begin{abstract}<BR><BR><b>Abstract: </b> \\format[HTMLChars]{\\abstract} \\end{abstract}__NEWLINE__"
            + "\\begin{review}<BR><BR><b>Review: </b> \\format[HTMLChars]{\\review} \\end{review}"
            + "</dd>__NEWLINE__<p></p></font>");
    defaults.put(PREVIEW_1, "<font face=\"sans-serif\">"
            + "<b><i>\\bibtextype</i><a name=\"\\bibtexkey\">\\begin{bibtexkey} (\\bibtexkey)</a>"
            + "\\end{bibtexkey}</b><br>__NEWLINE__"
            + "\\begin{author} \\format[Authors(LastFirst,Initials,Semicolon,Amp),HTMLChars]{\\author}<BR>\\end{author}__NEWLINE__"
            + "\\begin{editor} \\format[Authors(LastFirst,Initials,Semicolon,Amp),HTMLChars]{\\editor} "
            + "<i>(\\format[IfPlural(Eds.,Ed.)]{\\editor})</i><BR>\\end{editor}__NEWLINE__"
            + "\\begin{title} \\format[HTMLChars]{\\title} \\end{title}<BR>__NEWLINE__"
            + "\\begin{chapter} \\format[HTMLChars]{\\chapter}<BR>\\end{chapter}__NEWLINE__"
            + "\\begin{journal} <em>\\format[HTMLChars]{\\journal}, </em>\\end{journal}__NEWLINE__"
            // Include the booktitle field for @inproceedings, @proceedings, etc.
            + "\\begin{booktitle} <em>\\format[HTMLChars]{\\booktitle}, </em>\\end{booktitle}__NEWLINE__"
            + "\\begin{school} <em>\\format[HTMLChars]{\\school}, </em>\\end{school}__NEWLINE__"
            + "\\begin{institution} <em>\\format[HTMLChars]{\\institution}, </em>\\end{institution}__NEWLINE__"
            + "\\begin{publisher} <em>\\format[HTMLChars]{\\publisher}, </em>\\end{publisher}__NEWLINE__"
            + "\\begin{year}<b>\\year</b>\\end{year}\\begin{volume}<i>, \\volume</i>\\end{volume}"
            + "\\begin{pages}, \\format[FormatPagesForHTML]{\\pages} \\end{pages}"
            + "</dd>__NEWLINE__<p></p></font>");

    // TODO: Currently not possible to edit this setting:
    defaults.put(PREVIEW_PRINT_BUTTON, Boolean.FALSE);
    defaults.put(DO_NOT_RESOLVE_STRINGS_FOR, FieldName.URL);
    defaults.put(RESOLVE_STRINGS_ALL_FIELDS, Boolean.FALSE);
    defaults.put(NON_WRAPPABLE_FIELDS, "pdf;ps;url;doi;file");
    defaults.put(GENERATE_KEYS_AFTER_INSPECTION, Boolean.TRUE);
    defaults.put(MARK_IMPORTED_ENTRIES, Boolean.TRUE);
    defaults.put(UNMARK_ALL_ENTRIES_BEFORE_IMPORTING, Boolean.TRUE);
    defaults.put(WARN_ABOUT_DUPLICATES_IN_INSPECTION, Boolean.TRUE);
    defaults.put(USE_TIME_STAMP, Boolean.FALSE);
    defaults.put(OVERWRITE_TIME_STAMP, Boolean.FALSE);

    // default time stamp follows ISO-8601. Reason: https://xkcd.com/1179/
    defaults.put(TIME_STAMP_FORMAT, "yyyy-MM-dd");

    defaults.put(TIME_STAMP_FIELD, InternalBibtexFields.TIMESTAMP);
    defaults.put(UPDATE_TIMESTAMP, Boolean.FALSE);

    defaults.put(GENERATE_KEYS_BEFORE_SAVING, Boolean.FALSE);

    defaults.put(RemotePreferences.USE_REMOTE_SERVER, Boolean.TRUE);
    defaults.put(RemotePreferences.REMOTE_SERVER_PORT, 6050);

    defaults.put(PERSONAL_JOURNAL_LIST, "");
    defaults.put(EXTERNAL_JOURNAL_LISTS, "");
    defaults.put(CITE_COMMAND, "\\cite"); // obsoleted by the app-specific ones (not any more?)
    defaults.put(FLOAT_MARKED_ENTRIES, Boolean.TRUE);

    defaults.put(LAST_USED_EXPORT, "");
    defaults.put(SIDE_PANE_WIDTH, -1);

    defaults.put(IMPORT_INSPECTION_DIALOG_WIDTH, 650);
    defaults.put(IMPORT_INSPECTION_DIALOG_HEIGHT, 650);
    defaults.put(SEARCH_DIALOG_WIDTH, 650);
    defaults.put(SEARCH_DIALOG_HEIGHT, 500);
    defaults.put(SHOW_FILE_LINKS_UPGRADE_WARNING, Boolean.TRUE);
    defaults.put(AUTOLINK_EXACT_KEY_ONLY, Boolean.FALSE);
    defaults.put(NUMERIC_FIELDS, "mittnum;author");
    defaults.put(RUN_AUTOMATIC_FILE_SEARCH, Boolean.FALSE);
    defaults.put(USE_LOCK_FILES, Boolean.TRUE);
    defaults.put(AUTO_SAVE, Boolean.TRUE);
    defaults.put(AUTO_SAVE_INTERVAL, 5);
    defaults.put(PROMPT_BEFORE_USING_AUTOSAVE, Boolean.TRUE);
    defaults.put(ENFORCE_LEGAL_BIBTEX_KEY, Boolean.TRUE);
    // Curly brackets ({}) are the default delimiters, not quotes (") as these cause trouble when they appear within the field value:
    // Currently, JabRef does not escape them
    defaults.put(VALUE_DELIMITERS2, 1);
    defaults.put(KEY_GEN_FIRST_LETTER_A, Boolean.TRUE);
    defaults.put(KEY_GEN_ALWAYS_ADD_LETTER, Boolean.FALSE);
    defaults.put(EMAIL_SUBJECT, Localization.lang("References"));
    defaults.put(OPEN_FOLDERS_OF_ATTACHED_FILES, Boolean.FALSE);
    defaults.put(ALLOW_FILE_AUTO_OPEN_BROWSE, Boolean.TRUE);
    defaults.put(WEB_SEARCH_VISIBLE, Boolean.FALSE);
    defaults.put(SELECTED_FETCHER_INDEX, 0);
    defaults.put(BIB_LOC_AS_PRIMARY_DIR, Boolean.FALSE);
    defaults.put(DB_CONNECT_SERVER_TYPE, "MySQL");
    defaults.put(DB_CONNECT_HOSTNAME, "localhost");
    defaults.put(DB_CONNECT_DATABASE, "jabref");
    defaults.put(DB_CONNECT_USERNAME, "root");

    defaults.put(AKS_AUTO_NAMING_PDFS_AGAIN, Boolean.TRUE);
    insertCleanupPreset(defaults, CLEANUP_DEFAULT_PRESET);

    // defaults for DroppedFileHandler UI
    defaults.put(DroppedFileHandler.DFH_LEAVE, Boolean.FALSE);
    defaults.put(DroppedFileHandler.DFH_COPY, Boolean.TRUE);
    defaults.put(DroppedFileHandler.DFH_MOVE, Boolean.FALSE);
    defaults.put(DroppedFileHandler.DFH_RENAME, Boolean.FALSE);

    //defaults.put("lastAutodetectedImport", "");
    //defaults.put("autoRemoveExactDuplicates", Boolean.FALSE);
    //defaults.put("confirmAutoRemoveExactDuplicates", Boolean.TRUE);
    //defaults.put("tempDir", System.getProperty("java.io.tmpdir"));
    LOGGER.debug("Temporary directory: " + System.getProperty("java.io.tempdir"));
    //defaults.put("keyPattern", new LabelPattern(KEY_PATTERN));

    defaults.put(PREF_IMPORT_ALWAYSUSE, Boolean.FALSE);
    defaults.put(PREF_IMPORT_DEFAULT_PDF_IMPORT_STYLE, ImportSettingsTab.DEFAULT_STYLE);

    // use BibTeX key appended with filename as default pattern
    defaults.put(PREF_IMPORT_FILENAMEPATTERN, ImportSettingsTab.DEFAULT_FILENAMEPATTERNS[1]);

    customExports = new CustomExportList(new ExportComparator());
    customImports = new CustomImportList(this);

    updateSpecialFieldHandling();
    WRAPPED_USERNAME = '[' + get(DEFAULT_OWNER) + ']';
    MARKING_WITH_NUMBER_PATTERN = "\\[" + get(DEFAULT_OWNER).replaceAll("\\\\", "\\\\\\\\") + ":(\\d+)\\]";

    String defaultExpression = "**/.*[bibtexkey].*\\\\.[extension]";
    defaults.put(DEFAULT_REG_EXP_SEARCH_EXPRESSION_KEY, defaultExpression);
    defaults.put(REG_EXP_SEARCH_EXPRESSION_KEY, defaultExpression);
    defaults.put(AUTOLINK_USE_REG_EXP_SEARCH_KEY, Boolean.FALSE);
    defaults.put(USE_IEEE_ABRV, Boolean.FALSE);
    defaults.put(USE_CASE_KEEPER_ON_SEARCH, Boolean.TRUE);
    defaults.put(USE_UNIT_FORMATTER_ON_SEARCH, Boolean.TRUE);
    defaults.put(MAX_BACK_HISTORY_SIZE, 10);
    defaults.put(LINE_LENGTH, 65);
    defaults.put(INDENT, 4);

    defaults.put(USE_DEFAULT_CONSOLE_APPLICATION, Boolean.TRUE);
    if (OS.WINDOWS) {
        defaults.put(CONSOLE_COMMAND, "C:\\Program Files\\ConEmu\\ConEmu64.exe /single /dir \"%DIR\"");
    } else {
        defaults.put(CONSOLE_COMMAND, "");
    }

    //versioncheck defaults
    defaults.put(VersionPreferences.VERSION_IGNORED_UPDATE, "");
}

From source file:com.holycityaudio.SpinCAD.SpinCADFile.java

private void saveRecentHexFileList() {
    StringBuilder sb = new StringBuilder(128);
    if (recentHexFileList != null) {
        int k = recentHexFileList.listModel.getSize() - 1;
        for (int index = 0; index <= k; index++) {
            File file = recentHexFileList.listModel.getElementAt(k - index);
            if (sb.length() > 0) {
                sb.append(File.pathSeparator);
            }// w w w  . java2 s  . c  om
            sb.append(file.getPath());
        }
        Preferences p = Preferences.userNodeForPackage(RecentFileList.class);
        p.put("RecentHexFileList.fileList", sb.toString());
    }
}

From source file:com.mirth.connect.client.ui.DashboardPanel.java

public synchronized void updateTableHighlighting() {
    // MIRTH-2301
    // Since we are using addHighlighter here instead of using setHighlighters, we need to remove the old ones first.
    dashboardTable.setHighlighters();// ww w  .  j  a  v a2  s  .com

    // Add the highlighters. Always add the error highlighter.
    if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) {
        Highlighter highlighter = HighlighterFactory.createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR,
                UIConstants.BACKGROUND_COLOR);
        dashboardTable.addHighlighter(highlighter);
    }

    HighlightPredicate queuedHighlighterPredicate = new HighlightPredicate() {
        public boolean isHighlighted(Component renderer, ComponentAdapter adapter) {
            if (adapter.column == dashboardTable.getColumnViewIndex(QUEUED_COLUMN_NAME)) {
                Long value = (Long) dashboardTable.getValueAt(adapter.row, adapter.column);

                if (value != null && value.longValue() > 0) {
                    return true;
                }
            }
            return false;
        }
    };

    dashboardTable.addHighlighter(new ColorHighlighter(queuedHighlighterPredicate, new Color(240, 230, 140),
            Color.BLACK, new Color(240, 230, 140), Color.BLACK));

    HighlightPredicate errorHighlighterPredicate = new HighlightPredicate() {

        public boolean isHighlighted(Component renderer, ComponentAdapter adapter) {
            if (adapter.column == dashboardTable.getColumnViewIndex(ERROR_COLUMN_NAME)) {
                Long value = (Long) dashboardTable.getValueAt(adapter.row, adapter.column);

                if (value != null && value.longValue() > 0) {
                    return true;
                }
            }
            return false;
        }
    };

    Highlighter errorHighlighter = new ColorHighlighter(errorHighlighterPredicate, Color.PINK, Color.BLACK,
            Color.PINK, Color.BLACK);
    dashboardTable.addHighlighter(errorHighlighter);

    HighlightPredicate revisionDeltaHighlighterPredicate = new HighlightPredicate() {
        public boolean isHighlighted(Component renderer, ComponentAdapter adapter) {
            if (adapter.column == dashboardTable.getColumnViewIndex(DEPLOYED_REVISION_DELTA_COLUMN_NAME)) {
                Integer value = (Integer) dashboardTable.getValueAt(adapter.row, adapter.column);

                if (value != null && value.intValue() > 0) {
                    return true;
                }

                TreePath path = dashboardTable.getPathForRow(adapter.row);
                if (path != null) {
                    AbstractDashboardTableNode dashboardTableNode = (AbstractDashboardTableNode) path
                            .getLastPathComponent();
                    if (!dashboardTableNode.isGroupNode()) {
                        DashboardStatus status = dashboardTableNode.getDashboardStatus();
                        if (status.getCodeTemplatesChanged() != null && status.getCodeTemplatesChanged()) {
                            return true;
                        }
                    }
                }
            }
            return false;
        }
    };

    dashboardTable.addHighlighter(new ColorHighlighter(revisionDeltaHighlighterPredicate,
            new Color(255, 204, 0), Color.BLACK, new Color(255, 204, 0), Color.BLACK));

    HighlightPredicate lastDeployedHighlighterPredicate = new HighlightPredicate() {
        public boolean isHighlighted(Component renderer, ComponentAdapter adapter) {
            if (adapter.column == dashboardTable.getColumnViewIndex(LAST_DEPLOYED_COLUMN_NAME)) {
                Calendar checkAfter = Calendar.getInstance();
                checkAfter.add(Calendar.MINUTE, -2);

                Object value = dashboardTable.getValueAt(adapter.row, adapter.column);

                if (value != null && value instanceof Calendar && ((Calendar) value).after(checkAfter)) {
                    return true;
                }
            }
            return false;
        }
    };

    dashboardTable.addHighlighter(new ColorHighlighter(lastDeployedHighlighterPredicate,
            new Color(240, 230, 140), Color.BLACK, new Color(240, 230, 140), Color.BLACK));
}

From source file:com.holycityaudio.SpinCAD.SpinCADFile.java

private void loadRecentHexFileList() {
    Preferences p = Preferences.userNodeForPackage(RecentFileList.class);
    String listOfFiles = p.get("RecentHexFileList.fileList", null);
    if (fc == null) {
        String savedPath = prefs.get("MRUHexFolder", "");
        File MRUHexFolder = new File(savedPath);
        fc = new JFileChooser(MRUHexFolder);
        recentHexFileList = new RecentFileList(fc);
        if (listOfFiles != null) {
            String[] files = listOfFiles.split(File.pathSeparator);
            for (String fileRef : files) {
                File file = new File(fileRef);
                if (file.exists()) {
                    recentHexFileList.listModel.add(file);
                }/*from  w  w  w.  jav  a 2s . c o m*/
            }
        }
        fc.setAccessory(recentHexFileList);
        fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
    }
}

From source file:org.docx4all.ui.menu.FileMenu.java

private VFSJFileChooser createFileChooser(ResourceMap resourceMap, String callerActionName,
        JInternalFrame iframe, String filteredFileExtension) {

    String filePath = null;// w  w w.  j  a v a 2s  .c o m
    if (EXPORT_AS_SHARED_DOC_ACTION_NAME.equals(callerActionName)) {
        Preferences prefs = Preferences.userNodeForPackage(getClass());
        filePath = prefs.get(Constants.LAST_OPENED_FILE, Constants.EMPTY_STRING);
    } else {
        filePath = (String) iframe.getClientProperty(WordMLDocument.FILE_PATH_PROPERTY);
    }

    FileObject file = null;
    FileObject dir = null;
    try {
        file = VFSUtils.getFileSystemManager().resolveFile(filePath);
        dir = file.getParent();
    } catch (FileSystemException exc) {
        ;//ignore
    }

    return createFileChooser(resourceMap, dir, filteredFileExtension);
}

From source file:com.mirth.connect.client.ui.browsers.event.EventBrowser.java

private void setEventAttributes(Map<String, String> attributes, boolean cleared) {

    Object[][] tableData;/* w  ww  .  ja va2 s. c  o m*/

    if (attributes == null || attributes.size() == 0) {
        tableData = new String[1][2];
        if (cleared) {
            tableData[0][0] = "Please select an event to view its attributes.";
        } else {
            tableData[0][0] = "There are no attributes for this event.";
        }
        tableData[0][1] = "";
    } else {
        tableData = new String[attributes.size()][2];

        int i = 0;
        for (Entry<String, String> entry : attributes.entrySet()) {
            tableData[i][0] = entry.getKey();
            tableData[i][1] = entry.getValue();
            i++;
        }
    }

    if (eventAttributesTable != null) {
        RefreshTableModel model = (RefreshTableModel) eventAttributesTable.getModel();
        model.refreshDataVector(tableData);
    } else {
        eventAttributesTable = new MirthTable();

        eventAttributesTable.setModel(new RefreshTableModel(tableData,
                new String[] { ATTRIBUTES_NAME_COLUMN_NAME, ATTRIBUTES_VALUE_COLUMN_NAME }) {

            boolean[] canEdit = new boolean[] { false, false };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit[columnIndex];
            }
        });
    }

    // Set highlighter.
    if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) {
        Highlighter highlighter = HighlighterFactory.createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR,
                UIConstants.BACKGROUND_COLOR);
        eventAttributesTable.setHighlighters(highlighter);
    }

}