BibtexEntry first = sortedList.get(row);
BibtexEntry other = DuplicateCheck.containsDuplicate(panel.database(), first);
if (other != null) {
// This will be true if the duplicate is in the existing
// database.
DuplicateResolverDialog diag = new DuplicateResolverDialog(
ImportInspectionDialog.this, other, first,
DuplicateResolverDialog.INSPECTION);
Util.placeDialog(diag, ImportInspectionDialog.this);
diag.setVisible(true);
ImportInspectionDialog.this.toFront();
if (diag.getSelected() == DuplicateResolverDialog.KEEP_UPPER) {
// Remove old entry. Or... add it to a list of entries
// to be deleted. We only delete
// it after Ok is clicked.
entriesToDelete.add(other);
// Clear duplicate icon, which is controlled by the
// group hit
// field of the entry:
entries.getReadWriteLock().writeLock().lock();
first.setGroupHit(false);
entries.getReadWriteLock().writeLock().unlock();
} else if (diag.getSelected() == DuplicateResolverDialog.KEEP_LOWER) {
// Remove the entry from the import inspection dialog.
entries.getReadWriteLock().writeLock().lock();
entries.remove(first);
entries.getReadWriteLock().writeLock().unlock();
} else if (diag.getSelected() == DuplicateResolverDialog.KEEP_BOTH) {
// Do nothing.
entries.getReadWriteLock().writeLock().lock();
first.setGroupHit(false);
entries.getReadWriteLock().writeLock().unlock();
}