diff --git a/CHANGELOG.md b/CHANGELOG.md index bfcd7cb3ce1..08cfc225f5c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve ### Added +- We added a validation to check if the current database location is shared, preventing an exception when Pulling Changes From Shared Database. [#6959](https://github.com/JabRef/jabref/issues/6959) - We added a query parser and mapping layer to enable conversion of queries formulated in simplified lucene syntax by the user into api queries. [#6799](https://github.com/JabRef/jabref/pull/6799) - We added some basic functionality to customise the look of JabRef by importing a css theme file. [#5790](https://github.com/JabRef/jabref/issues/5790) - We added connection check function in network preference setting [#6560](https://github.com/JabRef/jabref/issues/6560) diff --git a/src/main/java/org/jabref/gui/actions/ActionHelper.java b/src/main/java/org/jabref/gui/actions/ActionHelper.java index acda7c7c1df..4225ca8f2bf 100644 --- a/src/main/java/org/jabref/gui/actions/ActionHelper.java +++ b/src/main/java/org/jabref/gui/actions/ActionHelper.java @@ -12,6 +12,7 @@ import javafx.scene.control.TabPane; import org.jabref.gui.StateManager; +import org.jabref.logic.shared.DatabaseLocation; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.LinkedFile; import org.jabref.model.entry.field.Field; @@ -19,6 +20,7 @@ import org.jabref.preferences.PreferencesService; import com.tobiasdiez.easybind.EasyBind; +import com.tobiasdiez.easybind.EasyBinding; public class ActionHelper { @@ -26,6 +28,11 @@ public static BooleanExpression needsDatabase(StateManager stateManager) { return stateManager.activeDatabaseProperty().isPresent(); } + public static BooleanExpression needsSharedDatabase(StateManager stateManager) { + EasyBinding binding = EasyBind.map(stateManager.activeDatabaseProperty(), context -> context.filter(c -> c.getLocation() == DatabaseLocation.SHARED).isPresent()); + return BooleanExpression.booleanExpression(binding); + } + public static BooleanExpression needsEntriesSelected(StateManager stateManager) { return Bindings.isNotEmpty(stateManager.getSelectedEntries()); } diff --git a/src/main/java/org/jabref/gui/shared/PullChangesFromSharedAction.java b/src/main/java/org/jabref/gui/shared/PullChangesFromSharedAction.java index c3c75e18e2a..d19090cf367 100644 --- a/src/main/java/org/jabref/gui/shared/PullChangesFromSharedAction.java +++ b/src/main/java/org/jabref/gui/shared/PullChangesFromSharedAction.java @@ -12,7 +12,7 @@ public class PullChangesFromSharedAction extends SimpleCommand { public PullChangesFromSharedAction(StateManager stateManager) { this.stateManager = stateManager; - this.executable.bind(ActionHelper.needsDatabase(stateManager)); + this.executable.bind(ActionHelper.needsDatabase(stateManager).and(ActionHelper.needsSharedDatabase(stateManager))); } public void execute() {