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

Rename bibtexkey #6545

Merged
merged 5 commits into from
Jun 4, 2020
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 @@ -41,6 +41,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We changed the section name of 'Advanced' to 'Network' in the preferences and removed some obsolete options.[#6489](https://github.com/JabRef/jabref/pull/6489)
- We improved the context menu of the column "Linked identifiers" of the main table, by truncating their texts, if they are too long. [#6499](https://github.com/JabRef/jabref/issues/6499)
- We merged the main table tabs in the preferences dialog. [#6518](https://github.com/JabRef/jabref/pull/6518)
- We changed the command line option 'generateBibtexKeys' to the more generic term 'generateCitationKeys' while the short option remains 'g'.[#6545](https://github.com/JabRef/jabref/pull/6545)

### Fixed

Expand Down
12 changes: 6 additions & 6 deletions src/main/java/org/jabref/cli/ArgumentProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import org.jabref.gui.externalfiles.AutoSetFileLinksUtil;
import org.jabref.gui.externalfiletype.ExternalFileTypes;
import org.jabref.gui.undo.NamedCompound;
import org.jabref.logic.bibtexkeypattern.BibtexKeyGenerator;
import org.jabref.logic.citationkeypattern.CitationKeyGenerator;
import org.jabref.logic.exporter.AtomicFileWriter;
import org.jabref.logic.exporter.BibDatabaseWriter;
import org.jabref.logic.exporter.BibtexDatabaseWriter;
Expand Down Expand Up @@ -206,8 +206,8 @@ private List<ParserResult> processArguments() {
}
}

if (cli.isGenerateBibtexKeys()) {
regenerateBibtexKeys(loaded);
if (cli.isGenerateCitationKeys()) {
regenerateCitationKeys(loaded);
}

if (cli.isAutomaticallySetFileLinks()) {
Expand Down Expand Up @@ -500,13 +500,13 @@ private void automaticallySetFileLinks(List<ParserResult> loaded) {
}
}

private void regenerateBibtexKeys(List<ParserResult> loaded) {
private void regenerateCitationKeys(List<ParserResult> loaded) {
for (ParserResult parserResult : loaded) {
BibDatabase database = parserResult.getDatabase();

LOGGER.info(Localization.lang("Regenerating BibTeX keys according to metadata"));
LOGGER.info(Localization.lang("Regenerating citation keys according to metadata"));

BibtexKeyGenerator keyGenerator = new BibtexKeyGenerator(parserResult.getDatabaseContext(), Globals.prefs.getBibtexKeyPatternPreferences());
CitationKeyGenerator keyGenerator = new CitationKeyGenerator(parserResult.getDatabaseContext(), Globals.prefs.getCitationKeyPatternPreferences());
for (BibEntry entry : database.getEntries()) {
keyGenerator.generateAndSetKey(entry);
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/jabref/cli/JabRefCLI.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ public String getExportMatches() {
return cl.getOptionValue("exportMatches");
}

public boolean isGenerateBibtexKeys() {
return cl.hasOption("generateBibtexKeys");
public boolean isGenerateCitationKeys() {
return cl.hasOption("generateCitationKeys");
}

public boolean isAutomaticallySetFileLinks() {
Expand All @@ -154,7 +154,7 @@ private static Options getOptions() {
options.addOption("h", "help", false, Localization.lang("Display help on command line options"));
options.addOption("n", "nogui", false, Localization.lang("No GUI. Only process command line options"));
options.addOption("asfl", "automaticallySetFileLinks", false, Localization.lang("Automatically set file links"));
options.addOption("g", "generateBibtexKeys", false, Localization.lang("Regenerate all keys for the entries in a BibTeX file"));
options.addOption("g", "generateCitationKeys", false, Localization.lang("Regenerate all keys for the entries in a BibTeX file"));
calixtus marked this conversation as resolved.
Show resolved Hide resolved
options.addOption("b", "blank", false, Localization.lang("Do not open any files at startup"));
options.addOption("v", "version", false, Localization.lang("Display version"));
options.addOption(null, "debug", false, Localization.lang("Show debug level messages"));
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/jabref/gui/EntryTypeViewModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import org.jabref.Globals;
import org.jabref.gui.duplicationFinder.DuplicateResolverDialog;
import org.jabref.logic.bibtex.DuplicateCheck;
import org.jabref.logic.bibtexkeypattern.BibtexKeyGenerator;
import org.jabref.logic.citationkeypattern.CitationKeyGenerator;
import org.jabref.logic.importer.FetcherException;
import org.jabref.logic.importer.IdBasedFetcher;
import org.jabref.logic.importer.WebFetchers;
Expand Down Expand Up @@ -166,7 +166,7 @@ public void runFetcherWorker() {
}
} else {
// Regenerate CiteKey of imported BibEntry
new BibtexKeyGenerator(basePanel.getBibDatabaseContext(), prefs.getBibtexKeyPatternPreferences()).generateAndSetKey(entry);
new CitationKeyGenerator(basePanel.getBibDatabaseContext(), prefs.getCitationKeyPatternPreferences()).generateAndSetKey(entry);
basePanel.insertEntry(entry);
}
searchSuccesfulProperty.set(true);
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
import org.jabref.gui.actions.StandardActions;
import org.jabref.gui.auximport.NewSubLibraryAction;
import org.jabref.gui.bibtexextractor.ExtractBibtexAction;
import org.jabref.gui.bibtexkeypattern.BibtexKeyPatternAction;
import org.jabref.gui.bibtexkeypattern.GenerateBibtexKeyAction;
import org.jabref.gui.citationkeypattern.CitationKeyPatternAction;
import org.jabref.gui.citationkeypattern.GenerateCitationKeyAction;
import org.jabref.gui.cleanup.CleanupAction;
import org.jabref.gui.contentselector.ManageContentSelectorAction;
import org.jabref.gui.copyfiles.CopyFilesAction;
Expand Down Expand Up @@ -530,7 +530,7 @@ private Node createToolbar() {
factory.createIconButton(StandardActions.PASTE, new EditAction(StandardActions.PASTE, this, stateManager)),
new Separator(Orientation.VERTICAL),
pushToApplicationButton,
factory.createIconButton(StandardActions.GENERATE_CITE_KEYS, new GenerateBibtexKeyAction(this, dialogService, stateManager)),
factory.createIconButton(StandardActions.GENERATE_CITE_KEYS, new GenerateCitationKeyAction(this, dialogService, stateManager)),
factory.createIconButton(StandardActions.CLEANUP_ENTRIES, new CleanupAction(this, prefs, dialogService, stateManager)),
new Separator(Orientation.VERTICAL),
factory.createIconButton(StandardActions.OPEN_GITHUB, new OpenBrowserAction("https://github.com/JabRef/jabref")),
Expand Down Expand Up @@ -763,7 +763,7 @@ private MenuBar createMenu() {
new SeparatorMenuItem(),

factory.createMenuItem(StandardActions.REPLACE_ALL, new ReplaceStringAction(this, stateManager)),
factory.createMenuItem(StandardActions.GENERATE_CITE_KEYS, new GenerateBibtexKeyAction(this, dialogService, stateManager)),
factory.createMenuItem(StandardActions.GENERATE_CITE_KEYS, new GenerateCitationKeyAction(this, dialogService, stateManager)),

new SeparatorMenuItem(),

Expand Down Expand Up @@ -796,7 +796,7 @@ private MenuBar createMenu() {
factory.createMenuItem(StandardActions.LIBRARY_PROPERTIES, new LibraryPropertiesAction(this, stateManager)),
factory.createMenuItem(StandardActions.EDIT_PREAMBLE, new PreambleEditor(stateManager, undoManager, this.getDialogService())),
factory.createMenuItem(StandardActions.EDIT_STRINGS, new BibtexStringEditorAction(stateManager)),
factory.createMenuItem(StandardActions.MANAGE_CITE_KEY_PATTERNS, new BibtexKeyPatternAction(this, stateManager))
factory.createMenuItem(StandardActions.MANAGE_CITE_KEY_PATTERNS, new CitationKeyPatternAction(this, stateManager))
);

quality.getItems().addAll(
Expand Down
18 changes: 9 additions & 9 deletions src/main/java/org/jabref/gui/actions/StandardActions.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ public enum StandardActions implements Action {

COPY_MORE(Localization.lang("Copy") + "..."),
COPY_TITLE(Localization.lang("Copy title"), KeyBinding.COPY_TITLE),
COPY_KEY(Localization.lang("Copy BibTeX key"), KeyBinding.COPY_BIBTEX_KEY),
COPY_CITE_KEY(Localization.lang("Copy \\cite{BibTeX key}"), KeyBinding.COPY_CITE_BIBTEX_KEY),
COPY_KEY_AND_TITLE(Localization.lang("Copy BibTeX key and title"), KeyBinding.COPY_BIBTEX_KEY_AND_TITLE),
COPY_KEY_AND_LINK(Localization.lang("Copy BibTeX key and link"), KeyBinding.COPY_BIBTEX_KEY_AND_LINK),
COPY_KEY(Localization.lang("Copy citation key"), KeyBinding.COPY_CITATION_KEY),
COPY_CITE_KEY(Localization.lang("Copy \\cite{citation key}"), KeyBinding.COPY_CITE_CITATION_KEY),
COPY_KEY_AND_TITLE(Localization.lang("Copy citation key and title"), KeyBinding.COPY_CITATION_KEY_AND_TITLE),
COPY_KEY_AND_LINK(Localization.lang("Copy citation key and link"), KeyBinding.COPY_CITATION_KEY_AND_LINK),
COPY_CITATION_HTML(Localization.lang("Copy citation") + " (HTML)", KeyBinding.COPY_PREVIEW),
COPY_CITATION_MORE(Localization.lang("Copy citation") + "..."),
COPY_CITATION_TEXT("Text"),
Expand Down Expand Up @@ -106,12 +106,12 @@ public enum StandardActions implements Action {
SETUP_GENERAL_FIELDS(Localization.lang("Set up general fields")),
MANAGE_EXTERNAL_FILETYPES(Localization.lang("Manage external file types")),
MANAGE_PROTECTED_TERMS(Localization.lang("Manage protected terms")),
BIBTEX_KEY_PATTERN(Localization.lang("BibTeX key patterns")),
CITATION_KEY_PATTERN(Localization.lang("Citation key patterns")),
SHOW_PREFS(Localization.lang("Preferences")),
MANAGE_JOURNALS(Localization.lang("Manage journal abbreviations")),
CUSTOMIZE_KEYBINDING(Localization.lang("Customize key bindings"), IconTheme.JabRefIcons.KEY_BINDINGS),
MANAGE_CONTENT_SELECTORS(Localization.lang("Manage content selectors"), IconTheme.JabRefIcons.PREFERENCES),
MANAGE_CITE_KEY_PATTERNS(Localization.lang("BibTeX key patterns")),
MANAGE_CITE_KEY_PATTERNS(Localization.lang("Citation key patterns")),

EDIT_ENTRY(Localization.lang("Open entry editor"), IconTheme.JabRefIcons.EDIT_ENTRY, KeyBinding.EDIT_ENTRY),
SHOW_PDF_VIEWER(Localization.lang("Open document viewer"), IconTheme.JabRefIcons.PDF_FILE),
Expand All @@ -128,14 +128,14 @@ public enum StandardActions implements Action {

FIND_DUPLICATES(Localization.lang("Find duplicates"), IconTheme.JabRefIcons.FIND_DUPLICATES),
MERGE_ENTRIES(Localization.lang("Merge entries"), IconTheme.JabRefIcons.MERGE_ENTRIES),
RESOLVE_DUPLICATE_KEYS(Localization.lang("Resolve duplicate BibTeX keys"), Localization.lang("Find and remove duplicate BibTeX keys"), KeyBinding.RESOLVE_DUPLICATE_BIBTEX_KEYS),
RESOLVE_DUPLICATE_KEYS(Localization.lang("Resolve duplicate citation keys"), Localization.lang("Find and remove duplicate citation keys"), KeyBinding.RESOLVE_DUPLICATE_CITATION_KEYS),
CHECK_INTEGRITY(Localization.lang("Check integrity"), KeyBinding.CHECK_INTEGRITY),
FIND_UNLINKED_FILES(Localization.lang("Search for unlinked local files"), IconTheme.JabRefIcons.SEARCH, KeyBinding.FIND_UNLINKED_FILES),
AUTO_LINK_FILES(Localization.lang("Automatically set file links"), IconTheme.JabRefIcons.AUTO_FILE_LINK, KeyBinding.AUTOMATICALLY_LINK_FILES),
LOOKUP_DOC_IDENTIFIER(Localization.lang("Search document identifier online")),
LOOKUP_FULLTEXT(Localization.lang("Search full text documents online"), IconTheme.JabRefIcons.FILE_SEARCH, KeyBinding.DOWNLOAD_FULL_TEXT),
GENERATE_CITE_KEY(Localization.lang("Generate BibTeX key"), IconTheme.JabRefIcons.MAKE_KEY, KeyBinding.AUTOGENERATE_BIBTEX_KEYS),
GENERATE_CITE_KEYS(Localization.lang("Generate BibTeX keys"), IconTheme.JabRefIcons.MAKE_KEY, KeyBinding.AUTOGENERATE_BIBTEX_KEYS),
GENERATE_CITE_KEY(Localization.lang("Generate citation key"), IconTheme.JabRefIcons.MAKE_KEY, KeyBinding.AUTOGENERATE_CITATION_KEYS),
GENERATE_CITE_KEYS(Localization.lang("Generate citation keys"), IconTheme.JabRefIcons.MAKE_KEY, KeyBinding.AUTOGENERATE_CITATION_KEYS),
DOWNLOAD_FULL_TEXT(Localization.lang("Search full text documents online"), IconTheme.JabRefIcons.FILE_SEARCH, KeyBinding.DOWNLOAD_FULL_TEXT),
CLEANUP_ENTRIES(Localization.lang("Cleanup entries"), IconTheme.JabRefIcons.CLEANUP_ENTRIES, KeyBinding.CLEANUP),
SET_FILE_LINKS(Localization.lang("Automatically set file links"), KeyBinding.AUTOMATICALLY_LINK_FILES),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
package org.jabref.gui.bibtexkeypattern;
package org.jabref.gui.citationkeypattern;

import org.jabref.gui.JabRefFrame;
import org.jabref.gui.StateManager;
import org.jabref.gui.actions.SimpleCommand;

import static org.jabref.gui.actions.ActionHelper.needsDatabase;

public class BibtexKeyPatternAction extends SimpleCommand {
public class CitationKeyPatternAction extends SimpleCommand {

private final JabRefFrame frame;

public BibtexKeyPatternAction(JabRefFrame frame, StateManager stateManager) {
public CitationKeyPatternAction(JabRefFrame frame, StateManager stateManager) {
this.frame = frame;

this.executable.bind(needsDatabase(stateManager));
}

@Override
public void execute() {
new BibtexKeyPatternDialog(frame.getCurrentBasePanel()).showAndWait();
new CitationKeyPatternDialog(frame.getCurrentBasePanel()).showAndWait();
}
}
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
package org.jabref.gui.bibtexkeypattern;
package org.jabref.gui.citationkeypattern;

import javafx.scene.control.ButtonType;

import org.jabref.Globals;
import org.jabref.gui.BasePanel;
import org.jabref.gui.util.BaseDialog;
import org.jabref.logic.l10n.Localization;
import org.jabref.model.bibtexkeypattern.AbstractBibtexKeyPattern;
import org.jabref.model.bibtexkeypattern.AbstractCitationKeyPattern;
import org.jabref.model.metadata.MetaData;

public class BibtexKeyPatternDialog extends BaseDialog<Void> {
public class CitationKeyPatternDialog extends BaseDialog<Void> {

private final MetaData metaData;
private final BasePanel panel;
private final BibtexKeyPatternPanel bibtexKeyPatternPanel;
private final CitationKeyPatternPanel citationKeyPatternPanel;

public BibtexKeyPatternDialog(BasePanel panel) {
this.bibtexKeyPatternPanel = new BibtexKeyPatternPanel(panel);
public CitationKeyPatternDialog(BasePanel panel) {
this.citationKeyPatternPanel = new CitationKeyPatternPanel(panel);
this.panel = panel;
this.metaData = panel.getBibDatabaseContext().getMetaData();
AbstractBibtexKeyPattern keyPattern = metaData.getCiteKeyPattern(Globals.prefs.getGlobalBibtexKeyPattern());
bibtexKeyPatternPanel.setValues(keyPattern);
AbstractCitationKeyPattern keyPattern = metaData.getCiteKeyPattern(Globals.prefs.getGlobalCitationKeyPattern());
citationKeyPatternPanel.setValues(keyPattern);
init();
}

private void init() {

this.setTitle(Localization.lang("BibTeX key patterns"));
this.setTitle(Localization.lang("Citation key patterns"));

this.getDialogPane().setContent(bibtexKeyPatternPanel.getPanel());
this.getDialogPane().setContent(citationKeyPatternPanel.getPanel());
this.getDialogPane().getButtonTypes().addAll(ButtonType.APPLY, ButtonType.CANCEL);

this.setResultConverter(button -> {
if (button == ButtonType.APPLY) {
metaData.setCiteKeyPattern(bibtexKeyPatternPanel.getKeyPatternAsDatabaseBibtexKeyPattern());
metaData.setCiteKeyPattern(citationKeyPatternPanel.getKeyPatternAsDatabaseKeyPattern());
panel.markNonUndoableBaseChanged();
}

Expand Down
Loading