Fix outdated data in scan dialog

This commit is contained in:
crschnick 2023-08-19 20:28:03 +00:00
parent 1d55692d26
commit ba295e975e
3 changed files with 10 additions and 9 deletions

View file

@ -109,7 +109,7 @@ public interface ExternalEditorType extends PrefsChoiceValue {
public void launch(Path file) throws Exception {
var customCommand = AppPrefs.get().customEditorCommand().getValue();
if (customCommand == null || customCommand.isBlank()) {
throw new IllegalStateException("No custom editor command specified");
throw ErrorEvent.unreportable(new IllegalStateException("No custom editor command specified"));
}
var format = customCommand.toLowerCase(Locale.ROOT).contains("$file") ? customCommand : customCommand + " $FILE";

View file

@ -445,7 +445,7 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
public void launch(String name, String file) throws Exception {
var custom = AppPrefs.get().customTerminalCommand().getValue();
if (custom == null || custom.isBlank()) {
throw new IllegalStateException("No custom terminal command specified");
throw ErrorEvent.unreportable(new IllegalStateException("No custom terminal command specified"));
}
var format = custom.toLowerCase(Locale.ROOT).contains("$cmd") ? custom : custom + " $CMD";

View file

@ -98,7 +98,7 @@ public class ScanAlert {
// Custom behavior for ok button
var btOk = (Button) alert.getDialogPane().lookupButton(ButtonType.OK);
btOk.addEventFilter(ActionEvent.ACTION, event -> {
if (store.get() == null) {
if (store.get() == null || busy.get()) {
event.consume();
return;
}
@ -125,13 +125,14 @@ public class ScanAlert {
});
store.addListener((observable, oldValue, newValue) -> {
selected.clear();
((VBox) ((StackPane) alert.getDialogPane().getContent())
.getChildren()
.get(0))
.getChildren()
.set(3, new Region());
if (newValue == null) {
selected.clear();
((VBox) ((StackPane) alert.getDialogPane().getContent())
.getChildren()
.get(0))
.getChildren()
.set(3, new Region());
return;
}