Skip to content

Commit

Permalink
Merge branch 'update-arrows' of github.com:JabRef/jabref into update-…
Browse files Browse the repository at this point in the history
…arrows
  • Loading branch information
koppor committed Dec 26, 2019
2 parents af5f9ee + bf06c4a commit d51e5a1
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void makeChange(BibDatabaseContext database, NamedCompound undoEdit) {
@Override
public Node description() {

mergePanel = new MergeEntries(oldEntry, newEntry, Localization.lang("In JabRef"), Localization.lang("On disk"), database.getMode(), DefaultRadioButtonSelectionMode.RIGHT);
mergePanel = new MergeEntries(oldEntry, newEntry, Localization.lang("In JabRef"), Localization.lang("On disk"), DefaultRadioButtonSelectionMode.RIGHT);

VBox container = new VBox(10);
Label header = new Label(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ private void init(BibEntry one, BibEntry two, DuplicateResolverType type) {
first = new ButtonType(Localization.lang("Keep left"), ButtonData.APPLY);
second = new ButtonType(Localization.lang("Keep right"), ButtonData.APPLY);
both = new ButtonType(Localization.lang("Keep both"), ButtonData.APPLY);
me = new MergeEntries(one, two, database.getMode());
me = new MergeEntries(one, two);
break;
case INSPECTION:
first = new ButtonType(Localization.lang("Remove old entry"), ButtonData.APPLY);
second = new ButtonType(Localization.lang("Remove entry from import"), ButtonData.APPLY);
both = new ButtonType(Localization.lang("Keep both"), ButtonData.APPLY);
me = new MergeEntries(one, two, Localization.lang("Old entry"),
Localization.lang("From import"), database.getMode());
Localization.lang("From import"));
break;
case DUPLICATE_SEARCH_WITH_EXACT:
first = new ButtonType(Localization.lang("Keep left"), ButtonData.APPLY);
Expand All @@ -79,14 +79,14 @@ private void init(BibEntry one, BibEntry two, DuplicateResolverType type) {

removeExactVisible = true;

me = new MergeEntries(one, two, database.getMode());
me = new MergeEntries(one, two);
break;
default:
first = new ButtonType(Localization.lang("Import and remove old entry"), ButtonData.APPLY);
second = new ButtonType(Localization.lang("Do not import entry"), ButtonData.APPLY);
both = new ButtonType(Localization.lang("Import and keep old entry"), ButtonData.APPLY);
me = new MergeEntries(one, two, Localization.lang("Old entry"),
Localization.lang("From import"), database.getMode());
Localization.lang("From import"));
break;
}
if (removeExactVisible) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void fetchAndMerge(BibEntry entry, List<Field> fields) {
}

private void showMergeDialog(BibEntry originalEntry, BibEntry fetchedEntry, WebFetcher fetcher) {
MergeEntriesDialog dialog = new MergeEntriesDialog(originalEntry, fetchedEntry, panel.getBibDatabaseContext().getMode());
MergeEntriesDialog dialog = new MergeEntriesDialog(originalEntry, fetchedEntry);
dialog.setTitle(Localization.lang("Merge entry with %0 information", fetcher.getName()));
dialog.setLeftHeaderText(Localization.lang("Original entry"));
dialog.setRightHeaderText(Localization.lang("Entry from %0", fetcher.getName()));
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/org/jabref/gui/mergeentries/MergeEntries.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,9 @@ public MergeEntries(BibEntry entryLeft, BibEntry entryRight, String headingLeft,
* @param entryRight Right entry
* @param headingLeft Heading for left entry
* @param headingRight Heading for right entry
* @param type Bib database mode
*/
public MergeEntries(BibEntry entryLeft, BibEntry entryRight, String headingLeft, String headingRight, BibDatabaseMode type) {
this(entryLeft, entryRight, headingLeft, headingRight, type, DefaultRadioButtonSelectionMode.LEFT);
public MergeEntries(BibEntry entryLeft, BibEntry entryRight, String headingLeft, String headingRight) {
this(entryLeft, entryRight, headingLeft, headingRight, DefaultRadioButtonSelectionMode.LEFT);
}

/**
Expand All @@ -108,7 +107,7 @@ public MergeEntries(BibEntry entryLeft, BibEntry entryRight, String headingLeft,
* @param type Bib database mode
* @param defaultRadioButtonSelectionMode If the left or the right side of the radio button should be preselected
*/
public MergeEntries(BibEntry entryLeft, BibEntry entryRight, BibDatabaseMode type, DefaultRadioButtonSelectionMode defaultRadioButtonSelectionMode) {
public MergeEntries(BibEntry entryLeft, BibEntry entryRight, DefaultRadioButtonSelectionMode defaultRadioButtonSelectionMode) {
leftEntry = entryLeft;
rightEntry = entryRight;
this.defaultRadioButtonSelectionMode = defaultRadioButtonSelectionMode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void execute() {
BibEntry one = selectedEntries.get(0);
BibEntry two = selectedEntries.get(1);

MergeEntriesDialog dlg = new MergeEntriesDialog(one, two, basePanel.getBibDatabaseContext().getMode());
MergeEntriesDialog dlg = new MergeEntriesDialog(one, two);
dlg.setTitle(Localization.lang("Merge entries"));
Optional<BibEntry> mergedEntry = dlg.showAndWait();
if (mergedEntry.isPresent()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@

import org.jabref.gui.util.BaseDialog;
import org.jabref.logic.l10n.Localization;
import org.jabref.model.database.BibDatabaseMode;
import org.jabref.model.entry.BibEntry;

public class MergeEntriesDialog extends BaseDialog<BibEntry> {

private final MergeEntries mergeEntries;

public MergeEntriesDialog(BibEntry one, BibEntry two, BibDatabaseMode databaseMode) {
mergeEntries = new MergeEntries(one, two, databaseMode);
public MergeEntriesDialog(BibEntry one, BibEntry two) {
mergeEntries = new MergeEntries(one, two);

init();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public void listen(UpdateRefusedEvent updateRefusedEvent) {
Optional<ButtonType> response = dialogService.showCustomButtonDialogAndWait(AlertType.CONFIRMATION, Localization.lang("Update refused"), message.toString(), ButtonType.CANCEL, merge);

if (response.isPresent() && response.get().equals(merge)) {
MergeEntriesDialog dialog = new MergeEntriesDialog(localBibEntry, sharedBibEntry, updateRefusedEvent.getBibDatabaseContext().getMode());
MergeEntriesDialog dialog = new MergeEntriesDialog(localBibEntry, sharedBibEntry);
Optional<BibEntry> mergedEntry = dialog.showAndWait();

mergedEntry.ifPresent(mergedBibEntry -> {
Expand Down

0 comments on commit d51e5a1

Please sign in to comment.