Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EntryTypeDialog Fetching Autogenerates BibTeX Key #2709

Merged
merged 3 commits into from
Apr 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- The `day` part of the biblatex `date` field is now exported to the corresponding `day` field in MS-Office XML. [#2691](https://github.com/JabRef/jabref/issues/2691)

### Fixed
- We fixed an issue of duplicate keys after using a fetcher, e.g., DOI or ISBN [#2867](https://github.com/JabRef/jabref/issues/2687)
- We fixed an issue that prevented multiple parallel JabRef instances from terminating gracefully. [#2698](https://github.com/JabRef/jabref/issues/2698)
- We fixed an issue where authors with multiple surnames were not presented correctly in the main table. [#2534](https://github.com/JabRef/jabref/issues/2534)
- Repairs the handling of apostrophes in the LaTeX to unicode conversion. [#2500](https://github.com/JabRef/jabref/issues/2500)
Expand Down
15 changes: 9 additions & 6 deletions src/main/java/org/jabref/gui/EntryTypeDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

import org.jabref.Globals;
import org.jabref.gui.keyboard.KeyBinding;
import org.jabref.logic.bibtexkeypattern.BibtexKeyPatternUtil;
import org.jabref.logic.importer.FetcherException;
import org.jabref.logic.importer.IdBasedFetcher;
import org.jabref.logic.importer.WebFetchers;
Expand Down Expand Up @@ -96,7 +97,6 @@ private JPanel createEntryGroupsPanel() {
if (!customTypes.isEmpty()) {
panel.add(createEntryGroupPanel(Localization.lang("Custom"), customTypes));
}

} else {
panel.add(createEntryGroupPanel("BibTeX", BibtexEntryTypes.ALL));
panel.add(createEntryGroupPanel("IEEETran", IEEETranEntryTypes.ALL));
Expand Down Expand Up @@ -182,7 +182,7 @@ private JPanel createIdFetcherPanel() {
JPanel jPanel = new JPanel();

GridBagConstraints constraints = new GridBagConstraints();
constraints.insets = new Insets(4,4,4,4);
constraints.insets = new Insets(4, 4, 4, 4);

GridBagLayout layout = new GridBagLayout();
jPanel.setLayout(layout);
Expand Down Expand Up @@ -305,15 +305,19 @@ protected void done() {
try {
Optional<BibEntry> result = get();
if (result.isPresent()) {
frame.getCurrentBasePanel().insertEntry(result.get());
final BibEntry bibEntry = result.get();
// Regenerate CiteKey of imported BibEntry
BibtexKeyPatternUtil.makeAndSetLabel(Globals.prefs.getBibtexKeyPatternPreferences().getKeyPattern(), frame.getCurrentBasePanel().getDatabase(), bibEntry, Globals.prefs.getBibtexKeyPatternPreferences());

frame.getCurrentBasePanel().insertEntry(bibEntry);
dispose();
} else if (searchID.trim().isEmpty()) {
JOptionPane.showMessageDialog(frame, Localization.lang("The given search ID was empty."), Localization.lang("Empty search ID"), JOptionPane.WARNING_MESSAGE);
} else if (!fetcherException) {
JOptionPane.showMessageDialog(frame, Localization.lang("Fetcher_'%0'_did_not_find_an_entry_for_id_'%1'.", fetcher.getName(), searchID)+ "\n" + fetcherExceptionMessage, Localization.lang("No files found."), JOptionPane.WARNING_MESSAGE);
JOptionPane.showMessageDialog(frame, Localization.lang("Fetcher_'%0'_did_not_find_an_entry_for_id_'%1'.", fetcher.getName(), searchID) + "\n" + fetcherExceptionMessage, Localization.lang("No files found."), JOptionPane.WARNING_MESSAGE);
} else {
JOptionPane.showMessageDialog(frame,
Localization.lang("Error while fetching from %0", fetcher.getName()) +"." + "\n" + fetcherExceptionMessage,
Localization.lang("Error while fetching from %0", fetcher.getName()) + "." + "\n" + fetcherExceptionMessage,
Localization.lang("Error"), JOptionPane.ERROR_MESSAGE);
}
fetcherWorker = new FetcherWorker();
Expand All @@ -328,5 +332,4 @@ protected void done() {
}
}
}

}

This file was deleted.