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

Complete rebranding of bibtexkey as citationkey #6875

Merged
merged 2 commits into from
Sep 8, 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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We removed two useless preferences in the groups preferences dialog. [#6836](https://github.com/JabRef/jabref/pull/6836)
- Synchronization of SpecialFields to keywords is now disabled by default. [#6621](https://github.com/JabRef/jabref/issues/6621)
- JabRef no longer opens the entry editor with the first entry on startup [#6855](https://github.com/JabRef/jabref/issues/6855)
- We completed the rebranding of `bibtexkey` as `citationkey` which was started in JabRef 5.1.
- JabRef no longer opens the entry editor with the first entry on startup [#6855](https://github.com/JabRef/jabref/issues/6855)
- Fetch by ID: (long) "SAO/NASA Astrophysics Data System" replaced by (short) "SAO/NASA ADS" [#6876](https://github.com/JabRef/jabref/pull/6876)

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion docs/getting-into-the-code/high-level-documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ All packages and classes which are currently not part of these packages \(we are

## Most Important Classes and their Relation

Both GUI and CLI are started via the `JabRefMain` which will in turn call `JabRef` which then decides whether the GUI \(`JabRefFrame`\) or the CLI \(`JabRefCLI` and a lot of code in `JabRef`\) will be started. The `JabRefFrame` represents the Window which contains a `SidePane` on the left used for the fetchers/groups Each tab is a `BasePanel` which has a `SearchBar` at the top, a `MainTable` at the center and a `PreviewPanel` or an `EntryEditor` at the bottom. Any right click on the `MainTable` is handled by the `RightClickMenu`. Each `BasePanel` holds a `BibDatabaseContext` consisting of a `BibDatabase` and the `MetaData`, which are the only relevant data of the currently shown database. A `BibDatabase` has a list of `BibEntries`. Each `BibEntry` has a key, a bibtex key and a key/value store for the fields with their values. Interpreted data \(such as the type or the file field\) is stored in the `TypedBibentry` type. The user can change the `JabRefPreferences` through the `PreferencesDialog`.
Both GUI and CLI are started via the `JabRefMain` which will in turn call `JabRef` which then decides whether the GUI \(`JabRefFrame`\) or the CLI \(`JabRefCLI` and a lot of code in `JabRef`\) will be started. The `JabRefFrame` represents the Window which contains a `SidePane` on the left used for the fetchers/groups Each tab is a `BasePanel` which has a `SearchBar` at the top, a `MainTable` at the center and a `PreviewPanel` or an `EntryEditor` at the bottom. Any right click on the `MainTable` is handled by the `RightClickMenu`. Each `BasePanel` holds a `BibDatabaseContext` consisting of a `BibDatabase` and the `MetaData`, which are the only relevant data of the currently shown database. A `BibDatabase` has a list of `BibEntries`. Each `BibEntry` has an ID, a citation key and a key/value store for the fields with their values. Interpreted data \(such as the type or the file field\) is stored in the `TypedBibentry` type. The user can change the `JabRefPreferences` through the `PreferencesDialog`.

2 changes: 1 addition & 1 deletion src/jmh/java/org/jabref/benchmarks/Benchmarks.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void init() throws Exception {
Random randomizer = new Random();
for (int i = 0; i < 1000; i++) {
BibEntry entry = new BibEntry();
entry.setCiteKey("id" + i);
entry.setCitationKey("id" + i);
entry.setField(StandardField.TITLE, "This is my title " + i);
entry.setField(StandardField.AUTHOR, "Firstname Lastname and FirstnameA LastnameA and FirstnameB LastnameB" + i);
entry.setField(StandardField.JOURNAL, "Journal Title " + i);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import org.controlsfx.control.textfield.AutoCompletionBinding;

/**
* Delivers possible completions as a list of {@link BibEntry} based on their cite key.
* Delivers possible completions as a list of {@link BibEntry} based on their citation key.
*/
public class BibEntrySuggestionProvider extends SuggestionProvider<BibEntry> {

Expand All @@ -25,7 +25,7 @@ public BibEntrySuggestionProvider(BibDatabase database) {

@Override
protected Equivalence<BibEntry> getEquivalence() {
return Equivalence.equals().onResultOf(BibEntry::getCiteKeyOptional);
return Equivalence.equals().onResultOf(BibEntry::getCitationKey);
}

@Override
Expand All @@ -36,7 +36,7 @@ protected Comparator<BibEntry> getComparator() {
@Override
protected boolean isMatch(BibEntry entry, AutoCompletionBinding.ISuggestionRequest request) {
String userText = request.getUserText();
return entry.getCiteKeyOptional()
return entry.getCitationKey()
.map(key -> StringUtil.containsIgnoreCase(key, userText))
.orElse(false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,14 @@ public static boolean confirmOverwriteKeys(DialogService dialogService) {
private void checkOverwriteKeysChosen() {
// We don't want to generate keys for entries which already have one thus remove the entries
if (Globals.prefs.getBoolean(JabRefPreferences.AVOID_OVERWRITING_KEY)) {
entries.removeIf(BibEntry::hasCiteKey);
// if we're going to override some cite keys warn the user about it
} else if (entries.parallelStream().anyMatch(BibEntry::hasCiteKey)) {
entries.removeIf(BibEntry::hasCitationKey);
// if we're going to override some citation keys warn the user about it
} else if (entries.parallelStream().anyMatch(BibEntry::hasCitationKey)) {
boolean overwriteKeys = confirmOverwriteKeys(dialogService);

// The user doesn't want to override cite keys
// The user doesn't want to override citation keys
if (!overwriteKeys) {
isCanceled = true;
return;
}
}
}
Expand All @@ -87,7 +86,7 @@ private void generateKeys() {
}

stateManager.getActiveDatabase().ifPresent(databaseContext -> {
// generate the new cite keys for each entry
// generate the new citation keys for each entry
final NamedCompound compound = new NamedCompound(Localization.lang("Autogenerate citation keys"));
CitationKeyGenerator keyGenerator =
new CitationKeyGenerator(databaseContext, Globals.prefs.getCitationKeyPatternPreferences());
Expand All @@ -97,7 +96,7 @@ private void generateKeys() {
}
compound.end();

// register the undo event only if new cite keys were generated
// register the undo event only if new citation keys were generated
if (compound.hasEdits()) {
frame.getUndoManager().addEdit(compound);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public GenerateCitationKeySingleAction(BibEntry entry, BibDatabaseContext databa

@Override
public void execute() {
if (!entry.hasCiteKey() || GenerateCitationKeyAction.confirmOverwriteKeys(dialogService)) {
if (!entry.hasCitationKey() || GenerateCitationKeyAction.confirmOverwriteKeys(dialogService)) {
new CitationKeyGenerator(databaseContext, preferencesService.getCitationKeyPatternPreferences())
.generateAndSetKey(entry)
.ifPresent(change -> undoManager.addEdit(new UndoableKeyChange(change)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class EntryAddChangeViewModel extends DatabaseChangeViewModel {

public EntryAddChangeViewModel(BibEntry entry) {
super();
this.name = entry.getCiteKeyOptional()
this.name = entry.getCitationKey()
.map(key -> Localization.lang("Added entry") + ": '" + key + '\'')
.orElse(Localization.lang("Added entry"));
this.entry = entry;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public EntryChangeViewModel(BibEntry entry, BibEntry newEntry) {
this.oldEntry = entry;
this.newEntry = newEntry;

name = entry.getCiteKeyOptional()
name = entry.getCitationKey()
.map(key -> Localization.lang("Modified entry") + ": '" + key + '\'')
.orElse(Localization.lang("Modified entry"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class EntryDeleteChangeViewModel extends DatabaseChangeViewModel {
public EntryDeleteChangeViewModel(BibEntry entry) {
super(Localization.lang("Deleted entry"));

this.name = entry.getCiteKeyOptional()
this.name = entry.getCitationKey()
.map(key -> Localization.lang("Deleted entry") + ": '" + key + '\'')
.orElse(Localization.lang("Deleted entry"));
this.entry = entry;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public Field fromString(String string) {
}
};

private final ObservableList<Field> fieldsForAdding = FXCollections.observableArrayList(FieldFactory.getStandardFielsdsWithBibTexKey());
private final ObservableList<Field> fieldsForAdding = FXCollections.observableArrayList(FieldFactory.getStandardFieldsWithCitationKey());
private final ObjectProperty<CustomEntryTypeViewModel> selectedEntryType = new SimpleObjectProperty<>();
private final ObjectProperty<Field> selectedFieldToAdd = new SimpleObjectProperty<>();
private final StringProperty entryTypeToAdd = new SimpleStringProperty("");
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/org/jabref/gui/edit/CopyMoreAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ private void copyKey() {

// Collect all non-null keys.
List<String> keys = entries.stream()
.filter(entry -> entry.getCiteKeyOptional().isPresent())
.map(entry -> entry.getCiteKeyOptional().get())
.filter(entry -> entry.getCitationKey().isPresent())
.map(entry -> entry.getCitationKey().get())
.collect(Collectors.toList());

if (keys.isEmpty()) {
Expand All @@ -131,8 +131,8 @@ private void copyCiteKey() {

// Collect all non-null keys.
List<String> keys = entries.stream()
.filter(entry -> entry.getCiteKeyOptional().isPresent())
.map(entry -> entry.getCiteKeyOptional().get())
.filter(entry -> entry.getCitationKey().isPresent())
.map(entry -> entry.getCitationKey().get())
.collect(Collectors.toList());

if (keys.isEmpty()) {
Expand Down Expand Up @@ -161,7 +161,7 @@ private void copyKeyAndTitle() {
List<BibEntry> entries = stateManager.getSelectedEntries();

// ToDo: this string should be configurable to allow arbitrary exports
StringReader layoutString = new StringReader("\\bibtexkey - \\begin{title}\\format[RemoveBrackets]{\\title}\\end{title}\n");
StringReader layoutString = new StringReader("\\citationkey - \\begin{title}\\format[RemoveBrackets]{\\title}\\end{title}\n");
Layout layout;
try {
layout = new LayoutHelper(layoutString, preferencesService.getLayoutFormatterPreferences(Globals.journalAbbreviationRepository)).getLayoutFromText();
Expand All @@ -175,7 +175,7 @@ private void copyKeyAndTitle() {
int entriesWithKeys = 0;
// Collect all non-null keys.
for (BibEntry entry : entries) {
if (entry.hasCiteKey()) {
if (entry.hasCitationKey()) {
entriesWithKeys++;
keyAndTitle.append(layout.doLayout(entry, stateManager.getActiveDatabase().get().getDatabase()));
}
Expand Down Expand Up @@ -209,7 +209,7 @@ private void copyKeyAndLink() {
StringBuilder keyAndLink = new StringBuilder();

List<BibEntry> entriesWithKey = entries.stream()
.filter(BibEntry::hasCiteKey)
.filter(BibEntry::hasCitationKey)
.collect(Collectors.toList());

if (entriesWithKey.isEmpty()) {
Expand All @@ -218,7 +218,7 @@ private void copyKeyAndLink() {
}

for (BibEntry entry : entriesWithKey) {
String key = entry.getCiteKeyOptional().get();
String key = entry.getCitationKey().get();
String url = entry.getField(StandardField.URL).orElse("");
keyAndLink.append(url.isEmpty() ? key : String.format("<a href=\"%s\">%s</a>", url, key));
keyAndLink.append(OS.NEWLINE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void init(BibEntry entry) {
cancelSearch();

currentEntry = entry;
Optional<String> citeKey = entry.getCiteKeyOptional();
Optional<String> citeKey = entry.getCitationKey();

if (citeKey.isPresent()) {
startSearch(citeKey.get());
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/jabref/gui/entryeditor/SourceTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,10 @@ private void storeSource(BibEntry outOfFocusEntry, String text) {

NamedCompound compound = new NamedCompound(Localization.lang("source edit"));
BibEntry newEntry = database.getEntries().get(0);
String newKey = newEntry.getCiteKeyOptional().orElse(null);
String newKey = newEntry.getCitationKey().orElse(null);

if (newKey != null) {
outOfFocusEntry.setCiteKey(newKey);
outOfFocusEntry.setCitationKey(newKey);
} else {
outOfFocusEntry.clearCiteKey();
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/exporter/WriteXMPAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ private void writeXMP() {
.collect(Collectors.toList());

Platform.runLater(() -> optionsDialog.getProgressArea()
.appendText(entry.getCiteKeyOptional().orElse(Localization.lang("undefined")) + "\n"));
.appendText(entry.getCitationKey().orElse(Localization.lang("undefined")) + "\n"));

if (files.isEmpty()) {
skipped++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private void downloadFullTexts(Map<BibEntry, Optional<URL>> downloads, BibDataba
addLinkedFileFromURL(databaseContext, result.get(), entry, dir.get());
} else {
dialogService.notify(Localization.lang("No full text document found for entry %0.",
entry.getCiteKeyOptional().orElse(Localization.lang("undefined"))));
entry.getCitationKey().orElse(Localization.lang("undefined"))));
}
}
}
Expand Down Expand Up @@ -164,19 +164,19 @@ private void addLinkedFileFromURL(BibDatabaseContext databaseContext, URL url, B
ExternalFileTypes.getInstance());
entry.addFile(downloadedFile);
dialogService.notify(Localization.lang("Finished downloading full text document for entry %0.",
entry.getCiteKeyOptional().orElse(Localization.lang("undefined"))));
entry.getCitationKey().orElse(Localization.lang("undefined"))));
});
downloadTask.titleProperty().set(Localization.lang("Downloading"));
downloadTask.messageProperty().set(
Localization.lang("Fulltext for") + ": " + entry.getCiteKeyOptional().orElse(Localization.lang("New entry")));
Localization.lang("Fulltext for") + ": " + entry.getCitationKey().orElse(Localization.lang("New entry")));
downloadTask.showToUser(true);
Globals.TASK_EXECUTOR.execute(downloadTask);
} catch (MalformedURLException exception) {
dialogService.showErrorDialogAndWait(Localization.lang("Invalid URL"), exception);
}
} else {
dialogService.notify(Localization.lang("Full text document for entry %0 already linked.",
entry.getCiteKeyOptional().orElse(Localization.lang("undefined"))));
entry.getCitationKey().orElse(Localization.lang("undefined"))));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public void importEntries(List<BibEntry> entries) {
preferencesService.getOwnerPreferences(),
preferencesService.getTimestampPreferences());

// Generate bibtex keys
// Generate citation keys
generateKeys(entries);

// Add to group
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
<fx:root xmlns:fx="http://javafx.com/fxml/1" type="HBox" xmlns="http://javafx.com/javafx/8.0.112"
fx:controller="org.jabref.gui.fieldeditors.CitationKeyEditor">
<EditorTextField fx:id="textField"/>
<Button fx:id="generateCiteKeyButton" text="%Generate" styleClass="icon-button"/>
<Button fx:id="generateCitationKeyButton" text="%Generate" styleClass="icon-button"/>
</fx:root>
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
public class CitationKeyEditor extends HBox implements FieldEditorFX {

private final JabRefPreferences preferences;
@FXML private CitationKeyEditorViewModel viewModel;
@FXML private Button generateCiteKeyButton;
@FXML private final CitationKeyEditorViewModel viewModel;
@FXML private Button generateCitationKeyButton;
@FXML private EditorTextField textField;

public CitationKeyEditor(Field field,
Expand Down Expand Up @@ -61,12 +61,12 @@ public CitationKeyEditorViewModel getViewModel() {
public void bindToEntry(BibEntry entry) {
viewModel.bindToEntry(entry);

// Configure cite key button
// Configure button to generate citation key
new ActionFactory(preferences.getKeyBindingRepository())
.configureIconButton(
StandardActions.GENERATE_CITE_KEY,
viewModel.getGenerateCiteKeyCommand(),
generateCiteKeyButton);
generateCitationKeyButton);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ public void download() {
downloadProgress.bind(downloadTask.workDonePercentageProperty());
downloadTask.titleProperty().set(Localization.lang("Downloading"));
downloadTask.messageProperty().set(
Localization.lang("Fulltext for") + ": " + entry.getCiteKeyOptional().orElse(Localization.lang("New entry")));
Localization.lang("Fulltext for") + ": " + entry.getCitationKey().orElse(Localization.lang("New entry")));
downloadTask.showToUser(true);
taskExecutor.execute(downloadTask);
} catch (MalformedURLException exception) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public MergeReviewIntoCommentConfirmationDialog(DialogService dialogService) {
public boolean askUserForMerge(List<BibEntry> conflicts) {
String bibKeys = conflicts
.stream()
.map(BibEntry::getCiteKeyOptional)
.map(BibEntry::getCitationKey)
.filter(Optional::isPresent)
.map(Optional::get)
.collect(Collectors.joining(",\n"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private void initialize() {

messagesTable.getSelectionModel().getSelectedItems().addListener(this::onSelectionChanged);
messagesTable.setItems(viewModel.getMessages());
keyColumn.setCellValueFactory(row -> new ReadOnlyStringWrapper(row.getValue().getEntry().getCiteKeyOptional().orElse("")));
keyColumn.setCellValueFactory(row -> new ReadOnlyStringWrapper(row.getValue().getEntry().getCitationKey().orElse("")));
fieldColumn.setCellValueFactory(row -> new ReadOnlyStringWrapper(row.getValue().getField().getDisplayName()));
messageColumn.setCellValueFactory(row -> new ReadOnlyStringWrapper(row.getValue().getMessage()));

Expand Down
Loading