Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into version6
Browse files Browse the repository at this point in the history
* upstream/main:
  Resimplify Action interface (#9133)
  Fix issue with empty fallback directory (#9134)
  Fix indexing (#9132)
  SLR data is now editable (#9131)
  • Loading branch information
Siedlerchr committed Sep 4, 2022
2 parents 6405d4e + f240f6d commit 7c6b16d
Show file tree
Hide file tree
Showing 30 changed files with 512 additions and 317 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ From the user perspective, the combination of the pull request needs to be teste
- We integrated a new three-way merge UI for merging entries in the Entries Merger Dialog, the Duplicate Resolver Dialog, the Entry Importer Dialog, and the External Changes Resolver Dialog. [#8945](https://github.com/JabRef/jabref/pull/8945)
- We added the ability to merge groups, keywords, comments and files when merging entries. [#9022](https://github.com/JabRef/jabref/pull/9022)
- We added a warning message next to the authors field in the merge dialog to warn users when the authors are the same but formatted differently. [#8745](https://github.com/JabRef/jabref/issues/8745)
- The properties of an existing systematic literature review can be edited. [koppor#604](https://github.com/koppor/jabref/issues/604)
- An SLR can now be started from the SLR itself. [#9131](https://github.com/JabRef/jabref/pull/9131), [koppor#601](https://github.com/koppor/jabref/issues/601)

### Changed

Expand All @@ -41,6 +43,7 @@ From the user perspective, the combination of the pull request needs to be teste
- The global default directory for storing PDFs is now the subdirectory "JabRef" in the user's home.
- We reworked the Define study parameters dialog. [#9123](https://github.com/JabRef/jabref/pull/9123)


### Fixed

- We fixed an issue where author names with tilde accents (for example ñ) were marked as "Names are not in the standard BibTex format" [#8071](https://github.com/JabRef/jabref/issues/8071)
Expand Down
8 changes: 6 additions & 2 deletions src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
import org.jabref.gui.shared.PullChangesFromSharedAction;
import org.jabref.gui.sidepane.SidePane;
import org.jabref.gui.sidepane.SidePaneType;
import org.jabref.gui.slr.EditExistingStudyAction;
import org.jabref.gui.slr.ExistingStudySearchAction;
import org.jabref.gui.slr.StartNewStudyAction;
import org.jabref.gui.specialfields.SpecialFieldMenuItemFactory;
Expand Down Expand Up @@ -541,7 +542,6 @@ private Node createToolbar() {
// Setup Toolbar

ToolBar toolBar = new ToolBar(

new HBox(
factory.createIconButton(StandardActions.NEW_LIBRARY, new NewDatabaseAction(this, prefs)),
factory.createIconButton(StandardActions.OPEN_LIBRARY, new OpenDatabaseAction(this, prefs, dialogService, stateManager, themeManager)),
Expand Down Expand Up @@ -874,9 +874,13 @@ private MenuBar createMenu() {

factory.createMenuItem(StandardActions.SEND_AS_EMAIL, new SendAsEMailAction(dialogService, this.prefs, stateManager)),
pushToApplicationMenuItem,

new SeparatorMenuItem(),

// Systematic Literature Review (SLR)
factory.createMenuItem(StandardActions.START_NEW_STUDY, new StartNewStudyAction(this, Globals.getFileUpdateMonitor(), Globals.TASK_EXECUTOR, prefs, stateManager, themeManager)),
factory.createMenuItem(StandardActions.SEARCH_FOR_EXISTING_STUDY, new ExistingStudySearchAction(this, Globals.getFileUpdateMonitor(), Globals.TASK_EXECUTOR, prefs, stateManager, themeManager)),
factory.createMenuItem(StandardActions.EDIT_EXISTING_STUDY, new EditExistingStudyAction(this.dialogService, this.stateManager)),
factory.createMenuItem(StandardActions.UPDATE_SEARCH_RESULTS_OF_STUDY, new ExistingStudySearchAction(this, this.getOpenDatabaseAction(), this.getDialogService(), Globals.getFileUpdateMonitor(), Globals.TASK_EXECUTOR, prefs, stateManager, themeManager)),

new SeparatorMenuItem(),

Expand Down
16 changes: 15 additions & 1 deletion src/main/java/org/jabref/gui/LibraryTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public class LibraryTab extends Tab {
private final ThemeManager themeManager;
private final BooleanProperty changedProperty = new SimpleBooleanProperty(false);
private final BooleanProperty nonUndoableChangeProperty = new SimpleBooleanProperty(false);

private BibDatabaseContext bibDatabaseContext;
private MainTableDataModel tableModel;
private CitationStyleCache citationStyleCache;
Expand All @@ -98,17 +99,22 @@ public class LibraryTab extends Tab {
private BasePanelMode mode = BasePanelMode.SHOWING_NOTHING;
private SplitPane splitPane;
private DatabaseNotification databaseNotificationPane;

private boolean saving;
private PersonNameSuggestionProvider searchAutoCompleter;

// Used to track whether the base has changed since last save.
private BibEntry showing;

private SuggestionProviders suggestionProviders;

@SuppressWarnings({"FieldCanBeLocal"})
private Subscription dividerPositionSubscription;

// the query the user searches when this BasePanel is active
private Optional<SearchQuery> currentSearchQuery = Optional.empty();

private Optional<DatabaseChangeMonitor> changeMonitor = Optional.empty();

// initializing it so we prevent NullPointerException
private BackgroundTask<ParserResult> dataLoadingTask = BackgroundTask.wrap(() -> null);

Expand Down Expand Up @@ -213,6 +219,14 @@ public void onDatabaseLoadingSucceed(ParserResult result) {

feedData(context);

if (preferencesService.getFilePreferences().shouldFulltextIndexLinkedFiles()) {
try {
indexingTaskManager.updateIndex(PdfIndexer.of(bibDatabaseContext, preferencesService.getFilePreferences()), bibDatabaseContext);
} catch (IOException e) {
LOGGER.error("Cannot access lucene index", e);
}
}

// a temporary workaround to update groups pane
stateManager.activeDatabaseProperty().bind(
EasyBind.map(frame.getTabbedPane().getSelectionModel().selectedItemProperty(),
Expand Down
68 changes: 0 additions & 68 deletions src/main/java/org/jabref/gui/actions/Action.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.jabref.gui.actions;

import java.util.Objects;
import java.util.Optional;

import org.jabref.gui.icon.JabRefIcon;
Expand All @@ -20,71 +19,4 @@ default Optional<KeyBinding> getKeyBinding() {
default String getDescription() {
return "";
}

class Builder {
private final ActionImpl actionImpl;

public Builder(String text) {
this.actionImpl = new ActionImpl();
setText(text);
}

public Builder() {
this("");
}

public Action setIcon(JabRefIcon icon) {
Objects.requireNonNull(icon);
actionImpl.icon = icon;
return actionImpl;
}

public Action setText(String text) {
Objects.requireNonNull(text);
actionImpl.text = text;
return actionImpl;
}

public Action setKeyBinding(KeyBinding keyBinding) {
Objects.requireNonNull(keyBinding);
actionImpl.keyBinding = keyBinding;
return actionImpl;
}

public Action setDescription(String description) {
Objects.requireNonNull(description);
actionImpl.description = description;
return actionImpl;
}
}

class ActionImpl implements Action {
private JabRefIcon icon;
private KeyBinding keyBinding;
private String text;
private String description;

private ActionImpl() {
}

@Override
public Optional<JabRefIcon> getIcon() {
return Optional.ofNullable(icon);
}

@Override
public Optional<KeyBinding> getKeyBinding() {
return Optional.ofNullable(keyBinding);
}

@Override
public String getText() {
return text != null ? text : "";
}

@Override
public String getDescription() {
return description != null ? description : "";
}
}
}
6 changes: 6 additions & 0 deletions src/main/java/org/jabref/gui/actions/ActionHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import org.jabref.gui.StateManager;
import org.jabref.logic.shared.DatabaseLocation;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.LinkedFile;
import org.jabref.model.entry.field.Field;
Expand All @@ -33,6 +34,11 @@ public static BooleanExpression needsSharedDatabase(StateManager stateManager) {
return BooleanExpression.booleanExpression(binding);
}

public static BooleanExpression needsStudyDatabase(StateManager stateManager) {
EasyBinding<Boolean> binding = EasyBind.map(stateManager.activeDatabaseProperty(), context -> context.filter(BibDatabaseContext::isStudy).isPresent());
return BooleanExpression.booleanExpression(binding);
}

public static BooleanExpression needsEntriesSelected(StateManager stateManager) {
return Bindings.isNotEmpty(stateManager.getSelectedEntries());
}
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/org/jabref/gui/actions/StandardActions.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,11 @@ public enum StandardActions implements Action {
PARSE_LATEX(Localization.lang("Search for citations in LaTeX files..."), IconTheme.JabRefIcons.LATEX_CITATIONS),
NEW_SUB_LIBRARY_FROM_AUX(Localization.lang("New sublibrary based on AUX file") + "...", Localization.lang("New BibTeX sublibrary") + Localization.lang("This feature generates a new library based on which entries are needed in an existing LaTeX document."), IconTheme.JabRefIcons.NEW),
WRITE_METADATA_TO_PDF(Localization.lang("Write metadata to PDF files"), Localization.lang("Will write metadata to the PDFs linked from selected entries."), KeyBinding.WRITE_METADATA_TO_PDF),

START_NEW_STUDY(Localization.lang("Start new systematic literature review")),
SEARCH_FOR_EXISTING_STUDY(Localization.lang("Perform search for existing systematic literature review")),
UPDATE_SEARCH_RESULTS_OF_STUDY(Localization.lang("Update study search results")),
EDIT_EXISTING_STUDY(Localization.lang("Manage study definition")),

OPEN_DATABASE_FOLDER(Localization.lang("Reveal in file explorer")),
OPEN_FOLDER(Localization.lang("Open folder"), Localization.lang("Open folder"), IconTheme.JabRefIcons.FOLDER, KeyBinding.OPEN_FOLDER),
OPEN_FILE(Localization.lang("Open file"), Localization.lang("Open file"), IconTheme.JabRefIcons.FILE, KeyBinding.OPEN_FILE),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.jabref.gui.mergeentries.newmergedialog.cell.sidebuttons;

import java.util.Optional;

import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.scene.control.Button;
Expand All @@ -9,25 +11,35 @@
import org.jabref.gui.actions.ActionFactory;
import org.jabref.gui.actions.SimpleCommand;
import org.jabref.gui.icon.IconTheme;
import org.jabref.gui.icon.JabRefIcon;

import com.tobiasdiez.easybind.EasyBind;

public class InfoButton extends Button {
private final StringProperty infoMessage = new SimpleStringProperty();
private final ActionFactory actionFactory = new ActionFactory(Globals.getKeyPrefs());

private final Action mergeAction = new Action() {
@Override
public Optional<JabRefIcon> getIcon() {
return Optional.of(IconTheme.JabRefIcons.INTEGRITY_INFO);
}

@Override
public String getText() {
return infoMessage.get();
}
};

public InfoButton(String infoMessage) {
setInfoMessage(infoMessage);
this.infoMessage.setValue(infoMessage);
configureButton();
EasyBind.subscribe(infoMessageProperty(), newWarningMessage -> {
configureButton();
});
EasyBind.subscribe(this.infoMessage, newWarningMessage -> configureButton());
}

private void configureButton() {
setMaxHeight(Double.MAX_VALUE);
setFocusTraversable(false);
Action mergeAction = new Action.Builder(getInfoMessage()).setIcon(IconTheme.JabRefIcons.INTEGRITY_INFO);

actionFactory.configureIconButton(mergeAction, new SimpleCommand() {
@Override
Expand All @@ -36,16 +48,4 @@ public void execute() {
}
}, this);
}

private void setInfoMessage(String infoMessage) {
infoMessageProperty().set(infoMessage);
}

public StringProperty infoMessageProperty() {
return infoMessage;
}

public String getInfoMessage() {
return infoMessage.get();
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.jabref.gui.mergeentries.newmergedialog.cell.sidebuttons;

import java.util.Optional;

import javafx.beans.property.BooleanProperty;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleBooleanProperty;
Expand All @@ -11,6 +13,7 @@
import org.jabref.gui.actions.ActionFactory;
import org.jabref.gui.actions.SimpleCommand;
import org.jabref.gui.icon.IconTheme;
import org.jabref.gui.icon.JabRefIcon;
import org.jabref.logic.l10n.Localization;
import org.jabref.model.entry.field.Field;

Expand All @@ -32,16 +35,13 @@ public ToggleMergeUnmergeButton(Field field) {
}

private void configureMergeButton() {
Action mergeAction = new Action.Builder(Localization.lang("Merge %0", field.getDisplayName()))
.setIcon(IconTheme.JabRefIcons.MERGE_GROUPS);

actionFactory.configureIconButton(mergeAction, new ToggleMergeUnmergeAction(), this);
ToggleMergeCommand mergeCommand = new ToggleMergeCommand();
actionFactory.configureIconButton(mergeCommand.mergeAction, mergeCommand, this);
}

private void configureUnmergeButton() {
Action unmergeAction = new Action.Builder(Localization.lang("Unmerge %0", field.getDisplayName()))
.setIcon(IconTheme.JabRefIcons.UNDO);
actionFactory.configureIconButton(unmergeAction, new ToggleMergeUnmergeAction(), this);
ToggleMergeCommand unmergeCommand = new ToggleMergeCommand();
actionFactory.configureIconButton(unmergeCommand.unmergeAction, unmergeCommand, this);
}

public ObjectProperty<FieldState> fieldStateProperty() {
Expand Down Expand Up @@ -71,7 +71,30 @@ public void setCanMerge(boolean value) {
canMergeProperty().set(value);
}

private class ToggleMergeUnmergeAction extends SimpleCommand {
private class ToggleMergeCommand extends SimpleCommand {
private final Action mergeAction = new Action() {
@Override
public Optional<JabRefIcon> getIcon() {
return Optional.of(IconTheme.JabRefIcons.MERGE_GROUPS);
}

@Override
public String getText() {
return Localization.lang("Merge %0", field.getDisplayName());
}
};

private final Action unmergeAction = new Action() {
@Override
public Optional<JabRefIcon> getIcon() {
return Optional.of(IconTheme.JabRefIcons.UNDO);
}

@Override
public String getText() {
return Localization.lang("Unmerge %0", field.getDisplayName());
}
};

@Override
public void execute() {
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/jabref/gui/push/PushToLyx.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ public JabRefIcon getIcon() {
public void operationCompleted() {
if (couldNotConnect) {
dialogService.showErrorDialogAndWait(Localization.lang("Error pushing entries"),
Localization.lang("verify that LyX is running and that the lyxpipe is valid")
+ ". [" + commandPath + "]");
Localization.lang("Verify that LyX is running and that the lyxpipe is valid.")
+ "[" + commandPath + "]");
} else if (couldNotCall) {
dialogService.showErrorDialogAndWait(Localization.lang("unable to write to") + " " + commandPath + ".in");
dialogService.showErrorDialogAndWait(Localization.lang("Unable to write to %0.", commandPath + ".in"));
} else {
super.operationCompleted();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public TextFlow getDescription() {
textFlow.getChildren().addAll(descriptionSearchBaseVisitor.visit(parseTree));
textFlow.getChildren().add(TooltipTextUtil.createText(". ", TooltipTextUtil.TextType.NORMAL));
textFlow.getChildren().add(TooltipTextUtil.createText(searchFlags.contains(SearchRules.SearchFlags.CASE_SENSITIVE) ? Localization
.lang("The search is case sensitive.") :
Localization.lang("The search is case insensitive."), TooltipTextUtil.TextType.NORMAL));
.lang("The search is case-sensitive.") :
Localization.lang("The search is case-insensitive."), TooltipTextUtil.TextType.NORMAL));
return textFlow;
}

Expand Down
Loading

0 comments on commit 7c6b16d

Please sign in to comment.