Various small fixes

This commit is contained in:
crschnick 2024-01-16 13:05:21 +00:00
parent dd54dccec7
commit bd2acc6574
9 changed files with 39 additions and 25 deletions

View file

@ -98,6 +98,11 @@ public class StoreEntryWrapper {
}
public void update() {
// We are probably in shutdown then
if (StoreViewState.get() == null) {
return;
}
// Avoid reupdating name when changed from the name property!
if (!entry.getName().equals(name.getValue())) {
name.setValue(entry.getName());

View file

@ -181,6 +181,7 @@ public class SentryErrorHandler implements ErrorHandler {
s.setTag("omitted", Boolean.toString(ee.isOmitted()));
s.setTag("diagnostics", Boolean.toString(ee.isShouldSendDiagnostics()));
s.setTag("logs", Boolean.toString(ee.isShouldSendDiagnostics() && !ee.getAttachments().isEmpty()));
s.setTag("inShutdown", Boolean.toString(OperationMode.isInShutdown()));
var exMessage = ee.getThrowable() != null ? ee.getThrowable().getMessage() : null;
if (ee.getDescription() != null && !ee.getDescription().equals(exMessage) && ee.isShouldSendDiagnostics()) {

View file

@ -38,9 +38,6 @@ public abstract class DataStorage {
@Getter
protected boolean loaded;
@Getter
protected boolean disposed;
@Getter
protected final List<DataStoreCategory> storeCategories;
@ -115,8 +112,7 @@ public abstract class DataStorage {
private synchronized void dispose() {
onReset();
save();
disposed = true;
save(true);
}
protected void onReset() {}
@ -156,11 +152,11 @@ public abstract class DataStorage {
}
ThreadHelper.runAsync(() -> {
save();
save(false);
});
}
public abstract void save();
public abstract void save(boolean dispose);
public abstract boolean supportsSharing();
public boolean shouldShare(DataStoreCategory entry) {

View file

@ -18,7 +18,7 @@ public class ImpersistentStorage extends DataStorage {
}
@Override
public void save() {
public void save(boolean dispose) {
var storesDir = getStoresDir();
TrackEvent.info("Storage persistence is disabled. Deleting storage contents ...");

View file

@ -25,6 +25,9 @@ public class StandardStorage extends DataStorage {
@Getter
private final GitStorageHandler gitStorageHandler;
@Getter
private boolean disposed;
StandardStorage() {
this.gitStorageHandler = GitStorageHandler.getInstance();
this.gitStorageHandler.init(dir);
@ -119,10 +122,12 @@ public class StandardStorage extends DataStorage {
var storesDir = getStoresDir();
var categoriesDir = getCategoriesDir();
var dataDir = getDataDir();
try {
FileUtils.forceMkdir(storesDir.toFile());
FileUtils.forceMkdir(categoriesDir.toFile());
FileUtils.forceMkdir(dataDir.toFile());
} catch (Exception e) {
ErrorEvent.fromThrowable(e).terminal(true).build().handle();
}
@ -292,7 +297,7 @@ public class StandardStorage extends DataStorage {
entry.dirty = true;
entry.setStoreNode(DataStorageWriter.storeToNode(entry.getStore()));
});
save();
save(false);
}
deleteLeftovers();
@ -302,7 +307,7 @@ public class StandardStorage extends DataStorage {
this.gitStorageHandler.afterStorageLoad();
}
public void save() {
public void save(boolean dispose) {
if (!loaded || disposed) {
return;
}
@ -363,6 +368,9 @@ public class StandardStorage extends DataStorage {
deleteLeftovers();
gitStorageHandler.afterStorageSave();
if (dispose) {
disposed = true;
}
busyIo.unlock();
}

View file

@ -27,10 +27,10 @@ public enum PlatformState {
public static void teardown() {
PlatformThread.runLaterIfNeededBlocking(() -> {
// Fix to preserve clipboard contents after shutdown
var string = Clipboard.getSystemClipboard().getString();
var s = new StringSelection(string);
try {
// Fix to preserve clipboard contents after shutdown
var string = Clipboard.getSystemClipboard().getString();
var s = new StringSelection(string);
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(s, s);
} catch (IllegalStateException ignored) {
}

View file

@ -3,7 +3,7 @@
- Add support to create customized SSH connections using arbitrary options.
This can be done using the SSH config format but without having to create an actual file.
- Unify all SSH connection types to support the same functionality.
I.e. you can now use SSH config connections to set up SSH tunnels as well.
I.e. they all now support host key and identity file fixes plus can be used as SSH tunnels.
- Properly detect when an active connection has unexpectedly reset during a file browser session.
It will now be automatically restarted when any action is performed and fails.
- Rework connection creation menu layout to give a better overview

22
dist/jpackage.gradle vendored
View file

@ -25,7 +25,7 @@ application {
}
def appDependencies = project(':app').configurations.findByName('runtimeClasspath').getFiles().stream()
.filter(f -> !f.name.startsWith('javafx')) // Remove JavaFX dependencies
.filter(f -> !fullVersion || !f.name.startsWith('javafx')) // Remove JavaFX dependencies
.collect(Collectors.toMap(f -> f.toPath().getFileName().toString(), f -> f, (f1, f2) -> f1))
.values()
def appModuleNames = ['app']
@ -53,16 +53,18 @@ jlink {
// '--strip-native-commands'
]
def currentOS = DefaultNativePlatform.currentOperatingSystem;
def platform = null
if (currentOS.isWindows()) {
platform = 'windows'
} else if (currentOS.isLinux()) {
platform = 'linux'
} else if (currentOS.isMacOsX()) {
platform = 'osx'
if (fullVersion) {
def currentOS = DefaultNativePlatform.currentOperatingSystem;
def platform = null
if (currentOS.isWindows()) {
platform = 'windows'
} else if (currentOS.isLinux()) {
platform = 'linux'
} else if (currentOS.isMacOsX()) {
platform = 'osx'
}
addExtraModulePath(layout.projectDirectory.dir("javafx/${platform}/${arch}").toString())
}
addExtraModulePath(layout.projectDirectory.dir("javafx/${platform}/${arch}").toString())
launcher {
moduleName = 'io.xpipe.app'

View file

@ -9,7 +9,9 @@ import java.util.UUID;
public interface SelfReferentialStore extends DataStore {
default DataStoreEntry getSelfEntry() {
return DataStorage.get().getStoreEntries().stream().filter(dataStoreEntry -> dataStoreEntry.getStore() == this).findFirst().orElseGet(() -> {
return DataStorage.get().getStoreEntryIfPresent(this).or(() -> {
return DataStorage.get().getStoreEntryInProgressIfPresent(this);
}).orElseGet(() -> {
return DataStoreEntry.createNew(UUID.randomUUID(),DataStorage.DEFAULT_CATEGORY_UUID, "Invalid", this);
});
}