mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-09-19 22:01:12 +00:00
Run restore action staggered
This commit is contained in:
parent
ab8b6d449e
commit
0754e79970
|
@ -51,12 +51,16 @@ public class BrowserModel {
|
|||
}
|
||||
|
||||
public void restoreState(BrowserSavedState state) {
|
||||
state.getEntries().forEach(e -> {
|
||||
restoreState(e, null);
|
||||
ThreadHelper.runAsync(() -> {
|
||||
state.getEntries().forEach(e -> {
|
||||
restoreStateAsync(e, null);
|
||||
});
|
||||
// Don't try to run everything in parallel as that can be taxing
|
||||
ThreadHelper.sleep(1000);
|
||||
});
|
||||
}
|
||||
|
||||
public void restoreState(BrowserSavedState.Entry e, BooleanProperty busy) {
|
||||
public void restoreStateAsync(BrowserSavedState.Entry e, BooleanProperty busy) {
|
||||
var storageEntry = DataStorage.get().getStoreEntryIfPresent(e.getUuid());
|
||||
storageEntry.ifPresent(entry -> {
|
||||
openFileSystemAsync(entry.ref(), model -> e.getPath(), busy);
|
||||
|
|
|
@ -88,7 +88,7 @@ public class BrowserWelcomeComp extends SimpleComp {
|
|||
var disable = new SimpleBooleanProperty();
|
||||
return new ButtonComp(null, content, () -> {
|
||||
ThreadHelper.runAsync(() -> {
|
||||
model.restoreState(e, disable);
|
||||
model.restoreStateAsync(e, disable);
|
||||
});
|
||||
}).accessibleText(DataStorage.get().getStoreDisplayName(entry.get())).disable(disable).styleClass("color-listBox").apply(struc -> struc.get().setMaxWidth(2000)).grow(true, false);
|
||||
}).apply(struc -> {
|
||||
|
|
Loading…
Reference in a new issue