-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Exception when "pulling changes" from local database #6959
Comments
The solution would be to create another BooleanExpression in the ActionHelper class, e..g needsSharedDatabase |
Hi! Can I work on this? |
Sure. Go ahead, if you have any questions ask here or in our gitter channel |
Hello I'm back. I think I have a solution almost worked out but I need a little help. I added the binding in public PullChangesFromSharedAction(StateManager stateManager) {
this.stateManager = stateManager;
this.executable.bind(ActionHelper.needsDatabase(stateManager));
this.executable.bind(ActionHelper.needsSharedDatabase(stateManager)); //new
} The problem is I'm still not sure how to make the validation in the public static BooleanExpression needsSharedDatabase(StateManager stateManager){
return stateManager.activeDatabaseProperty().isEqualTo("shared");
} The problem is that in the I would really appreciate some help to make my first contribution! |
Idea is good so far, for checking if it's a shared database you better check the bibdatabasecontect e.g |
|
Update: I came up with this solution: public static BooleanExpression needsSharedDatabase(StateManager stateManager) {
BibDatabaseContext databaseContext = stateManager.activeDatabaseProperty().orElse(null).get();
return Bindings.createBooleanBinding(() -> databaseContext != null && databaseContext.getLocation() == DatabaseLocation.SHARED);
} But now the problem is that the validation is only being done at the start when I run the program. I'm guessing It's related to the |
You need to add the check for the active database property in the booleanBinding itself. The Bindings are wrapper around Observables. Observables update whenever their values changes. I think something like this could work: var binding = Bindings.createBooleanBinding(()->
stateManager.activeDatabaseProperty().getValue().filter(context->context.getLocation() == DatabaseLocation.SHARED).isPresent(),
stateManager.activeDatabaseProperty());
return BooleanExpression.booleanExpression(binding); |
Thanks a lot @Siedlerchr I really appreciate your help. I'll look into it. |
orElse(null) is always a bad idea... |
JabRef 5.2--2020-09-29--2d92025
Linux 4.12.14-lp151.28.67-default amd64
Java 15
Steps to reproduce the behavior:
Log File
The text was updated successfully, but these errors were encountered: