mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-10-08 08:01:39 +00:00
Run restore action staggered
This commit is contained in:
1 parent
ab8b6d449e
commit
0754e79970
2 files changed
+8
-4
No files matched your search
@@ -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 -> {
|
||||
|
||||
Reference in new issue
Block a user