Search in sources :

Example 1 with EntryAddedEvent

use of org.jabref.model.database.event.EntryAddedEvent in project jabref by JabRef.

the class BibDatabase method insertEntries.

private synchronized void insertEntries(List<BibEntry> newEntries, EntryEventSource eventSource) throws KeyCollisionException {
    Objects.requireNonNull(newEntries);
    for (BibEntry entry : newEntries) {
        String id = entry.getId();
        if (containsEntryWithId(id)) {
            throw new KeyCollisionException("ID is already in use, please choose another");
        }
        internalIDs.add(id);
        entry.registerListener(this);
        eventBus.post(new EntryAddedEvent(entry, eventSource));
    }
    entries.addAll(newEntries);
}
Also used : BibEntry(org.jabref.model.entry.BibEntry) BibtexString(org.jabref.model.entry.BibtexString) EntryAddedEvent(org.jabref.model.database.event.EntryAddedEvent)

Aggregations

EntryAddedEvent (org.jabref.model.database.event.EntryAddedEvent)1 BibEntry (org.jabref.model.entry.BibEntry)1 BibtexString (org.jabref.model.entry.BibtexString)1