Various fixes

This commit is contained in:
crschnick 2024-07-14 19:02:27 +00:00
parent 26eff90c2b
commit d67e2c813d
5 changed files with 14 additions and 13 deletions

View file

@ -3,7 +3,6 @@ package io.xpipe.app.core.window;
import io.xpipe.app.fxcomps.util.PlatformThread;
import io.xpipe.app.prefs.AppPrefs;
import io.xpipe.core.process.OsType;
import javafx.animation.PauseTransition;
import javafx.application.Platform;
import javafx.collections.ListChangeListener;
@ -13,8 +12,6 @@ import javafx.stage.Stage;
import javafx.stage.StageStyle;
import javafx.stage.Window;
import javafx.util.Duration;
import lombok.SneakyThrows;
import org.apache.commons.lang3.SystemUtils;
public class ModifiedStage extends Stage {
@ -23,12 +20,8 @@ public class ModifiedStage extends Stage {
return SystemUtils.IS_OS_WINDOWS_11;
}
@SneakyThrows
@SuppressWarnings("unchecked")
public static void init() {
var windowsField = Window.class.getDeclaredField("windows");
windowsField.setAccessible(true);
ObservableList<Window> list = (ObservableList<Window>) windowsField.get(null);
ObservableList<Window> list = Window.getWindows();
list.addListener((ListChangeListener<Window>) c -> {
if (c.next() && c.wasAdded()) {
var added = c.getAddedSubList().getFirst();

View file

@ -31,6 +31,8 @@ public interface DataStoreProvider {
return true;
}
default void onParentRefresh(DataStoreEntry entry) {}
default void onChildrenRefresh(DataStoreEntry entry) {}
default ObservableBooleanValue busy(StoreEntryWrapper wrapper) {

View file

@ -10,9 +10,7 @@ import io.xpipe.core.store.FixedChildStore;
import io.xpipe.core.store.LocalStore;
import io.xpipe.core.store.StorePath;
import io.xpipe.core.util.UuidHelper;
import javafx.util.Pair;
import lombok.Getter;
import lombok.NonNull;
import lombok.Setter;
@ -368,6 +366,10 @@ public abstract class DataStorage {
var toRemove = oldChildren.stream()
.filter(oc -> oc.getStore() instanceof FixedChildStore)
.filter(oc -> {
if (!oc.getValidity().isUsable()) {
return true;
}
var oid = ((FixedChildStore) oc.getStore()).getFixedId();
if (oid.isEmpty()) {
return false;
@ -394,6 +396,7 @@ public abstract class DataStorage {
return oldChildren.stream()
.filter(oc -> oc.getStore() instanceof FixedChildStore)
.filter(oc -> oc.getValidity().isUsable())
.filter(oc -> ((FixedChildStore) oc.getStore())
.getFixedId()
.isPresent())
@ -407,6 +410,7 @@ public abstract class DataStorage {
.toList();
var toUpdate = oldChildren.stream()
.filter(oc -> oc.getStore() instanceof FixedChildStore)
.filter(oc -> oc.getValidity().isUsable())
.map(oc -> {
var oid = ((FixedChildStore) oc.getStore()).getFixedId();
if (oid.isEmpty()) {
@ -460,10 +464,11 @@ public abstract class DataStorage {
});
refreshEntries();
saveAsync();
e.getProvider().onChildrenRefresh(e);
toAdd.forEach(dataStoreEntryRef ->
dataStoreEntryRef.get().getProvider().onChildrenRefresh(dataStoreEntryRef.getEntry()));
dataStoreEntryRef.get().getProvider().onParentRefresh(dataStoreEntryRef.getEntry()));
toUpdate.forEach(dataStoreEntryRef ->
dataStoreEntryRef.getKey().getProvider().onChildrenRefresh(dataStoreEntryRef.getKey()));
dataStoreEntryRef.getKey().getProvider().onParentRefresh(dataStoreEntryRef.getKey()));
return !newChildren.isEmpty();
}

View file

@ -24,6 +24,7 @@ public class FixedServiceStore extends AbstractServiceStore implements FixedChil
@Override
public void checkComplete() throws Throwable {
super.checkComplete();
Validators.nonNull(displayParent);
Validators.nonNull(displayParent.getStore());
}

View file

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME