-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Draft for fixing sync with groups and shared db #11314
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,10 +23,12 @@ | |
|
||
import org.jabref.gui.AbstractViewModel; | ||
import org.jabref.gui.DialogService; | ||
import org.jabref.gui.LibraryTab; | ||
import org.jabref.gui.StateManager; | ||
import org.jabref.gui.util.CustomLocalDragboard; | ||
import org.jabref.gui.util.TaskExecutor; | ||
import org.jabref.logic.l10n.Localization; | ||
import org.jabref.model.database.BibDatabase; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [reviewdog] <com.puppycrawl.tools.checkstyle.checks.imports.UnusedImportsCheck> reported by reviewdog 🐶 |
||
import org.jabref.model.database.BibDatabaseContext; | ||
import org.jabref.model.entry.BibEntry; | ||
import org.jabref.model.groups.AbstractGroup; | ||
|
@@ -83,15 +85,23 @@ public GroupTreeViewModel(StateManager stateManager, DialogService dialogService | |
EasyBind.subscribe(stateManager.activeDatabaseProperty(), this::onActiveDatabaseChanged); | ||
EasyBind.subscribe(selectedGroups, this::onSelectedGroupChanged); | ||
|
||
|
||
// Set-up bindings | ||
filterPredicate.bind(EasyBind.map(filterText, text -> group -> group.isMatchedBy(text))); | ||
|
||
var groupTreeChangedExternally = stateManager.activeTabProperty().flatMap(tab -> tab.map(LibraryTab::groupsTreeChangedProperty).orElse(new SimpleObjectProperty<>())); | ||
EasyBind.subscribe(groupTreeChangedExternally, (metaData) -> { | ||
if (metaData != null) { | ||
System.out.println("Simulate database changed"); | ||
onActiveDatabaseChanged(stateManager.getActiveDatabase()); | ||
} | ||
}); | ||
// Init | ||
refresh(); | ||
initRefreshListener(); | ||
} | ||
|
||
private void refresh() { | ||
private void initRefreshListener() { | ||
onActiveDatabaseChanged(stateManager.activeDatabaseProperty().getValue()); | ||
|
||
} | ||
|
||
public ObjectProperty<GroupNodeViewModel> rootGroupProperty() { | ||
|
@@ -293,7 +303,7 @@ public void editGroup(GroupNodeViewModel oldGroup) { | |
dialogService.notify(Localization.lang("Modified group \"%0\".", group.getName())); | ||
writeGroupChangesToMetaData(); | ||
// This is ugly but we have no proper update mechanism in place to propagate the changes, so redraw everything | ||
refresh(); | ||
initRefreshListener(); | ||
return; | ||
} | ||
|
||
|
@@ -305,7 +315,7 @@ public void editGroup(GroupNodeViewModel oldGroup) { | |
database.getEntries()); | ||
|
||
writeGroupChangesToMetaData(); | ||
refresh(); | ||
initRefreshListener(); | ||
return; | ||
} | ||
|
||
|
@@ -379,7 +389,7 @@ public void editGroup(GroupNodeViewModel oldGroup) { | |
dialogService.notify(Localization.lang("Modified group \"%0\".", group.getName())); | ||
writeGroupChangesToMetaData(); | ||
// This is ugly but we have no proper update mechanism in place to propagate the changes, so redraw everything | ||
refresh(); | ||
initRefreshListener(); | ||
}); | ||
}); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
package org.jabref.gui.util; | ||
|
||
import java.util.Optional; | ||
import java.util.function.Function; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [reviewdog] <com.puppycrawl.tools.checkstyle.checks.imports.UnusedImportsCheck> reported by reviewdog 🐶 |
||
|
||
import javafx.beans.binding.BooleanExpression; | ||
import javafx.beans.binding.ObjectBinding; | ||
import javafx.beans.property.SimpleObjectProperty; | ||
import javafx.beans.value.ObservableValue; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [reviewdog] <com.puppycrawl.tools.checkstyle.checks.imports.UnusedImportsCheck> reported by reviewdog 🐶 |
||
|
||
import com.tobiasdiez.easybind.PreboundBinding; | ||
|
||
|
@@ -42,4 +44,5 @@ protected Boolean computeValue() { | |
} | ||
}); | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [reviewdog] <com.puppycrawl.tools.checkstyle.checks.imports.UnusedImportsCheck> reported by reviewdog 🐶
Unused import - org.jabref.logic.importer.util.MediaTypes.