Logo Search packages:      
Sourcecode: jabref-plugin-oo version File versions  Download package

void net::sf::jabref::oo::OOBibBase::insertEntry ( BibtexEntry[]  entries,
BibtexDatabase  database,
OOBibStyle  style,
boolean  inParenthesis,
boolean  withText,
boolean  sync 
) throws Exception [inline]

This method inserts a cite marker in the text for the given BibtexEntry, and may refresh the bibliography.

entries The entries to cite.
database The database the entry belongs to.
style The bibliography style we are using.
inParenthesis Indicates whether it is an in-text citation or a citation in parenthesis. This is not relevant if numbered citations are used.
withText Indicates whether this should be a normal citation (true) or an empty (invisible) citation (false).
sync Indicates whether the reference list should be refreshed.

Definition at line 215 of file OOBibBase.java.

References refreshCiteMarkers().


        try {
            XTextViewCursor xViewCursor = xViewCursorSupplier.getViewCursor();

            if (entries.length > 1) {
                Arrays.sort(entries, yearComparator);

            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < entries.length; i++) {
                BibtexEntry entry = entries[i];
                if (i > 0)
            String keyString = sb.toString();
            // Insert bookmark:
            String bName = getUniqueReferenceMarkName(keyString,
                    withText ? (inParenthesis ? AUTHORYEAR_PAR : AUTHORYEAR_INTEXT) : INVISIBLE_CIT);
            //XTextContent content = insertBookMark(bName, xViewCursor);

            String citeText = style.isNumberEntries() ? "-" : style.getCitationMarker(entries, database, inParenthesis, null, null);

            //System.out.println(text+" / "+xViewCursor.getText());
            xViewCursor.getText().insertString(xViewCursor, " ", false);
            insertReferenceMark(bName, citeText, xViewCursor, withText, style);


            XTextRange position = xViewCursor.getEnd();

            if (sync) {
                // To account for numbering and for uniqiefiers, we must refresh the cite markers:
                refreshCiteMarkers(database, style);

                // Insert it at the current position:
                rebuildBibTextSection(database, style);

            // Go back to the relevant position:
            try {
                xViewCursor.gotoRange(position, false);
            } catch (Exception ex) {
        } catch (DisposedException ex) {
            // We need to catch this one here because the OOTestPanel class is
            // loaded before connection, and therefore cannot directly reference
            // or catch a DisposedException (which is in a OO jar file).
            throw new ConnectionLostException(ex.getMessage());

Generated by  Doxygen 1.6.0   Back to index