-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #4817. The problem is that changes in other threads produce a "Not on FX application thread" exception. This is fixed by adding a wrapper around the list of entries. The wrapper only posts changes in the correct thread, without making a copy of the underlying list - so performance shouldn't be affected.
- Loading branch information
1 parent
bb7b721
commit d55afba
Showing
5 changed files
with
51 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.jabref.gui.util; | ||
|
||
import javafx.application.Platform; | ||
import javafx.collections.ListChangeListener; | ||
import javafx.collections.ObservableList; | ||
import javafx.collections.transformation.TransformationList; | ||
|
||
class UiThreadList<T> extends TransformationList<T, T> { | ||
public UiThreadList(ObservableList<? extends T> source) { | ||
super(source); | ||
} | ||
|
||
@Override | ||
protected void sourceChanged(ListChangeListener.Change<? extends T> change) { | ||
Platform.runLater(() -> fireChange(change)); | ||
} | ||
|
||
@Override | ||
public int getSourceIndex(int index) { | ||
return index; | ||
} | ||
|
||
@Override | ||
public T get(int index) { | ||
return getSource().get(index); | ||
} | ||
|
||
@Override | ||
public int size() { | ||
return getSource().size(); | ||
} | ||
} |