Skip to content

Commit

Permalink
Default ID type in the ID-based entry generator (JabRef#3712)
Browse files Browse the repository at this point in the history
* Added preference for ID fetcher

* Fixed code style issues

* Fixed code style issue
  • Loading branch information
cerrisantos authored and tobiasdiez committed Feb 11, 2018
1 parent 1cef924 commit f1977f5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
## [Unreleased]

### Changed
- Changed ID-based entry generator to store the last used fetcher. [#2796] (https://github.com/JabRef/jabref/issues/2796)
- Reorganised annotation information on the right side of the "File annotations" tab. [#3109](https://github.com/JabRef/jabref/issues/3109)
- We now show a small notification icon in the entry editor when we detect data inconsistency or other problems. [#3145](https://github.com/JabRef/jabref/issues/3145)
- We added [oaDOI](https://oadoi.org/) as a fulltext provider, so that JabRef is now able to provide fulltexts for more than 90 million open-access articles.
Expand Down
8 changes: 5 additions & 3 deletions src/main/java/org/jabref/gui/EntryTypeDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import org.jabref.logic.importer.FetcherException;
import org.jabref.logic.importer.IdBasedFetcher;
import org.jabref.logic.importer.WebFetchers;
import org.jabref.logic.importer.fetcher.DoiFetcher;
import org.jabref.logic.l10n.Localization;
import org.jabref.model.EntryTypes;
import org.jabref.model.database.BibDatabaseMode;
Expand All @@ -43,6 +42,7 @@
import org.jabref.model.entry.BibtexEntryTypes;
import org.jabref.model.entry.EntryType;
import org.jabref.model.entry.IEEETranEntryTypes;
import org.jabref.preferences.JabRefPreferences;

import com.jgoodies.forms.builder.ButtonBarBuilder;
import org.slf4j.Logger;
Expand Down Expand Up @@ -166,8 +166,8 @@ private JPanel createIdFetcherPanel() {
comboBox = new JComboBox<>();

WebFetchers.getIdBasedFetchers(Globals.prefs.getImportFormatPreferences()).forEach(fetcher -> comboBox.addItem(fetcher.getName()));
// set DOI as default
comboBox.setSelectedItem(DoiFetcher.NAME);

comboBox.setSelectedItem(Globals.prefs.get(JabRefPreferences.ID_ENTRY_GENERATOR));

generateButton.addActionListener(action -> {
fetcherWorker.execute();
Expand Down Expand Up @@ -287,6 +287,8 @@ protected Optional<BibEntry> doInBackground() throws Exception {
generateButton.setEnabled(false);
generateButton.setText(Localization.lang("Searching..."));
});

Globals.prefs.put(JabRefPreferences.ID_ENTRY_GENERATOR,String.valueOf(comboBox.getSelectedItem()));
searchID = idTextField.getText().trim();
searchID = searchID.replaceAll(" ", "");
fetcher = WebFetchers.getIdBasedFetchers(Globals.prefs.getImportFormatPreferences()).get(comboBox.getSelectedIndex());
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/org/jabref/preferences/JabRefPreferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import org.jabref.logic.cleanup.CleanupPreset;
import org.jabref.logic.cleanup.Cleanups;
import org.jabref.logic.importer.ImportFormatPreferences;
import org.jabref.logic.importer.fetcher.DoiFetcher;
import org.jabref.logic.journals.JournalAbbreviationLoader;
import org.jabref.logic.journals.JournalAbbreviationPreferences;
import org.jabref.logic.l10n.Localization;
Expand Down Expand Up @@ -374,6 +375,9 @@ public class JabRefPreferences implements PreferencesService {
//AutcompleteFields - public because needed for pref migration
public static final String AUTOCOMPLETER_COMPLETE_FIELDS = "autoCompleteFields";

// Id Entry Generator Preferences
public static final String ID_ENTRY_GENERATOR = "idEntryGenerator";

// Auto completion
private static final String AUTO_COMPLETE = "autoComplete";
private static final String AUTOCOMPLETER_FIRSTNAME_MODE = "autoCompFirstNameMode";
Expand Down Expand Up @@ -462,6 +466,10 @@ private JabRefPreferences() {

defaults.put(BIBLATEX_DEFAULT_MODE, Boolean.FALSE);

// Set DOI to be the default ID entry generator
defaults.put(ID_ENTRY_GENERATOR, DoiFetcher.NAME);


if (OS.OS_X) {
defaults.put(FONT_FAMILY, "SansSerif");
defaults.put(WIN_LOOK_AND_FEEL, UIManager.getSystemLookAndFeelClassName());
Expand Down

0 comments on commit f1977f5

Please sign in to comment.