|
26 | 26 | import javax.swing.SwingWorker;
|
27 | 27 |
|
28 | 28 | import org.jabref.Globals;
|
| 29 | +import org.jabref.gui.importer.ImportInspectionDialog; |
29 | 30 | import org.jabref.gui.keyboard.KeyBinding;
|
| 31 | +import org.jabref.logic.bibtex.DuplicateCheck; |
30 | 32 | import org.jabref.logic.bibtexkeypattern.BibtexKeyPatternUtil;
|
31 | 33 | import org.jabref.logic.importer.FetcherException;
|
32 | 34 | import org.jabref.logic.importer.IdBasedFetcher;
|
@@ -305,10 +307,22 @@ protected void done() {
|
305 | 307 | Optional<BibEntry> result = get();
|
306 | 308 | if (result.isPresent()) {
|
307 | 309 | final BibEntry bibEntry = result.get();
|
308 |
| - // Regenerate CiteKey of imported BibEntry |
309 |
| - BibtexKeyPatternUtil.makeAndSetLabel(Globals.prefs.getBibtexKeyPatternPreferences().getKeyPattern(), frame.getCurrentBasePanel().getDatabase(), bibEntry, Globals.prefs.getBibtexKeyPatternPreferences()); |
| 310 | + if ((DuplicateCheck.containsDuplicate(frame.getCurrentBasePanel().getDatabase(), bibEntry, frame.getCurrentBasePanel().getBibDatabaseContext().getMode()).isPresent())) { |
| 311 | + //If there are duplicates starts ImportInspectionDialog |
| 312 | + final BasePanel panel = (BasePanel) frame.getTabbedPane().getSelectedComponent(); |
| 313 | + |
| 314 | + ImportInspectionDialog diag = new ImportInspectionDialog(frame, panel, Localization.lang("Import"), false); |
| 315 | + diag.addEntry(bibEntry); |
| 316 | + diag.entryListComplete(); |
| 317 | + diag.setLocationRelativeTo(frame); |
| 318 | + diag.setVisible(true); |
| 319 | + diag.toFront(); |
| 320 | + } else { |
| 321 | + // Regenerate CiteKey of imported BibEntry |
| 322 | + BibtexKeyPatternUtil.makeAndSetLabel(Globals.prefs.getBibtexKeyPatternPreferences().getKeyPattern(), frame.getCurrentBasePanel().getDatabase(), bibEntry, Globals.prefs.getBibtexKeyPatternPreferences()); |
| 323 | + frame.getCurrentBasePanel().insertEntry(bibEntry); |
| 324 | + } |
310 | 325 |
|
311 |
| - frame.getCurrentBasePanel().insertEntry(bibEntry); |
312 | 326 | dispose();
|
313 | 327 | } else if (searchID.trim().isEmpty()) {
|
314 | 328 | JOptionPane.showMessageDialog(frame, Localization.lang("The given search ID was empty."), Localization.lang("Empty search ID"), JOptionPane.WARNING_MESSAGE);
|
|
0 commit comments