Rework error actions

This commit is contained in:
crschnick 2024-05-06 00:14:14 +00:00
parent 1cabd5b93d
commit e4f5738fa5
17 changed files with 86 additions and 19 deletions

View file

@ -90,6 +90,10 @@ public class AppI18n {
private static String getCallerModuleName() {
var callers = CallingClass.INSTANCE.getCallingClasses();
for (Class<?> caller : callers) {
if (caller.isSynthetic()) {
continue;
}
if (caller.equals(CallingClass.class)
|| caller.equals(ModuleHelper.class)
|| caller.equals(ModalOverlayComp.class)

View file

@ -23,6 +23,9 @@ public class ErrorEvent {
@Builder.Default
private final boolean reportable = true;
@Setter
private boolean disableDefaultActions;
private final Throwable throwable;
@Singular
@ -153,6 +156,10 @@ public class ErrorEvent {
return omit().expected();
}
public ErrorEventBuilder noDefaultActions() {
return disableDefaultActions(true);
}
public void handle() {
build().handle();
}

View file

@ -11,7 +11,6 @@ import io.xpipe.app.fxcomps.SimpleComp;
import io.xpipe.app.fxcomps.augment.GrowAugment;
import io.xpipe.app.util.LicenseRequiredException;
import io.xpipe.app.util.PlatformState;
import javafx.application.Platform;
import javafx.beans.property.Property;
import javafx.beans.property.SimpleObjectProperty;
@ -25,7 +24,6 @@ import javafx.scene.layout.Region;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import org.kordamp.ikonli.javafx.FontIcon;
import java.util.List;
@ -243,25 +241,24 @@ public class ErrorHandlerComp extends SimpleComp {
return true;
}
});
event.setDisableDefaultActions(true);
}
var custom = event.getCustomActions();
for (var c : custom) {
var ac = createActionComp(c);
ac.getStyleClass().addAll(BUTTON_OUTLINED, ACCENT);
actionBox.getChildren().add(ac);
}
for (var action : List.of(ErrorAction.automaticallyReport(), ErrorAction.reportOnGithub())) {
var ac = createActionComp(action);
actionBox.getChildren().add(ac);
if (!event.isDisableDefaultActions() || event.getCustomActions().isEmpty()) {
for (var action : List.of(ErrorAction.automaticallyReport(), ErrorAction.reportOnGithub(), ErrorAction.ignore())) {
var ac = createActionComp(action);
actionBox.getChildren().add(ac);
}
actionBox.getChildren().get(1).getStyleClass().addAll(BUTTON_OUTLINED, ACCENT);
}
for (var action : List.of(ErrorAction.ignore())) {
var ac = createActionComp(action);
actionBox.getChildren().add(ac);
}
actionBox.getChildren().get(1).getStyleClass().addAll(BUTTON_OUTLINED, ACCENT);
content.getChildren().addAll(actionBox, new Separator(Orientation.HORIZONTAL));
var details = createDetails();

View file

@ -71,7 +71,6 @@ public enum PlatformState {
try {
// Weird fix to ensure that macOS quit operation works while in tray.
// Maybe related to https://bugs.openjdk.org/browse/JDK-8318129 as it prints the same error if not called
// The headless check is not needed though but still done
GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices();
// Catch more than just the headless exception in case the graphics environment initialization completely
@ -84,9 +83,9 @@ public enum PlatformState {
+ " You don't have to install XPipe on any system like a server, a WSL distribution, a hypervisor, etc.,"
+ " to have full access to that system, a shell connection to it is enough for XPipe to work from your local machine."
: h.getMessage();
TrackEvent.warn(h.getMessage());
TrackEvent.warn(msg);
PlatformState.setCurrent(PlatformState.EXITED);
return Optional.of(ErrorEvent.expected(new HeadlessException(msg)));
return Optional.of(ErrorEvent.expected(new UnsupportedOperationException(msg)));
} catch (Throwable t) {
TrackEvent.warn(t.getMessage());
PlatformState.setCurrent(PlatformState.EXITED);

View file

@ -90,12 +90,12 @@ public class SecretRetrievalStrategyHelper {
new SimpleObjectProperty<>(strat instanceof SecretRetrievalStrategy.CustomCommand i ? i : null);
var map = new LinkedHashMap<String, OptionsBuilder>();
if (allowNone) {
map.put("none", new OptionsBuilder());
map.put("app.none", new OptionsBuilder());
}
map.put("password", inPlace(inPlace));
map.put("passwordManager", passwordManager(passwordManager));
map.put("customCommand", customCommand(customCommand));
map.put("prompt", new OptionsBuilder());
map.put("app.password", inPlace(inPlace));
map.put("app.passwordManager", passwordManager(passwordManager));
map.put("app.customCommand", customCommand(customCommand));
map.put("app.prompt", new OptionsBuilder());
int offset = allowNone ? 0 : -1;
var selected = new SimpleIntegerProperty(

View file

@ -327,3 +327,8 @@ vncSystem=VNC-målsystem
vncSystemDescription=Det faktiske system, der skal interageres med. Dette er normalt det samme som tunnelværten
vncHost=Fjerntliggende tunnelvært
vncHostDescription=Det system, som VNC-serveren kører på
gitVaultTitle=Git-hvælving
gitVaultForcePushHeader=Vil du tvinge push til fjernlageret?
gitVaultForcePushContent=Dette vil helt erstatte alt indhold i fjernarkivet med dit lokale, inklusive historikken.
gitVaultOverwriteLocalHeader=Vil du tilsidesætte din lokale boks?
gitVaultOverwriteLocalContent=Dette vil erstatte alt lokalt indhold med fjernlageret, inklusive historikken.

View file

@ -317,3 +317,8 @@ vncSystem=VNC-Zielsystem
vncSystemDescription=Das eigentliche System, mit dem interagiert werden soll. Dies ist normalerweise dasselbe wie der Tunnel-Host
vncHost=Entfernter Tunnel-Host
vncHostDescription=Das System, auf dem der VNC-Server läuft
gitVaultTitle=Git-Tresor
gitVaultForcePushHeader=Willst du den Push zum entfernten Repository erzwingen?
gitVaultForcePushContent=Dadurch werden alle Inhalte des entfernten Repositorys vollständig durch dein lokales Repository ersetzt, einschließlich des Verlaufs.
gitVaultOverwriteLocalHeader=Willst du deinen lokalen Tresor außer Kraft setzen?
gitVaultOverwriteLocalContent=Dadurch werden alle lokalen Inhalte vollständig durch das entfernte Repository ersetzt, einschließlich des Verlaufs.

View file

@ -315,3 +315,8 @@ vncSystem=VNC target system
vncSystemDescription=The actual system to interact with. This is usually the same as the tunnel host
vncHost=Remote tunnel host
vncHostDescription=The system on which the VNC server is running on
gitVaultTitle=Git vault
gitVaultForcePushHeader=Do you want to force push to the remote repository?
gitVaultForcePushContent=This will completely replace all remote repository contents with your local one, including the history.
gitVaultOverwriteLocalHeader=Do you want to override your local vault?
gitVaultOverwriteLocalContent=This will completely replace all local contents with the remote repository, including the history.

View file

@ -313,3 +313,8 @@ vncSystem=Sistema de destino VNC
vncSystemDescription=El sistema real con el que interactuar. Suele ser el mismo que el host del túnel
vncHost=Host de túnel remoto
vncHostDescription=El sistema en el que se ejecuta el servidor VNC
gitVaultTitle=Bóveda Git
gitVaultForcePushHeader=¿Quieres forzar el push al repositorio remoto?
gitVaultForcePushContent=Esto sustituirá completamente todo el contenido del repositorio remoto por el local, incluido el historial.
gitVaultOverwriteLocalHeader=¿Quieres anular tu bóveda local?
gitVaultOverwriteLocalContent=Esto sustituirá completamente todos los contenidos locales por el repositorio remoto, incluido el historial.

View file

@ -313,3 +313,8 @@ vncSystem=Système cible VNC
vncSystemDescription=Le système réel avec lequel interagir. Il s'agit généralement du même que l'hôte du tunnel
vncHost=Hôte du tunnel à distance
vncHostDescription=Le système sur lequel le serveur VNC fonctionne
gitVaultTitle=Coffre-fort Git
gitVaultForcePushHeader=Veux-tu forcer la poussée vers le dépôt distant ?
gitVaultForcePushContent=Cela remplacera complètement tout le contenu du dépôt distant par ton dépôt local, y compris l'historique.
gitVaultOverwriteLocalHeader=Veux-tu remplacer ton coffre-fort local ?
gitVaultOverwriteLocalContent=Cela remplacera complètement tous les contenus locaux par le référentiel distant, y compris l'historique.

View file

@ -313,3 +313,8 @@ vncSystem=Sistema di destinazione VNC
vncSystemDescription=Il sistema effettivo con cui interagire. Di solito coincide con l'host del tunnel
vncHost=Tunnel host remoto
vncHostDescription=Il sistema su cui viene eseguito il server VNC
gitVaultTitle=Git vault
gitVaultForcePushHeader=Vuoi forzare il push al repository remoto?
gitVaultForcePushContent=Questo sostituirà completamente tutti i contenuti del repository remoto con quello locale, compresa la cronologia.
gitVaultOverwriteLocalHeader=Vuoi ignorare il tuo vault locale?
gitVaultOverwriteLocalContent=Questo sostituirà completamente tutti i contenuti locali con quelli del repository remoto, compresa la cronologia.

View file

@ -313,3 +313,8 @@ vncSystem=VNCターゲットシステム
vncSystemDescription=実際にやりとりするシステム。これは通常トンネルホストと同じである。
vncHost=リモートトンネルホスト
vncHostDescription=VNCサーバーが動作しているシステム
gitVaultTitle=Git保管庫
gitVaultForcePushHeader=リモートリポジトリに強制プッシュするか?
gitVaultForcePushContent=これは、履歴を含め、すべてのリモートリポジトリの内容をローカルリポジトリに完全に置き換える。
gitVaultOverwriteLocalHeader=ローカル金庫を上書きするか?
gitVaultOverwriteLocalContent=これにより、履歴を含むすべてのローカルコンテンツがリモートリポジトリに完全に置き換えられる。

View file

@ -313,3 +313,8 @@ vncSystem=VNC doelsysteem
vncSystemDescription=Het eigenlijke systeem om mee te communiceren. Dit is meestal hetzelfde als de tunnelhost
vncHost=Remote tunnel host
vncHostDescription=Het systeem waarop de VNC-server draait
gitVaultTitle=Git kluis
gitVaultForcePushHeader=Wil je een push naar het archief op afstand forceren?
gitVaultForcePushContent=Dit zal alle inhoud van het externe archief volledig vervangen door je lokale archief, inclusief de geschiedenis.
gitVaultOverwriteLocalHeader=Wil je je lokale kluis overschrijven?
gitVaultOverwriteLocalContent=Dit zal alle lokale inhoud volledig vervangen door het externe archief, inclusief de geschiedenis.

View file

@ -313,3 +313,8 @@ vncSystem=Sistema de destino VNC
vncSystemDescription=O sistema real com o qual interage. Geralmente é o mesmo que o host do túnel
vncHost=Anfitrião de túnel remoto
vncHostDescription=O sistema no qual o servidor VNC está sendo executado
gitVaultTitle=Cofre do Git
gitVaultForcePushHeader=Queres forçar o envio para o repositório remoto?
gitVaultForcePushContent=Isto irá substituir completamente todos os conteúdos do repositório remoto pelo teu repositório local, incluindo o histórico.
gitVaultOverwriteLocalHeader=Queres substituir o teu cofre local?
gitVaultOverwriteLocalContent=Isto irá substituir completamente todos os conteúdos locais pelo repositório remoto, incluindo o histórico.

View file

@ -313,3 +313,8 @@ vncSystem=Целевая система VNC
vncSystemDescription=Фактическая система, с которой нужно взаимодействовать. Обычно это то же самое, что и туннельный хост
vncHost=Удаленный туннельный хост
vncHostDescription=Система, на которой работает VNC-сервер
gitVaultTitle=Git vault
gitVaultForcePushHeader=Хочешь ли ты принудительно запустить push в удаленное хранилище?
gitVaultForcePushContent=Это полностью заменит все содержимое удаленного хранилища на ваше локальное, включая историю.
gitVaultOverwriteLocalHeader=Хочешь переопределить свое локальное хранилище?
gitVaultOverwriteLocalContent=Это полностью заменит всё локальное содержимое на удалённое хранилище, включая историю.

View file

@ -313,3 +313,8 @@ vncSystem=VNC hedef sistemi
vncSystemDescription=Etkileşim kurulacak asıl sistem. Bu genellikle tünel ana bilgisayarıyla aynıdır
vncHost=Uzak tünel ana bilgisayarı
vncHostDescription=VNC sunucusunun üzerinde çalıştığı sistem
gitVaultTitle=Git kasası
gitVaultForcePushHeader=Uzak depoya itmeye zorlamak istiyor musunuz?
gitVaultForcePushContent=Bu, geçmiş de dahil olmak üzere tüm uzak depo içeriğini yerel deponuzla tamamen değiştirecektir.
gitVaultOverwriteLocalHeader=Yerel kasanızı geçersiz kılmak mı istiyorsunuz?
gitVaultOverwriteLocalContent=Bu, geçmiş de dahil olmak üzere tüm yerel içerikleri uzak depo ile tamamen değiştirecektir.

View file

@ -313,3 +313,8 @@ vncSystem=VNC 目标系统
vncSystemDescription=实际交互系统。通常与隧道主机相同
vncHost=远程隧道主机
vncHostDescription=运行 VNC 服务器的系统
gitVaultTitle=Git 数据库
gitVaultForcePushHeader=您想强制推送到远程存储库吗?
gitVaultForcePushContent=这将用本地存储库完全替换所有远程存储库的内容,包括历史记录。
gitVaultOverwriteLocalHeader=您想覆盖本地保险库吗?
gitVaultOverwriteLocalContent=这将用远程存储库完全替换所有本地内容,包括历史记录。