mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-25 00:50:31 +00:00
Refactor and cleanup
This commit is contained in:
parent
d14088d9bc
commit
c84db86457
90 changed files with 119 additions and 265 deletions
|
@ -52,7 +52,7 @@ The feature set is the same for all supported connection types. It of course als
|
|||
|
||||
<br>
|
||||
<p align="center">
|
||||
<img src="https://github.com/xpipe-io/xpipe/assets/72509152/f3d29909-acd7-4568-a625-0667d936ef2b" />
|
||||
<img src="https://github.com/xpipe-io/xpipe/assets/72509152/f3d29909-acd7-4568-a625-0667d936ef2b" alt="Terminal launcher"/>
|
||||
</p>
|
||||
<br>
|
||||
|
||||
|
|
|
@ -83,8 +83,7 @@ public abstract class DataSourceImpl implements DataSource {
|
|||
.configureAll(false)
|
||||
.build();
|
||||
var startRes = XPipeApiConnection.execute(con -> {
|
||||
ReadExchange.Response r = con.performSimpleExchange(startReq);
|
||||
return r;
|
||||
return con.<ReadExchange.Request, ReadExchange.Response>performSimpleExchange(startReq);
|
||||
});
|
||||
|
||||
var configInstance = startRes.getConfig();
|
||||
|
@ -113,8 +112,7 @@ public abstract class DataSourceImpl implements DataSource {
|
|||
.configureAll(false)
|
||||
.build();
|
||||
var startRes = XPipeApiConnection.execute(con -> {
|
||||
ReadExchange.Response r = con.performSimpleExchange(startReq);
|
||||
return r;
|
||||
return con.<ReadExchange.Request, ReadExchange.Response>performSimpleExchange(startReq);
|
||||
});
|
||||
|
||||
var configInstance = startRes.getConfig();
|
||||
|
|
|
@ -46,7 +46,7 @@ public class DataTableImpl extends DataSourceImpl implements DataTable {
|
|||
|
||||
@Override
|
||||
public Iterator<TupleNode> iterator() {
|
||||
return new Iterator<TupleNode>() {
|
||||
return new Iterator<>() {
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return false;
|
||||
|
|
|
@ -83,7 +83,7 @@ dependencies {
|
|||
testImplementation project(':core')
|
||||
}
|
||||
|
||||
project.allExtensions.forEach(p -> {
|
||||
project.allExtensions.forEach((Project p) -> {
|
||||
dependencies {
|
||||
testCompileOnly p
|
||||
}
|
||||
|
|
|
@ -40,8 +40,7 @@ public class BrowserClipboard {
|
|||
}
|
||||
|
||||
public static Instance retrieveCopy() {
|
||||
var current = currentCopyClipboard;
|
||||
return current.getValue();
|
||||
return currentCopyClipboard.getValue();
|
||||
}
|
||||
|
||||
public static Instance retrieveDrag(Dragboard dragboard) {
|
||||
|
|
|
@ -85,7 +85,7 @@ final class BrowserContextMenu extends ContextMenu {
|
|||
}
|
||||
|
||||
private static List<BrowserEntry> resolveIfNeeded(BrowserAction action, List<BrowserEntry> selected) {
|
||||
var used = action.automaticallyResolveLinks()
|
||||
return action.automaticallyResolveLinks()
|
||||
? selected.stream()
|
||||
.map(browserEntry -> new BrowserEntry(
|
||||
browserEntry.getRawFileEntry().resolved(),
|
||||
|
@ -93,6 +93,5 @@ final class BrowserContextMenu extends ContextMenu {
|
|||
browserEntry.isSynthetic()))
|
||||
.toList()
|
||||
: selected;
|
||||
return used;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,8 +65,7 @@ final class BrowserFileListComp extends SimpleComp {
|
|||
|
||||
@Override
|
||||
protected Region createSimple() {
|
||||
TableView<BrowserEntry> table = createTable();
|
||||
return table;
|
||||
return createTable();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
|
|
@ -89,10 +89,9 @@ public class BrowserNavBar extends SimpleComp {
|
|||
|
||||
var graphic = Bindings.createStringBinding(
|
||||
() -> {
|
||||
var icon = model.getCurrentDirectory() != null
|
||||
return model.getCurrentDirectory() != null
|
||||
? FileIconManager.getFileIcon(model.getCurrentDirectory(), false)
|
||||
: "home_icon.svg";
|
||||
return icon;
|
||||
},
|
||||
model.getCurrentPath());
|
||||
var breadcrumbsGraphic = new PrettyImageComp(graphic, 22, 22)
|
||||
|
|
|
@ -33,10 +33,9 @@ public class BrowserOverviewComp extends SimpleComp {
|
|||
.map(s -> FileSystem.FileEntry.ofDirectory(model.getFileSystem(), s))
|
||||
.filter(entry -> {
|
||||
try {
|
||||
var b = sc.getShellDialect()
|
||||
return sc.getShellDialect()
|
||||
.directoryExists(sc, entry.getPath())
|
||||
.executeAndCheck();
|
||||
return b;
|
||||
} catch (Exception e) {
|
||||
ErrorEvent.fromThrowable(e).handle();
|
||||
return false;
|
||||
|
|
|
@ -17,10 +17,9 @@ import java.util.UUID;
|
|||
public class BrowserSavedState {
|
||||
|
||||
static BrowserSavedState load() {
|
||||
BrowserSavedState state = AppCache.get("browser-state", BrowserSavedState.class, () -> {
|
||||
return AppCache.get("browser-state", BrowserSavedState.class, () -> {
|
||||
return null;
|
||||
});
|
||||
return state;
|
||||
}
|
||||
|
||||
@Value
|
||||
|
|
|
@ -40,8 +40,7 @@ public class BrowserSelectionListComp extends SimpleComp {
|
|||
AppStyle.addStylesheets(scene);
|
||||
SnapshotParameters parameters = new SnapshotParameters();
|
||||
parameters.setFill(Color.TRANSPARENT);
|
||||
WritableImage image = r.snapshot(parameters, null);
|
||||
return image;
|
||||
return r.snapshot(parameters, null);
|
||||
}
|
||||
|
||||
ObservableList<FileSystem.FileEntry> list;
|
||||
|
|
|
@ -43,12 +43,11 @@ public class DeveloperTabComp extends SimpleComp {
|
|||
|
||||
var button5 = new ButtonComp(AppI18n.observable("Operation mode null"), null, OperationMode::close);
|
||||
|
||||
var box = new HBox(
|
||||
return new HBox(
|
||||
button.createRegion(),
|
||||
button2.createRegion(),
|
||||
button3.createRegion(),
|
||||
button4.createRegion(),
|
||||
button5.createRegion());
|
||||
return box;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ public class CountComp<T> extends Comp<CompStructure<Label>> {
|
|||
if (sub.size() == all.size()) {
|
||||
return all.size() + "";
|
||||
} else {
|
||||
return "" + sub.size() + "/" + all.size();
|
||||
return sub.size() + "/" + all.size();
|
||||
}
|
||||
},
|
||||
sub,
|
||||
|
|
|
@ -49,7 +49,7 @@ public class IntegratedTextAreaComp extends SimpleComp {
|
|||
}
|
||||
|
||||
private Region createOpenButton(Region container) {
|
||||
var button = new IconButtonComp(
|
||||
return new IconButtonComp(
|
||||
"mdal-edit",
|
||||
() -> FileOpener.openString(
|
||||
identifier + (fileType.getValue() != null ? "." + fileType.getValue() : ""),
|
||||
|
@ -59,6 +59,5 @@ public class IntegratedTextAreaComp extends SimpleComp {
|
|||
Platform.runLater(() -> value.setValue(s));
|
||||
}))
|
||||
.createRegion();
|
||||
return button;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ import lombok.SneakyThrows;
|
|||
|
||||
import java.awt.*;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.net.URI;
|
||||
import java.nio.file.Files;
|
||||
import java.util.function.UnaryOperator;
|
||||
|
||||
|
@ -87,7 +87,7 @@ public class MarkdownComp extends Comp<CompStructure<StackPane>> {
|
|||
if (toBeopen.contains("http://") || toBeopen.contains("https://")) {
|
||||
engine.getLoadWorker().cancel();
|
||||
try {
|
||||
Desktop.getDesktop().browse(new URL(toBeopen).toURI());
|
||||
Desktop.getDesktop().browse(URI.create(toBeopen));
|
||||
} catch (Exception e) {
|
||||
ErrorEvent.fromThrowable(e).omit().handle();
|
||||
}
|
||||
|
|
|
@ -53,7 +53,6 @@ public class OsLogoComp extends SimpleComp {
|
|||
});
|
||||
}
|
||||
|
||||
var found = ICONS.entrySet().stream().filter(e->name.toLowerCase().contains(e.getKey())).findAny().map(e->e.getValue()).orElse("os/" + LINUX_DEFAULT);
|
||||
return found;
|
||||
return ICONS.entrySet().stream().filter(e->name.toLowerCase().contains(e.getKey())).findAny().map(e->e.getValue()).orElse("os/" + LINUX_DEFAULT);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ public class SystemStateComp extends SimpleComp {
|
|||
this.state = state;
|
||||
}
|
||||
|
||||
public static enum State {
|
||||
public enum State {
|
||||
FAILURE,
|
||||
SUCCESS,
|
||||
OTHER
|
||||
|
@ -29,16 +29,15 @@ public class SystemStateComp extends SimpleComp {
|
|||
private final ObservableValue<State> state;
|
||||
|
||||
public SystemStateComp(StoreEntryWrapper w) {
|
||||
var state = Bindings.createObjectBinding(
|
||||
this.state = Bindings.createObjectBinding(
|
||||
() -> {
|
||||
return w.getState().getValue() == DataStoreEntry.State.COMPLETE_BUT_INVALID
|
||||
? SystemStateComp.State.FAILURE
|
||||
? State.FAILURE
|
||||
: w.getState().getValue() == DataStoreEntry.State.COMPLETE_AND_VALID
|
||||
? SystemStateComp.State.SUCCESS
|
||||
: SystemStateComp.State.OTHER;
|
||||
? State.SUCCESS
|
||||
: State.OTHER;
|
||||
},
|
||||
w.getState());
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -22,13 +22,11 @@ public class DenseStoreEntryComp extends StoreEntryComp {
|
|||
var grid = new GridPane();
|
||||
grid.setHgap(8);
|
||||
|
||||
int index = 0;
|
||||
if (showIcon) {
|
||||
var storeIcon = createIcon(26, 21);
|
||||
grid.getColumnConstraints().add(new ColumnConstraints(26));
|
||||
grid.add(storeIcon, 0, 0);
|
||||
GridPane.setHalignment(storeIcon, HPos.CENTER);
|
||||
index++;
|
||||
}
|
||||
|
||||
var customSize = content != null ? 300 : 0;
|
||||
|
|
|
@ -84,8 +84,7 @@ public abstract class StoreEntryComp extends SimpleComp {
|
|||
new ContextMenuAugment<>(() -> this.createContextMenu()).augment(new SimpleCompStructure<>(button));
|
||||
|
||||
var loading = new LoadingOverlayComp(Comp.of(() -> button), wrapper.getValidating());
|
||||
var region = loading.createRegion();
|
||||
return region;
|
||||
return loading.createRegion();
|
||||
}
|
||||
|
||||
protected abstract Region createContent();
|
||||
|
|
|
@ -57,7 +57,6 @@ public class StoreEntryFlatMiniSectionComp extends SimpleComp {
|
|||
var label =
|
||||
new Label(entry.getName(), new PrettyImageComp(new SimpleStringProperty(image), 20, 20).createRegion());
|
||||
var spacer = new Spacer(depth * 10, Orientation.HORIZONTAL);
|
||||
var box = new HBox(spacer, label);
|
||||
return box;
|
||||
return new HBox(spacer, label);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ public class StoreNotFoundComp extends SimpleComp {
|
|||
|
||||
@Override
|
||||
public Region createSimple() {
|
||||
var sp = new StackPane();
|
||||
return sp;
|
||||
return new StackPane();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ public class AppActionLinkDetector {
|
|||
}
|
||||
|
||||
private static boolean showAlert() {
|
||||
var paste = AppWindowHelper.showBlockingAlert(alert -> {
|
||||
return AppWindowHelper.showBlockingAlert(alert -> {
|
||||
alert.setAlertType(Alert.AlertType.CONFIRMATION);
|
||||
alert.setTitle(AppI18n.get("clipboardActionDetectedTitle"));
|
||||
alert.setHeaderText(AppI18n.get("clipboardActionDetectedHeader"));
|
||||
|
@ -70,6 +70,5 @@ public class AppActionLinkDetector {
|
|||
})
|
||||
.map(buttonType -> buttonType.getButtonData().isDefaultButton())
|
||||
.orElse(false);
|
||||
return paste;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ public class AppFont {
|
|||
"fonts",
|
||||
path -> Files.walkFileTree(path, new SimpleFileVisitor<>() {
|
||||
@Override
|
||||
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
|
||||
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
|
||||
try (var in = Files.newInputStream(file)) {
|
||||
Font.loadFont(in, 12);
|
||||
} catch (Throwable t) {
|
||||
|
|
|
@ -67,6 +67,7 @@ public class AppGreetings {
|
|||
|
||||
public static void showIfNeeded() {
|
||||
// TODO
|
||||
//noinspection PointlessBooleanExpression
|
||||
if (!AppProperties.get().isImage() || true) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -16,9 +16,8 @@ public class MessageExchangeImpls {
|
|||
public static void loadAll() {
|
||||
ALL = ServiceLoader.load(MessageExchangeImpl.class).stream()
|
||||
.map(s -> {
|
||||
var ex = (MessageExchangeImpl<?, ?>) s.get();
|
||||
// TrackEvent.trace("init", "Loaded exchange implementation " + ex.getId());
|
||||
return ex;
|
||||
return (MessageExchangeImpl<?, ?>) s.get();
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ public class ReadDrainExchangeImpl extends ReadDrainExchange
|
|||
implements MessageExchangeImpl<ReadDrainExchange.Request, ReadDrainExchange.Response> {
|
||||
|
||||
@Override
|
||||
public Response handleRequest(BeaconHandler handler, Request msg) throws Exception {
|
||||
public Response handleRequest(BeaconHandler handler, Request msg) {
|
||||
return ReadDrainExchange.Response.builder().build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,10 +81,9 @@ public interface DataStoreProvider {
|
|||
return createInsightsMarkdown(store.getValue());
|
||||
},
|
||||
store);
|
||||
var markdown = new MarkdownComp(content, s -> s)
|
||||
return new MarkdownComp(content, s -> s)
|
||||
.apply(struc -> struc.get().setPrefWidth(450))
|
||||
.apply(struc -> struc.get().setPrefHeight(200));
|
||||
return markdown;
|
||||
}
|
||||
|
||||
default String createInsightsMarkdown(DataStore store) {
|
||||
|
@ -124,7 +123,7 @@ public interface DataStoreProvider {
|
|||
return null;
|
||||
}
|
||||
|
||||
default String queryInvalidInformationString(DataStore store, int length) throws Exception {
|
||||
default String queryInvalidInformationString(DataStore store, int length) {
|
||||
return "Connection failed";
|
||||
}
|
||||
|
||||
|
@ -160,8 +159,7 @@ public interface DataStoreProvider {
|
|||
return png;
|
||||
}
|
||||
|
||||
var svg = getModuleName() + ":" + getId() + "_icon.svg";
|
||||
return svg;
|
||||
return getModuleName() + ":" + getId() + "_icon.svg";
|
||||
}
|
||||
|
||||
default Dialog dialogForStore(DataStore store) {
|
||||
|
|
|
@ -23,7 +23,7 @@ import java.util.function.Predicate;
|
|||
public class DataStoreChoiceComp<T extends DataStore> extends SimpleComp {
|
||||
|
||||
public static <T extends DataStore> DataStoreChoiceComp<T> other(Property<T> selected, Class<T> clazz, Predicate<T> filter) {
|
||||
return new DataStoreChoiceComp<T>(Mode.OTHER, null, selected, clazz, filter);
|
||||
return new DataStoreChoiceComp<>(Mode.OTHER, null, selected, clazz, filter);
|
||||
}
|
||||
|
||||
public static DataStoreChoiceComp<ShellStore> proxy(Property<ShellStore> selected) {
|
||||
|
|
|
@ -100,11 +100,10 @@ public class DynamicOptionsComp extends Comp<CompStructure<Pane>> {
|
|||
return Region.USE_COMPUTED_SIZE;
|
||||
}
|
||||
|
||||
var m = compRegions.stream()
|
||||
return compRegions.stream()
|
||||
.map(Region::getWidth)
|
||||
.max(Double::compareTo)
|
||||
.orElse(0.0);
|
||||
return m;
|
||||
},
|
||||
compRegions.stream().map(Region::widthProperty).toList().toArray(new Observable[0]));
|
||||
compRegions.forEach(r -> r.prefWidthProperty().bind(compWidthBinding));
|
||||
|
@ -117,11 +116,10 @@ public class DynamicOptionsComp extends Comp<CompStructure<Pane>> {
|
|||
return Region.USE_COMPUTED_SIZE;
|
||||
}
|
||||
|
||||
var m = nameRegions.stream()
|
||||
return nameRegions.stream()
|
||||
.map(Region::getWidth)
|
||||
.max(Double::compareTo)
|
||||
.orElse(0.0);
|
||||
return m;
|
||||
},
|
||||
nameRegions.stream().map(Region::widthProperty).toList().toArray(new Observable[0]));
|
||||
nameRegions.forEach(r -> r.prefWidthProperty().bind(nameWidthBinding));
|
||||
|
|
|
@ -21,12 +21,11 @@ public class FileSystemStoreChoiceComp extends SimpleComp {
|
|||
}
|
||||
|
||||
private static String getName(FileSystemStore store) {
|
||||
var name = DataStorage.get().getUsableStores().stream()
|
||||
return DataStorage.get().getUsableStores().stream()
|
||||
.filter(e -> e.equals(store))
|
||||
.findAny()
|
||||
.map(e -> DataStorage.get().getStoreDisplayName(e).orElse("?"))
|
||||
.orElse("?");
|
||||
return name;
|
||||
}
|
||||
|
||||
private Region createGraphic(FileSystemStore s) {
|
||||
|
|
|
@ -152,12 +152,11 @@ public class OptionsComp extends Comp<CompStructure<Pane>> {
|
|||
if (entries.stream().anyMatch(entry -> entry.name() != null && entry.description() == null)) {
|
||||
var nameWidthBinding = Bindings.createDoubleBinding(
|
||||
() -> {
|
||||
var m = nameRegions.stream()
|
||||
return nameRegions.stream()
|
||||
.map(Region::getWidth)
|
||||
.filter(aDouble -> aDouble > 0.0)
|
||||
.max(Double::compareTo)
|
||||
.orElse(Region.USE_COMPUTED_SIZE);
|
||||
return m;
|
||||
},
|
||||
nameRegions.stream().map(Region::widthProperty).toList().toArray(new Observable[0]));
|
||||
nameRegions.forEach(r -> r.minWidthProperty().bind(nameWidthBinding));
|
||||
|
|
|
@ -17,6 +17,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
@SuppressWarnings("InfiniteLoopStatement")
|
||||
public class BindingsHelper {
|
||||
|
||||
private static final Set<ReferenceEntry> REFERENCES = Collections.newSetFromMap(new ConcurrentHashMap<>());
|
||||
|
|
|
@ -7,6 +7,7 @@ import javafx.beans.value.ChangeListener;
|
|||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.ListChangeListener;
|
||||
import javafx.collections.ObservableList;
|
||||
import lombok.NonNull;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
@ -151,17 +152,17 @@ public class PlatformThread {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Iterator<T> iterator() {
|
||||
public @NonNull Iterator<T> iterator() {
|
||||
return ol.iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] toArray() {
|
||||
public Object @NonNull [] toArray() {
|
||||
return ol.toArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T1> T1[] toArray(T1[] a) {
|
||||
public <T1> T1 @NonNull [] toArray(T1 @NonNull [] a) {
|
||||
return ol.toArray(a);
|
||||
}
|
||||
|
||||
|
@ -176,27 +177,27 @@ public class PlatformThread {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean containsAll(Collection<?> c) {
|
||||
public boolean containsAll(@NonNull Collection<?> c) {
|
||||
return ol.containsAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(Collection<? extends T> c) {
|
||||
public boolean addAll(@NonNull Collection<? extends T> c) {
|
||||
return ol.addAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(int index, Collection<? extends T> c) {
|
||||
public boolean addAll(int index, @NonNull Collection<? extends T> c) {
|
||||
return ol.addAll(index, c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeAll(Collection<?> c) {
|
||||
public boolean removeAll(@NonNull Collection<?> c) {
|
||||
return ol.removeAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean retainAll(Collection<?> c) {
|
||||
public boolean retainAll(@NonNull Collection<?> c) {
|
||||
return ol.retainAll(c);
|
||||
}
|
||||
|
||||
|
@ -236,17 +237,17 @@ public class PlatformThread {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ListIterator<T> listIterator() {
|
||||
public @NonNull ListIterator<T> listIterator() {
|
||||
return ol.listIterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListIterator<T> listIterator(int index) {
|
||||
public @NonNull ListIterator<T> listIterator(int index) {
|
||||
return ol.listIterator(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<T> subList(int fromIndex, int toIndex) {
|
||||
public @NonNull List<T> subList(int fromIndex, int toIndex) {
|
||||
return ol.subList(fromIndex, toIndex);
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ public class ErrorDetailsComp extends SimpleComp {
|
|||
|
||||
private Comp<?> createTrackEventHistory() {
|
||||
var list = FXCollections.observableList(event.getTrackEvents());
|
||||
var comp = new ListViewComp<>(list, list, null, te -> {
|
||||
return new ListViewComp<>(list, list, null, te -> {
|
||||
var label = new Label(te.getMessage());
|
||||
var i = DateTimeFormatter.ofPattern("HH:mm:ss:SSS")
|
||||
.withZone(ZoneId.systemDefault())
|
||||
|
@ -54,7 +54,6 @@ public class ErrorDetailsComp extends SimpleComp {
|
|||
HBox.setHgrow(spacer, Priority.ALWAYS);
|
||||
return Comp.of(() -> c);
|
||||
});
|
||||
return comp;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -93,7 +93,7 @@ public class ErrorEvent {
|
|||
}
|
||||
}
|
||||
|
||||
private static Map<Throwable, ErrorEventBuilder> EVENT_BASES = new ConcurrentHashMap<>();
|
||||
private static final Map<Throwable, ErrorEventBuilder> EVENT_BASES = new ConcurrentHashMap<>();
|
||||
|
||||
public static <T extends Throwable> T unreportableIfEndsWith(T t, String... s) {
|
||||
return unreportableIf(
|
||||
|
|
|
@ -59,11 +59,10 @@ public class UserReportComp extends SimpleComp {
|
|||
includedDiagnostics,
|
||||
false)
|
||||
.styleClass("attachment-list");
|
||||
var tp = new TitledPaneComp(AppI18n.observable("additionalErrorAttachments"), list, 100)
|
||||
return new TitledPaneComp(AppI18n.observable("additionalErrorAttachments"), list, 100)
|
||||
.apply(struc -> struc.get().setExpanded(true))
|
||||
.apply(s -> AppFont.medium(s.get()))
|
||||
.styleClass("attachments");
|
||||
return tp;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -17,8 +17,7 @@ import java.util.List;
|
|||
public class AboutComp extends Comp<CompStructure<?>> {
|
||||
|
||||
private Region createDepsList() {
|
||||
var deps = new ThirdPartyDependencyListComp().createRegion();
|
||||
return deps;
|
||||
return new ThirdPartyDependencyListComp().createRegion();
|
||||
}
|
||||
|
||||
private Comp<?> createLinks() {
|
||||
|
|
|
@ -12,10 +12,6 @@ public enum CloseBehaviour implements PrefsChoiceValue {
|
|||
OperationMode.shutdown(false, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelectable() {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
MINIMIZE_TO_TRAY("app.minimizeToTray") {
|
||||
|
|
|
@ -123,11 +123,6 @@ public interface ExternalEditorType extends PrefsChoiceValue {
|
|||
ApplicationHelper.executeLocalApplication(sc -> ApplicationHelper.replaceFileArgument(format, "FILE", file.toString()), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelectable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return "app.custom";
|
||||
|
@ -195,6 +190,7 @@ public interface ExternalEditorType extends PrefsChoiceValue {
|
|||
List<LinuxPathType> LINUX_EDITORS = List.of(VSCODE_LINUX, KATE, GEDIT, PLUMA, LEAFPAD, MOUSEPAD);
|
||||
List<ExternalEditorType> MACOS_EDITORS = List.of(BBEDIT, VSCODE_MACOS, SUBLIME_MACOS, TEXT_EDIT);
|
||||
|
||||
@SuppressWarnings("TrivialFunctionalExpressionUsage")
|
||||
List<ExternalEditorType> ALL = ((Supplier<List<ExternalEditorType>>) () -> {
|
||||
var all = new ArrayList<ExternalEditorType>();
|
||||
if (OsType.getLocal().equals(OsType.WINDOWS)) {
|
||||
|
|
|
@ -2,6 +2,7 @@ package io.xpipe.app.prefs;
|
|||
|
||||
import com.dlsc.formsfx.model.util.ResourceBundleService;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import lombok.NonNull;
|
||||
|
||||
import java.util.Enumeration;
|
||||
import java.util.ResourceBundle;
|
||||
|
@ -11,7 +12,7 @@ public class QuietResourceBundleService extends ResourceBundleService {
|
|||
public QuietResourceBundleService() {
|
||||
super(new ResourceBundle() {
|
||||
@Override
|
||||
protected Object handleGetObject(String key) {
|
||||
protected Object handleGetObject(@NonNull String key) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -24,7 +25,6 @@ public class QuietResourceBundleService extends ResourceBundleService {
|
|||
|
||||
@Override
|
||||
public String translate(String key) {
|
||||
var value = AppI18n.get(key);
|
||||
return value;
|
||||
return AppI18n.get(key);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,9 +10,6 @@ import lombok.Getter;
|
|||
@AllArgsConstructor
|
||||
public enum StartupBehaviour implements PrefsChoiceValue {
|
||||
GUI("app.startGui", XPipeDaemonMode.GUI) {
|
||||
public boolean isSelectable() {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
TRAY("app.startInTray", XPipeDaemonMode.TRAY) {
|
||||
|
||||
|
|
|
@ -267,13 +267,12 @@ public abstract class DataStorage {
|
|||
}
|
||||
|
||||
public synchronized DataStoreEntry getStoreEntry(@NonNull DataStore store) {
|
||||
var entry = storeEntries.stream()
|
||||
return storeEntries.stream()
|
||||
.filter(n -> n.getStore() != null
|
||||
&& Objects.equals(store.getClass(), n.getStore().getClass())
|
||||
&& store.equals(n.getStore()))
|
||||
.findFirst()
|
||||
.orElseThrow(() -> new IllegalArgumentException("Store not found"));
|
||||
return entry;
|
||||
}
|
||||
|
||||
public synchronized Optional<DataStoreEntry> getStoreEntryIfPresent(@NonNull DataStoreId id) {
|
||||
|
@ -300,14 +299,13 @@ public abstract class DataStorage {
|
|||
}
|
||||
|
||||
public synchronized Optional<DataStoreEntry> getStoreEntryIfPresent(@NonNull DataStore store) {
|
||||
var entry = storeEntries.stream()
|
||||
return storeEntries.stream()
|
||||
.filter(n -> {
|
||||
return n.getStore() != null
|
||||
&& store.getClass().equals(n.getStore().getClass())
|
||||
&& store.equals(n.getStore());
|
||||
})
|
||||
.findFirst();
|
||||
return entry;
|
||||
}
|
||||
|
||||
public synchronized Optional<DataStoreEntry> getStoreEntryIfPresent(@NonNull String name) {
|
||||
|
|
|
@ -64,8 +64,7 @@ public class DataStorageWriter {
|
|||
|
||||
var value = function.apply(node).orElse(null);
|
||||
if (value != null) {
|
||||
var idReplacement = JsonNodeFactory.instance.objectNode().set(key, new TextNode(value.toString()));
|
||||
return idReplacement;
|
||||
return JsonNodeFactory.instance.objectNode().set(key, new TextNode(value.toString()));
|
||||
}
|
||||
|
||||
var replacement = JsonNodeFactory.instance.objectNode();
|
||||
|
|
|
@ -105,7 +105,7 @@ public class DataStoreEntry extends StorageElement {
|
|||
State state,
|
||||
Configuration configuration,
|
||||
boolean expanded) {
|
||||
var entry = new DataStoreEntry(
|
||||
return new DataStoreEntry(
|
||||
directory,
|
||||
uuid,
|
||||
name,
|
||||
|
@ -117,7 +117,6 @@ public class DataStoreEntry extends StorageElement {
|
|||
state,
|
||||
configuration,
|
||||
expanded);
|
||||
return entry;
|
||||
}
|
||||
|
||||
public static DataStoreEntry fromDirectory(Path dir) throws Exception {
|
||||
|
@ -263,18 +262,16 @@ public class DataStoreEntry extends StorageElement {
|
|||
information = getProvider().queryInformationString(getStore(), 50);
|
||||
dirty = true;
|
||||
} else if (complete) {
|
||||
var stateToUse = state == State.LOAD_FAILED || state == State.INCOMPLETE
|
||||
state = state == State.LOAD_FAILED || state == State.INCOMPLETE
|
||||
? State.COMPLETE_NOT_VALIDATED
|
||||
: state;
|
||||
state = stateToUse;
|
||||
information = state == State.COMPLETE_AND_VALID
|
||||
? information
|
||||
: state == State.COMPLETE_BUT_INVALID
|
||||
? getProvider().queryInvalidInformationString(getStore(), 50)
|
||||
: null;
|
||||
} else {
|
||||
var stateToUse = state == State.LOAD_FAILED ? State.COMPLETE_BUT_INVALID : State.INCOMPLETE;
|
||||
state = stateToUse;
|
||||
state = state == State.LOAD_FAILED ? State.COMPLETE_BUT_INVALID : State.INCOMPLETE;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
validating = false;
|
||||
|
@ -324,10 +321,6 @@ public class DataStoreEntry extends StorageElement {
|
|||
return getStore() == null || getStore().shouldSave();
|
||||
}
|
||||
|
||||
public void addListener(Listener l) {
|
||||
this.listeners.add(l);
|
||||
}
|
||||
|
||||
public void writeDataToDisk() throws Exception {
|
||||
if (!dirty) {
|
||||
return;
|
||||
|
|
|
@ -31,7 +31,6 @@ public class ImpersistentStorage extends DataStorage {
|
|||
|
||||
@Override
|
||||
public Path getInternalStreamPath(@NonNull UUID uuid) {
|
||||
var newDir = FileUtils.getTempDirectory().toPath().resolve(uuid.toString());
|
||||
return newDir;
|
||||
return FileUtils.getTempDirectory().toPath().resolve(uuid.toString());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -135,7 +135,6 @@ public class StandardStorage extends DataStorage {
|
|||
|
||||
@Override
|
||||
public Path getInternalStreamPath(@NonNull UUID uuid) {
|
||||
var newDir = getStreamsDir().resolve(uuid.toString());
|
||||
return newDir;
|
||||
return getStreamsDir().resolve(uuid.toString());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,8 +28,7 @@ public class ExtensionTest {
|
|||
if (url == null) {
|
||||
throw new IllegalArgumentException(String.format("File %s does not exist", name));
|
||||
}
|
||||
var file = Path.of(url.toURI());
|
||||
return file;
|
||||
return Path.of(url.toURI());
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
|
|
|
@ -13,7 +13,7 @@ import org.kohsuke.github.RateLimitHandler;
|
|||
import org.kohsuke.github.authorization.AuthorizationProvider;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.net.URI;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
@ -53,7 +53,7 @@ public class AppDownloads {
|
|||
return Optional.empty();
|
||||
}
|
||||
|
||||
var url = new URL(asset.get().getBrowserDownloadUrl());
|
||||
var url = URI.create(asset.get().getBrowserDownloadUrl()).toURL();
|
||||
var bytes = HttpHelper.executeGet(url, aFloat -> {});
|
||||
var downloadFile =
|
||||
FileUtils.getTempDirectory().toPath().resolve(asset.get().getName());
|
||||
|
@ -88,7 +88,7 @@ public class AppDownloads {
|
|||
return Optional.empty();
|
||||
}
|
||||
|
||||
var url = new URL(asset.get().getBrowserDownloadUrl());
|
||||
var url = URI.create(asset.get().getBrowserDownloadUrl()).toURL();
|
||||
var bytes = HttpHelper.executeGet(url, aFloat -> {});
|
||||
return Optional.of(new String(bytes, StandardCharsets.UTF_8));
|
||||
} catch (Throwable t) {
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.nio.file.Path;
|
|||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
|
||||
@SuppressWarnings("InfiniteLoopStatement")
|
||||
@Getter
|
||||
public abstract class UpdateHandler {
|
||||
|
||||
|
|
|
@ -26,8 +26,7 @@ public class XPipeInstanceHelper {
|
|||
}
|
||||
|
||||
try {
|
||||
var read = UUID.fromString(Files.readString(file));
|
||||
return read;
|
||||
return UUID.fromString(Files.readString(file));
|
||||
} catch (Exception e) {
|
||||
ErrorEvent.fromThrowable(e).handle();
|
||||
return UUID.randomUUID();
|
||||
|
@ -56,7 +55,7 @@ public class XPipeInstanceHelper {
|
|||
// } catch (Exception e) {
|
||||
// return Optional.empty();
|
||||
// }
|
||||
return null;
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
public static XPipeInstance refresh() {
|
||||
|
|
|
@ -17,8 +17,7 @@ public class ApplicationHelper {
|
|||
|
||||
var fileString = file.contains(" ") ? "\"" + file + "\"" : file;
|
||||
// Check if the variable is already quoted
|
||||
var replaced = format.replace("\"$" + variable + "\"", fileString).replace("$" + variable, fileString);
|
||||
return replaced;
|
||||
return format.replace("\"$" + variable + "\"", fileString).replace("$" + variable, fileString);
|
||||
}
|
||||
|
||||
public static void executeLocalApplication(Function<ShellControl, String> s, boolean detach) throws Exception {
|
||||
|
|
|
@ -30,7 +30,6 @@ public class DefaultSecretValue extends AesSecretValue {
|
|||
var salt = new byte[16];
|
||||
new Random(keysize).nextBytes(salt);
|
||||
KeySpec spec = new PBEKeySpec(new char[] {'X', 'P', 'E' << 1}, salt, 2048, keysize);
|
||||
SecretKey secret = new SecretKeySpec(factory.generateSecret(spec).getEncoded(), "AES");
|
||||
return secret;
|
||||
return new SecretKeySpec(factory.generateSecret(spec).getEncoded(), "AES");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package io.xpipe.app.util;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.file.Files;
|
||||
|
@ -12,7 +13,7 @@ import java.util.function.Consumer;
|
|||
public class HttpHelper {
|
||||
|
||||
public static Path downloadFile(String urlS) throws Exception {
|
||||
var url = new URL(urlS);
|
||||
var url = URI.create(urlS).toURL();
|
||||
var bytes = HttpHelper.executeGet(url, aFloat -> {});
|
||||
var downloadFile = Files.createTempFile(null, null);
|
||||
Files.write(downloadFile, bytes);
|
||||
|
|
|
@ -39,7 +39,6 @@ public class LockedSecretValue extends AesSecretValue {
|
|||
var salt = new byte[16];
|
||||
new Random(keysize).nextBytes(salt);
|
||||
KeySpec spec = new PBEKeySpec(chars, salt, 8192, keysize);
|
||||
SecretKey secret = new SecretKeySpec(factory.generateSecret(spec).getEncoded(), "AES");
|
||||
return secret;
|
||||
return new SecretKeySpec(factory.generateSecret(spec).getEncoded(), "AES");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import java.util.Optional;
|
|||
public class ProxyManagerProviderImpl extends ProxyManagerProvider {
|
||||
|
||||
private static boolean showAlert() {
|
||||
var okay = AppWindowHelper.showBlockingAlert(alert -> {
|
||||
return AppWindowHelper.showBlockingAlert(alert -> {
|
||||
alert.setAlertType(Alert.AlertType.CONFIRMATION);
|
||||
alert.setTitle(AppI18n.get("connectorInstallationTitle"));
|
||||
alert.setHeaderText(AppI18n.get("connectorInstallationHeader"));
|
||||
|
@ -27,7 +27,6 @@ public class ProxyManagerProviderImpl extends ProxyManagerProvider {
|
|||
})
|
||||
.filter(buttonType -> buttonType.getButtonData().isDefaultButton())
|
||||
.isPresent();
|
||||
return okay;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -42,11 +42,10 @@ public class ScanAlert {
|
|||
private static void showForOtherStore(DataStoreEntry entry) {
|
||||
show(entry, () -> {
|
||||
var providers = ScanProvider.getAll();
|
||||
var applicable = providers.stream()
|
||||
return providers.stream()
|
||||
.map(scanProvider -> scanProvider.create(entry.getStore()))
|
||||
.filter(scanOperation -> scanOperation != null)
|
||||
.toList();
|
||||
return applicable;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -76,8 +76,7 @@ public class ScriptHelper {
|
|||
content += t.getExitCommand() + nl;
|
||||
}
|
||||
|
||||
var initFile = createExecScript(t, processControl, t.initFileName(processControl), content);
|
||||
return initFile;
|
||||
return createExecScript(t, processControl, t.initFileName(processControl), content);
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
|
@ -90,8 +89,7 @@ public class ScriptHelper {
|
|||
public static String getExecScriptFile(ShellControl processControl, String fileEnding) {
|
||||
var fileName = "exec-" + getScriptId();
|
||||
var temp = processControl.getSubTemporaryDirectory();
|
||||
var file = FileNames.join(temp, fileName + "." + fileEnding);
|
||||
return file;
|
||||
return FileNames.join(temp, fileName + "." + fileEnding);
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
|
@ -154,8 +152,7 @@ public class ScriptHelper {
|
|||
pass.stream()
|
||||
.map(secretValue -> secretValue.getSecretValue())
|
||||
.toList());
|
||||
var exec = createExecScript(sub.getShellDialect(), sub, file, content);
|
||||
return exec;
|
||||
return createExecScript(sub.getShellDialect(), sub, file, content);
|
||||
}
|
||||
} else {
|
||||
var content = parent.getShellDialect()
|
||||
|
@ -165,8 +162,7 @@ public class ScriptHelper {
|
|||
pass.stream()
|
||||
.map(secretValue -> secretValue.getSecretValue())
|
||||
.toList());
|
||||
var exec = createExecScript(parent.getShellDialect(), parent, file, content);
|
||||
return exec;
|
||||
return createExecScript(parent.getShellDialect(), parent, file, content);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ public interface SecretRetrievalStrategy {
|
|||
boolean shouldCache();
|
||||
|
||||
@JsonTypeName("none")
|
||||
public static class None implements SecretRetrievalStrategy {
|
||||
class None implements SecretRetrievalStrategy {
|
||||
|
||||
@Override
|
||||
public SecretValue retrieve(String displayName, UUID id, int sub) {
|
||||
|
@ -52,7 +52,7 @@ public interface SecretRetrievalStrategy {
|
|||
}
|
||||
|
||||
@JsonTypeName("reference")
|
||||
public static class Reference implements SecretRetrievalStrategy {
|
||||
class Reference implements SecretRetrievalStrategy {
|
||||
|
||||
@JsonIgnore
|
||||
private final Supplier<SecretValue> supplier;
|
||||
|
@ -82,7 +82,7 @@ public interface SecretRetrievalStrategy {
|
|||
@Builder
|
||||
@Value
|
||||
@Jacksonized
|
||||
public static class InPlace implements SecretRetrievalStrategy {
|
||||
class InPlace implements SecretRetrievalStrategy {
|
||||
|
||||
SecretValue value;
|
||||
|
||||
|
@ -106,7 +106,7 @@ public interface SecretRetrievalStrategy {
|
|||
}
|
||||
|
||||
@JsonTypeName("prompt")
|
||||
public static class Prompt implements SecretRetrievalStrategy {
|
||||
class Prompt implements SecretRetrievalStrategy {
|
||||
|
||||
@Override
|
||||
public SecretValue retrieve(String displayName, UUID id, int sub) {
|
||||
|
@ -127,7 +127,7 @@ public interface SecretRetrievalStrategy {
|
|||
@Builder
|
||||
@Jacksonized
|
||||
@Value
|
||||
public static class PasswordManager implements SecretRetrievalStrategy {
|
||||
class PasswordManager implements SecretRetrievalStrategy {
|
||||
|
||||
String key;
|
||||
|
||||
|
@ -158,7 +158,7 @@ public interface SecretRetrievalStrategy {
|
|||
@Builder
|
||||
@Jacksonized
|
||||
@Value
|
||||
public static class CustomCommand implements SecretRetrievalStrategy {
|
||||
class CustomCommand implements SecretRetrievalStrategy {
|
||||
|
||||
String command;
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ package io.xpipe.app.util;
|
|||
|
||||
import io.xpipe.app.comp.base.ButtonComp;
|
||||
import io.xpipe.app.core.App;
|
||||
import io.xpipe.app.fxcomps.Comp;
|
||||
import io.xpipe.app.fxcomps.impl.HorizontalComp;
|
||||
import io.xpipe.app.fxcomps.impl.SecretFieldComp;
|
||||
import io.xpipe.app.fxcomps.impl.TextFieldComp;
|
||||
|
@ -32,7 +31,7 @@ public class SecretRetrievalStrategyHelper {
|
|||
private static OptionsBuilder passwordManager(Property<SecretRetrievalStrategy.PasswordManager> p) {
|
||||
var keyProperty =
|
||||
new SimpleObjectProperty<>(p.getValue() != null ? p.getValue().getKey() : null);
|
||||
var content = new HorizontalComp(List.<Comp<?>>of(
|
||||
var content = new HorizontalComp(List.of(
|
||||
new TextFieldComp(keyProperty).apply(struc -> struc.get().setPromptText("Password key")).hgrow(),
|
||||
new ButtonComp(null, new FontIcon("mdomz-settings"), () -> {
|
||||
AppPrefs.get().selectCategory(3);
|
||||
|
|
|
@ -25,9 +25,7 @@ public class BeaconServer {
|
|||
}
|
||||
|
||||
private static List<String> toProcessCommand(String toExec) {
|
||||
var command =
|
||||
OsType.getLocal().equals(OsType.WINDOWS) ? List.of("cmd", "/c", toExec) : List.of("sh", "-c", toExec);
|
||||
return command;
|
||||
return OsType.getLocal().equals(OsType.WINDOWS) ? List.of("cmd", "/c", toExec) : List.of("sh", "-c", toExec);
|
||||
}
|
||||
|
||||
public static Process tryStartCustom() throws Exception {
|
||||
|
|
|
@ -36,8 +36,7 @@ public class SecretProviderImpl extends SecretProvider {
|
|||
var salt = new byte[16];
|
||||
new Random(keysize).nextBytes(salt);
|
||||
KeySpec spec = new PBEKeySpec(new char[] {'X', 'P', 'E' << 1}, salt, 65536, keysize);
|
||||
SecretKey secret = new SecretKeySpec(factory.generateSecret(spec).getEncoded(), "AES");
|
||||
return secret;
|
||||
return new SecretKeySpec(factory.generateSecret(spec).getEncoded(), "AES");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -16,7 +16,6 @@ public interface MessageExchange {
|
|||
* Returns the request class, needed for serialization.
|
||||
*/
|
||||
@SneakyThrows
|
||||
@SuppressWarnings("unchecked")
|
||||
default Class<?> getRequestClass() {
|
||||
var c = getClass().getSuperclass();
|
||||
var name = (MessageExchange.class.isAssignableFrom(c) ? c : getClass()).getName() + "$Request";
|
||||
|
@ -27,7 +26,6 @@ public interface MessageExchange {
|
|||
* Returns the response class, needed for serialization.
|
||||
*/
|
||||
@SneakyThrows
|
||||
@SuppressWarnings("unchecked")
|
||||
default Class<?> getResponseClass() {
|
||||
var c = getClass().getSuperclass();
|
||||
var name = (MessageExchange.class.isAssignableFrom(c) ? c : getClass()).getName() + "$Response";
|
||||
|
|
|
@ -16,8 +16,7 @@ public class MessageExchanges {
|
|||
if (ALL == null) {
|
||||
ALL = ServiceLoader.load(MessageExchange.class).stream()
|
||||
.map(s -> {
|
||||
var ex = (MessageExchange) s.get();
|
||||
return ex;
|
||||
return (MessageExchange) s.get();
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
|
|
@ -61,8 +61,7 @@ public abstract class Charsetter {
|
|||
}
|
||||
|
||||
public OutputStreamWriter writer(StreamDataStore store, StreamCharset charset) throws Exception {
|
||||
var out = new OutputStreamWriter(store.openOutput(), charset.getCharset());
|
||||
return out;
|
||||
return new OutputStreamWriter(store.openOutput(), charset.getCharset());
|
||||
}
|
||||
|
||||
public BufferedReader reader(InputStream stream, StreamCharset charset) throws Exception {
|
||||
|
|
|
@ -35,6 +35,7 @@ public abstract class ArrayNode extends DataStructureNode {
|
|||
getNodes().equals(that.getNodes()) && Objects.equals(getMetaAttributes(), that.getMetaAttributes());
|
||||
|
||||
// Useful for debugging
|
||||
//noinspection PointlessBooleanExpression
|
||||
if (toReturn == false) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -61,8 +61,7 @@ public class DataStructureNodeIO {
|
|||
return null;
|
||||
}
|
||||
|
||||
var name = new String(in.readNBytes(nameLength), StandardCharsets.UTF_8);
|
||||
return name;
|
||||
return new String(in.readNBytes(nameLength), StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
public static Map<Integer, String> parseAttributes(InputStream in) throws IOException {
|
||||
|
|
|
@ -85,6 +85,7 @@ public abstract class TupleNode extends DataStructureNode {
|
|||
&& Objects.equals(getMetaAttributes(), that.getMetaAttributes());
|
||||
|
||||
// Useful for debugging
|
||||
//noinspection PointlessBooleanExpression
|
||||
if (toReturn == false) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -140,6 +140,7 @@ public abstract class ValueNode extends DataStructureNode {
|
|||
&& Objects.equals(getMetaAttributes(), that.getMetaAttributes());
|
||||
|
||||
// Useful for debugging
|
||||
//noinspection PointlessBooleanExpression
|
||||
if (toReturn == false) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -374,8 +374,7 @@ public abstract class Dialog {
|
|||
@Override
|
||||
protected DialogElement next(String answer) throws Exception {
|
||||
if (choiceMade != null) {
|
||||
var r = choiceMade.receive(answer);
|
||||
return r;
|
||||
return choiceMade.receive(answer);
|
||||
}
|
||||
|
||||
if (choice.apply(answer)) {
|
||||
|
|
|
@ -18,7 +18,7 @@ public class DialogReference {
|
|||
DialogElement start;
|
||||
|
||||
@JsonCreator
|
||||
public DialogReference(UUID dialogId, DialogElement start) {
|
||||
public DialogReference(@NonNull UUID dialogId, DialogElement start) {
|
||||
this.dialogId = dialogId;
|
||||
this.start = start;
|
||||
}
|
||||
|
|
|
@ -27,11 +27,6 @@ public class InternalStreamStore extends JacksonizedValue implements StreamDataS
|
|||
this.uuid = UUID.randomUUID();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataFlow getFlow() {
|
||||
return DataFlow.INPUT_OUTPUT;
|
||||
}
|
||||
|
||||
private Path getFile() {
|
||||
return DataStateProvider.get().getInternalStreamStore(uuid);
|
||||
}
|
||||
|
|
|
@ -38,15 +38,6 @@ public abstract class PeekTableStreamReadConnection extends StreamReadConnection
|
|||
return n.determineDataType().asTuple();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws Exception {
|
||||
if (inputStream == null) {
|
||||
throw new IllegalStateException("Not initialized");
|
||||
}
|
||||
|
||||
inputStream.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TupleType getDataType() {
|
||||
return type;
|
||||
|
|
|
@ -16,7 +16,7 @@ public class CommandBuilder {
|
|||
|
||||
private final List<Element> elements = new ArrayList<>();
|
||||
|
||||
public static interface Element {
|
||||
public interface Element {
|
||||
|
||||
String evaluate(ShellControl sc) throws Exception;
|
||||
}
|
||||
|
|
|
@ -116,13 +116,7 @@ public interface ShellControl extends ProcessControl {
|
|||
FailableSupplier<SecretValue> getElevationPassword();
|
||||
|
||||
default ShellControl subShell(@NonNull ShellDialect type) {
|
||||
return subShell(p -> type.getOpenCommand(), new TerminalOpenFunction() {
|
||||
|
||||
@Override
|
||||
public String prepare(ShellControl sc, String command) {
|
||||
return command;
|
||||
}
|
||||
})
|
||||
return subShell(p -> type.getOpenCommand(), (sc, command) -> command)
|
||||
.elevationPassword(getElevationPassword());
|
||||
}
|
||||
|
||||
|
@ -132,24 +126,12 @@ public interface ShellControl extends ProcessControl {
|
|||
}
|
||||
|
||||
default ShellControl identicalSubShell() {
|
||||
return subShell(p -> p.getShellDialect().getOpenCommand(), new TerminalOpenFunction() {
|
||||
|
||||
@Override
|
||||
public String prepare(ShellControl sc, String command) {
|
||||
return command;
|
||||
}
|
||||
})
|
||||
return subShell(p -> p.getShellDialect().getOpenCommand(), (sc, command) -> command)
|
||||
.elevationPassword(getElevationPassword());
|
||||
}
|
||||
|
||||
default ShellControl subShell(@NonNull String command) {
|
||||
return subShell(processControl -> command, new TerminalOpenFunction() {
|
||||
|
||||
@Override
|
||||
public String prepare(ShellControl sc, String command) {
|
||||
return command;
|
||||
}
|
||||
});
|
||||
return subShell(processControl -> command, (sc, command1) -> command1);
|
||||
}
|
||||
|
||||
default ShellControl enforcedDialect(ShellDialect type) throws Exception {
|
||||
|
@ -179,7 +161,7 @@ public interface ShellControl extends ProcessControl {
|
|||
void cd(String directory) throws Exception;
|
||||
|
||||
@Override
|
||||
ShellControl start() throws Exception;
|
||||
ShellControl start();
|
||||
|
||||
CommandControl command(FailableFunction<ShellControl, String, Exception> command);
|
||||
|
||||
|
|
|
@ -15,8 +15,7 @@ public interface SecretValue {
|
|||
}
|
||||
|
||||
static byte[] fromBase64e(String s) {
|
||||
var bytes = Base64.getDecoder().decode(s.replace("-", "/"));
|
||||
return bytes;
|
||||
return Base64.getDecoder().decode(s.replace("-", "/"));
|
||||
}
|
||||
|
||||
default void withSecretValue(Consumer<char[]> con) {
|
||||
|
|
|
@ -164,8 +164,7 @@ public class XPipeInstallation {
|
|||
|
||||
public static String getInstallationExecutable(ShellControl p, String installation) {
|
||||
var executable = getDaemonExecutablePath(p.getOsType());
|
||||
var file = FileNames.join(installation, executable);
|
||||
return file;
|
||||
return FileNames.join(installation, executable);
|
||||
}
|
||||
|
||||
public static String getDataBasePath(ShellControl p) throws Exception {
|
||||
|
|
|
@ -109,17 +109,15 @@ public class HttpStore extends JacksonizedValue implements StreamDataStore, Stat
|
|||
}
|
||||
|
||||
private HttpClient createClient() {
|
||||
var client = HttpClient.newBuilder()
|
||||
return HttpClient.newBuilder()
|
||||
.followRedirects(HttpClient.Redirect.ALWAYS)
|
||||
.build();
|
||||
return client;
|
||||
}
|
||||
|
||||
private HttpRequest createRequest() {
|
||||
var b = HttpRequest.newBuilder().uri(getURL());
|
||||
headers.forEach(b::setHeader);
|
||||
var req = b.GET().build();
|
||||
return req;
|
||||
return b.GET().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -15,21 +15,11 @@ public class InternalStreamProvider implements DataStoreProvider {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiDialog guiDialog(Property<DataStore> store) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String queryInformationString(DataStore store, int length) {
|
||||
return getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toSummaryString(DataStore store, int length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataStore defaultStore() {
|
||||
return new InternalStreamStore();
|
||||
|
|
|
@ -82,8 +82,7 @@ public interface SimpleFileDataSourceProvider<T extends DataSource<?>> extends D
|
|||
|
||||
@Override
|
||||
public Map<String, List<String>> getFileExtensions() {
|
||||
var map = new LinkedHashMap<>(getSupportedExtensions());
|
||||
return map;
|
||||
return new LinkedHashMap<>(getSupportedExtensions());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -31,11 +31,6 @@ public class DeleteStoreChildrenAction implements ActionProvider {
|
|||
public DataStoreCallSite<?> getDataStoreCallSite() {
|
||||
return new DataStoreCallSite<>() {
|
||||
|
||||
@Override
|
||||
public boolean isMajor(DataStore o) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionProvider.Action createAction(DataStore store) {
|
||||
return new Action(DataStorage.get().getStoreEntry(store));
|
||||
|
|
|
@ -51,10 +51,6 @@ public class LaunchShortcutAction implements ActionProvider {
|
|||
return "mdi2c-code-greater-than";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMajor(LaunchableStore o) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,11 +22,6 @@ public class BackAction implements LeafAction {
|
|||
model.backSync();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Category getCategory() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getIcon(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
return new FontIcon("fth-arrow-left");
|
||||
|
|
|
@ -50,11 +50,6 @@ public class CopyPathAction implements BrowserAction, BranchAction {
|
|||
return "Absolute Path";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean automaticallyResolveLinks() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public KeyCombination getShortcut() {
|
||||
return new KeyCodeCombination(KeyCode.C, KeyCombination.ALT_DOWN, KeyCombination.SHORTCUT_DOWN);
|
||||
|
|
|
@ -22,11 +22,6 @@ public class ForwardAction implements LeafAction {
|
|||
model.forthSync();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Category getCategory() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getIcon(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
return new FontIcon("fth-arrow-right");
|
||||
|
|
|
@ -23,11 +23,6 @@ public class RefreshDirectoryAction implements LeafAction {
|
|||
model.refreshSync();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BrowserAction.Category getCategory() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
return !model.getInOverview().get();
|
||||
|
|
|
@ -57,8 +57,7 @@ public class CsvReadConnection extends StreamReadConnection implements TableRead
|
|||
return ValueNode.nullValue();
|
||||
}
|
||||
var quotesRemoved = CsvQuoteChar.strip(s, source.getQuote());
|
||||
var value = ValueNode.of(quotesRemoved);
|
||||
return value;
|
||||
return ValueNode.of(quotesRemoved);
|
||||
})
|
||||
.toList();
|
||||
|
||||
|
|
|
@ -58,13 +58,12 @@ public class CsvWriteConnection extends StreamWriteConnection implements SimpleT
|
|||
var array = CsvSplitter.splitRaw(lines, source.getQuote(), source.getDelimiter());
|
||||
var headerState = CsvHeaderState.determine(array, source.getQuote());
|
||||
var quoteStates = CsvQuoteState.determine(array, headerState, source.getQuote());
|
||||
var rawHeader = headerState == CsvHeaderState.INCLUDED
|
||||
|
||||
this.rawColumnNames = headerState == CsvHeaderState.INCLUDED
|
||||
? array.at(0).getNodes().stream()
|
||||
.map(DataStructureNode::asString)
|
||||
.toList()
|
||||
: null;
|
||||
|
||||
this.rawColumnNames = rawHeader;
|
||||
this.quoteStates = quoteStates;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,10 +28,9 @@ public abstract class PdxFileProvider<T extends DataSource<?>>
|
|||
@Override
|
||||
public DataSource<?> convert(T in, DataSourceType t) throws Exception {
|
||||
Source d = in.asNeeded();
|
||||
CollectionDataSource<?> ds = DataSourceProviders.byId("zip")
|
||||
return DataSourceProviders.byId("zip")
|
||||
.createDefaultSource(in.getStore())
|
||||
.asNeeded();
|
||||
return ds;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -85,8 +85,7 @@ public class PdxTextFileProvider
|
|||
public DataStructureNode read() throws Exception {
|
||||
try (var in = store.openInput()) {
|
||||
var bytes = in.readAllBytes();
|
||||
var node = TextFormatParser.text().parse(store.toString(), bytes, 0, false);
|
||||
return node;
|
||||
return TextFormatParser.text().parse(store.toString(), bytes, 0, false);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -114,10 +114,9 @@ public final class TextFormatParser {
|
|||
tokenizer.getScalarCount());
|
||||
|
||||
// now = Instant.now();
|
||||
TupleNode r = parseArray(name, strict);
|
||||
// System.out.println("Node creator took " + ChronoUnit.MILLIS.between(now, Instant.now()) + "ms");
|
||||
|
||||
return r;
|
||||
return parseArray(name, strict);
|
||||
} catch (ParseException ex) {
|
||||
throw ex;
|
||||
} catch (Throwable t) {
|
||||
|
|
Loading…
Reference in a new issue