Fix IDE complaints

This commit is contained in:
crschnick 2024-02-19 22:31:21 +00:00
parent 3647d71b12
commit fa9374c68d
81 changed files with 134 additions and 279 deletions

View file

@ -14,7 +14,7 @@ import java.util.stream.Collectors;
public class BrowserAlerts {
public static enum FileConflictChoice {
public enum FileConflictChoice {
CANCEL,
SKIP,
SKIP_ALL,

View file

@ -109,7 +109,6 @@ final class BrowserBookmarkComp extends SimpleComp {
@Override
public void run() {
if (activeTask != this) {
return;
}
// Platform.runLater(() -> model.openExistingFileSystemIfPresent(store.asNeeded()));

View file

@ -66,7 +66,7 @@ public class BrowserBreadcrumbBar extends SimpleComp {
var elements = FileNames.splitHierarchy(val);
var modifiedElements = new ArrayList<>(elements);
if (val.startsWith("/")) {
modifiedElements.add(0, "/");
modifiedElements.addFirst("/");
}
Breadcrumbs.BreadCrumbItem<String> items =
Breadcrumbs.buildTreeModel(modifiedElements.toArray(String[]::new));

View file

@ -45,7 +45,7 @@ public class BrowserClipboard {
.addFlavorListener(e -> ThreadHelper.runFailableAsync(new FailableRunnable<>() {
@Override
@SuppressWarnings("unchecked")
public void run() throws Throwable {
public void run() {
Clipboard clipboard = (Clipboard) e.getSource();
try {
if (!clipboard.isDataFlavorAvailable(DataFlavor.javaFileListFlavor)) {

View file

@ -171,7 +171,7 @@ final class BrowserFileListComp extends SimpleComp {
.mapToInt(entry -> table.getItems().indexOf(entry))
.toArray();
table.getSelectionModel()
.selectIndices(table.getItems().indexOf(c.getList().get(0)), indices);
.selectIndices(table.getItems().indexOf(c.getList().getFirst()), indices);
});
});
}
@ -428,11 +428,8 @@ final class BrowserFileListComp extends SimpleComp {
private final StringProperty img = new SimpleStringProperty();
private final StringProperty text = new SimpleStringProperty();
private final Node imageView = new PrettySvgComp(img, 24, 24)
.createRegion();
private final StackPane textField =
new LazyTextFieldComp(text).createStructure().get();
private final HBox graphic;
private final BooleanProperty updating = new SimpleBooleanProperty();
@ -463,7 +460,8 @@ final class BrowserFileListComp extends SimpleComp {
};
text.addListener(listener);
graphic = new HBox(imageView, textField);
Node imageView = new PrettySvgComp(img, 24, 24).createRegion();
HBox graphic = new HBox(imageView, textField);
graphic.setSpacing(10);
graphic.setAlignment(Pos.CENTER_LEFT);
HBox.setHgrow(textField, Priority.ALWAYS);

View file

@ -98,7 +98,7 @@ public class BrowserFileListCompEntry {
return false;
}
if (!Objects.equals(model.getFileSystemModel().getFileSystem(), cb.getEntries().get(0).getFileSystem())) {
if (!Objects.equals(model.getFileSystemModel().getFileSystem(), cb.getEntries().getFirst().getFileSystem())) {
return true;
}

View file

@ -9,7 +9,7 @@ import java.util.UUID;
public interface BrowserSavedState {
public void add(Entry entry);
void add(Entry entry);
void save();
@ -18,7 +18,7 @@ public interface BrowserSavedState {
@Value
@Jacksonized
@Builder
public static class Entry {
class Entry {
UUID uuid;
String path;

View file

@ -103,8 +103,12 @@ public class BrowserTransferComp extends SimpleComp {
struc.get().setOnDragDropped(event -> {
// Accept drops from inside the app window
if (event.getGestureSource() != null) {
var files = BrowserClipboard.retrieveDrag(event.getDragboard())
.getEntries();
var drag = BrowserClipboard.retrieveDrag(event.getDragboard());
if (drag == null) {
return;
}
var files = drag.getEntries();
model.drop(model.getBrowserModel().getSelected().getValue(), files);
event.setDropCompleted(true);
event.consume();

View file

@ -160,7 +160,7 @@ public class FileSystemHelper {
}
})
.toList();
dropFilesInto(entry, entries, false, p -> progress.accept(p));
dropFilesInto(entry, entries, false, progress);
}
public static void delete(List<FileSystem.FileEntry> files) {

View file

@ -161,10 +161,10 @@ public class OpenFileSystemSavedState {
var o = new RecentEntry(with, Instant.now());
if (recentDirectories.size() < STORED) {
recentDirectories.add(0, o);
recentDirectories.addFirst(o);
} else {
recentDirectories.remove(recentDirectories.size() - 1);
recentDirectories.add(0, o);
recentDirectories.removeLast();
recentDirectories.addFirst(o);
}
}
}

View file

@ -47,7 +47,7 @@ public class StandaloneFileBrowser {
.apply(struc -> AppFont.normal(struc.get()));
var window = AppWindowHelper.sideWindow(AppI18n.get("openFileTitle"), stage -> comp, false, null);
model.setOnFinish(fileStores -> {
file.accept(fileStores.size() > 0 ? fileStores.get(0) : null);
file.accept(fileStores.size() > 0 ? fileStores.getFirst() : null);
window.close();
});
window.show();
@ -63,7 +63,7 @@ public class StandaloneFileBrowser {
.apply(struc -> AppFont.normal(struc.get()));
var window = AppWindowHelper.sideWindow(AppI18n.get("saveFileTitle"), stage -> comp, true, null);
model.setOnFinish(fileStores -> {
file.setValue(fileStores.size() > 0 ? fileStores.get(0) : null);
file.setValue(fileStores.size() > 0 ? fileStores.getFirst() : null);
window.close();
});
window.show();

View file

@ -39,7 +39,7 @@ public interface BrowserAction {
.orElseThrow();
}
default void init(OpenFileSystemModel model) throws Exception {}
default void init(OpenFileSystemModel model) {}
default String getProFeatureId() {
return null;

View file

@ -7,7 +7,7 @@ import java.util.List;
public class BrowserActionFormatter {
public static String filesArgument(List<BrowserEntry> entries) {
return entries.size() == 1 ? entries.get(0).getOptionallyQuotedFileName() : "(" + entries.size() + ")";
return entries.size() == 1 ? entries.getFirst().getOptionallyQuotedFileName() : "(" + entries.size() + ")";
}
public static String centerEllipsis(String input, int length) {

View file

@ -45,7 +45,7 @@ public class IntegratedTextAreaComp extends SimpleComp {
c.getChildren().addAll(textArea, pane);
return c;
}),
paths -> value.setValue(Files.readString(paths.get(0))));
paths -> value.setValue(Files.readString(paths.getFirst())));
return fileDrop.createRegion();
}

View file

@ -152,7 +152,7 @@ public class SideMenuBarComp extends Comp<CompStructure<VBox>> {
filler.setMaxHeight(3000);
vbox.getChildren().add(filler);
VBox.setVgrow(filler, Priority.ALWAYS);
filler.prefWidthProperty().bind(((Region) vbox.getChildren().get(0)).widthProperty());
filler.prefWidthProperty().bind(((Region) vbox.getChildren().getFirst()).widthProperty());
vbox.getStyleClass().add("sidebar-comp");
return new SimpleCompStructure<>(vbox);

View file

@ -36,13 +36,13 @@ public class SideSplitPaneComp extends Comp<SideSplitPaneComp.Structure> {
}
if (!setInitial.get() && initialWidth != null) {
r.getDividers().get(0).setPosition(initialWidth / newValue.doubleValue());
r.getDividers().getFirst().setPosition(initialWidth / newValue.doubleValue());
setInitial.set(true);
}
});
SplitPane.setResizableWithParent(sidebar, false);
r.getDividers().get(0).positionProperty().addListener((observable, oldValue, newValue) -> {
r.getDividers().getFirst().positionProperty().addListener((observable, oldValue, newValue) -> {
if (r.getWidth() <= 0) {
return;
}
@ -52,7 +52,7 @@ public class SideSplitPaneComp extends Comp<SideSplitPaneComp.Structure> {
}
});
r.getStyleClass().add("side-split-pane-comp");
return new Structure(sidebar, c, r, r.getDividers().get(0));
return new Structure(sidebar, c, r, r.getDividers().getFirst());
}
public SideSplitPaneComp withInitialWidth(double val) {

View file

@ -217,11 +217,11 @@ public abstract class StoreEntryComp extends SimpleComp {
var settingsButton = createSettingsButton();
list.add(settingsButton);
if (list.size() > 1) {
list.get(0).styleClass(Styles.LEFT_PILL);
list.getFirst().styleClass(Styles.LEFT_PILL);
for (int i = 1; i < list.size() - 1; i++) {
list.get(i).styleClass(Styles.CENTER_PILL);
}
list.get(list.size() - 1).styleClass(Styles.RIGHT_PILL);
list.getLast().styleClass(Styles.RIGHT_PILL);
}
list.forEach(comp -> {
comp.apply(struc -> struc.get().getStyleClass().remove(Styles.FLAT));

View file

@ -116,16 +116,12 @@ public class AppExtensionManager {
leafModuleLayers.add(extension.getModule().getLayer());
}
if (leafModuleLayers.size() > 0) {
var scl = ClassLoader.getSystemClassLoader();
var cfs = leafModuleLayers.stream().map(ModuleLayer::configuration).toList();
var finder = ModuleFinder.ofSystem();
var cf = Configuration.resolve(finder, cfs, finder, List.of());
extendedLayer = ModuleLayer.defineModulesWithOneLoader(cf, leafModuleLayers, scl)
.layer();
} else {
extendedLayer = baseLayer;
}
}
private Optional<Extension> findAndParseExtension(String name, ModuleLayer parent) {

View file

@ -69,7 +69,7 @@ public class AppLayoutModel {
}
public void selectBrowser() {
selected.setValue(entries.get(0));
selected.setValue(entries.getFirst());
}
public void selectSettings() {

View file

@ -317,7 +317,7 @@ public class AppLogs {
normalizedName = name;
}
return loggers.computeIfAbsent(normalizedName, Slf4jLogger::new);
return loggers.computeIfAbsent(normalizedName, s -> new Slf4jLogger());
}
};
@ -347,12 +347,6 @@ public class AppLogs {
public static final class Slf4jLogger extends AbstractLogger {
private final String name;
public Slf4jLogger(String name) {
this.name = name;
}
@Override
protected String getFullyQualifiedCallerName() {
return "logger";

View file

@ -14,7 +14,6 @@ public class AppTrayIcon {
private final SystemTray tray;
private final TrayIcon trayIcon;
private final PopupMenu popupMenu = new PopupMenu();
public AppTrayIcon() {
ensureSystemTraySupported();
@ -28,6 +27,7 @@ public class AppTrayIcon {
};
var url = AppResources.getResourceURL(AppResources.XPIPE_MODULE, image).orElseThrow();
PopupMenu popupMenu = new PopupMenu();
this.trayIcon = new TrayIcon(loadImageFromURL(url), App.getApp().getStage().getTitle(), popupMenu);
this.trayIcon.setToolTip("XPipe");
this.trayIcon.setImageAutoSize(true);

View file

@ -262,7 +262,6 @@ public class AppWindowHelper {
if (event.getCode().equals(KeyCode.W) && event.isShortcutDown()) {
stage.close();
event.consume();
return;
}
}
});

View file

@ -18,7 +18,7 @@ import java.util.Optional;
public class AppAvCheck {
@Getter
public static enum AvType {
public enum AvType {
BITDEFENDER("Bitdefender") {
@Override

View file

@ -10,7 +10,7 @@ public class TerminalLaunchExchangeImpl extends TerminalLaunchExchange
implements MessageExchangeImpl<TerminalLaunchExchange.Request, TerminalLaunchExchange.Response> {
@Override
public Response handleRequest(BeaconHandler handler, Request msg) throws ServerException, ClientException {
public Response handleRequest(BeaconHandler handler, Request msg) throws ClientException {
var r = TerminalLauncherManager.performLaunch(msg.getRequest());
return Response.builder().targetFile(r).build();
}

View file

@ -90,9 +90,7 @@ public class StoreAddExchangeImpl extends StoreAddExchange
try {
} catch (Exception ignored) {
}
if (d != null) {
d = d.indent(2);
}
return "Successfully created data store " + name.get() + ":\n" + d;
});

View file

@ -89,7 +89,7 @@ public interface ActionProvider {
default Action createAction(URI uri) throws Exception {
var args = new ArrayList<>(Arrays.asList(uri.getPath().substring(1).split("/")));
args.add(0, uri.getHost());
args.addFirst(uri.getHost());
return createAction(args);
}

View file

@ -119,14 +119,14 @@ public interface DataStoreProvider {
return null;
}
default boolean init() throws Exception {
default boolean init() {
return true;
}
default void postInit(){
}
default void storageInit() throws Exception {}
default void storageInit() {}
default boolean isShareableFromLocalMachine() {
return false;
@ -186,7 +186,7 @@ public interface DataStoreProvider {
List<String> getPossibleNames();
default String getId() {
return getPossibleNames().get(0);
return getPossibleNames().getFirst();
}
List<Class<?>> getStoreClasses();

View file

@ -62,7 +62,7 @@ public class DataStoreProviders {
String.join("_", split),
String.join("-", split),
split.stream()
.map(s -> s.equals(split.get(0)) ? s : s.substring(0, 1).toUpperCase() + s.substring(1))
.map(s -> s.equals(split.getFirst()) ? s : s.substring(0, 1).toUpperCase() + s.substring(1))
.collect(Collectors.joining()));
}

View file

@ -6,12 +6,10 @@ import io.xpipe.app.issue.TrackEvent;
import io.xpipe.core.process.ProcessControlProvider;
import io.xpipe.core.util.JacksonMapper;
import io.xpipe.core.util.ModuleLayerLoader;
import io.xpipe.core.util.ProxyFunction;
public class XPipeServiceProviders {
public static void load(ModuleLayer layer) {
// TODO
var hasDaemon = true;
ModuleLayerLoader.loadAll(layer, hasDaemon, true, t -> {
ErrorEvent.fromThrowable(t).handle();
@ -33,10 +31,6 @@ public class XPipeServiceProviders {
ErrorEvent.fromThrowable(t).handle();
});
if (hasDaemon) {
ProxyFunction.init(layer);
}
TrackEvent.info("Finished loading extension providers");
}
}

View file

@ -101,7 +101,7 @@ public record CodeSnippet(List<CodeSnippet.Line> lines) {
return this;
}
var first = s.lines.get(0);
var first = s.lines.getFirst();
var line = new ArrayList<>(currentLine);
line.addAll(first.elements);
lines.add(new Line(new ArrayList<>(line)));

View file

@ -95,9 +95,9 @@ public class PrettyImageComp extends SimpleComp {
image.set(fixed);
if (val == null) {
stack.getChildren().get(0).setVisible(false);
stack.getChildren().getFirst().setVisible(false);
} else {
stack.getChildren().get(0).setVisible(true);
stack.getChildren().getFirst().setVisible(true);
}
};

View file

@ -16,7 +16,7 @@ import java.util.Objects;
public class SecretFieldComp extends Comp<CompStructure<TextField>> {
public static SecretFieldComp ofString(Property<String> s) {
var prop = new SimpleObjectProperty<InPlaceSecretValue>(s.getValue() != null ? InPlaceSecretValue.of(s.getValue()) : null);
var prop = new SimpleObjectProperty<>(s.getValue() != null ? InPlaceSecretValue.of(s.getValue()) : null);
prop.addListener((observable, oldValue, newValue) -> {
s.setValue(newValue != null ? new String(newValue.getSecret()) : null);
});

View file

@ -56,12 +56,12 @@ public class ToggleGroupComp<T> extends Comp<CompStructure<HBox>> {
}
if (box.getChildren().size() > 0) {
box.getChildren().get(0).getStyleClass().add(Styles.LEFT_PILL);
box.getChildren().getFirst().getStyleClass().add(Styles.LEFT_PILL);
for (int i = 1; i < box.getChildren().size() - 1; i++) {
box.getChildren().get(i).getStyleClass().add(Styles.CENTER_PILL);
}
box.getChildren()
.get(box.getChildren().size() - 1)
.getLast()
.getStyleClass()
.add(Styles.RIGHT_PILL);
}

View file

@ -21,7 +21,12 @@ public class AttachmentHelper {
private static void compressDirectoryToZipfile(Path rootDir, Path sourceDir, ZipOutputStream out)
throws IOException {
for (File file : sourceDir.toFile().listFiles()) {
var files = sourceDir.toFile().listFiles();
if (files == null) {
return;
}
for (File file : files) {
if (file.isDirectory()) {
compressDirectoryToZipfile(rootDir, sourceDir.resolve(file.getName()), out);
} else {

View file

@ -106,7 +106,7 @@ public class ErrorHandlerComp extends SimpleComp {
Platform.runLater(() -> {
if (!showing.get()) {
showing.set(true);
Stage window = null;
Stage window;
try {
window = AppWindowHelper.sideWindow(AppI18n.get("errorHandler"), w -> {
return setUpComp(event, w, finishLatch);

View file

@ -402,13 +402,13 @@ public class AppPrefs {
@SuppressWarnings("unchecked")
private <T> T map(T o, String name, Class<?> clazz) {
mapping.add(new Mapping<T>(name, (Property<T>) o, (Class<T>) clazz));
mapping.add(new Mapping<>(name, (Property<T>) o, (Class<T>) clazz));
return o;
}
@SuppressWarnings("unchecked")
private <T> T mapVaultSpecific(T o, String name, Class<?> clazz) {
mapping.add(new Mapping<T>(name, (Property<T>) o, (Class<T>) clazz, true));
mapping.add(new Mapping<>(name, (Property<T>) o, (Class<T>) clazz, true));
return o;
}
@ -485,7 +485,7 @@ public class AppPrefs {
@Override
public <T> void addSetting(String id, Class<T> c, Property<T> property, Comp<?> comp) {
var m = new Mapping<T>(id, property, c);
var m = new Mapping<>(id, property, c);
customEntries.put(m,comp);
mapping.add(m);
}

View file

@ -27,7 +27,7 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
@Override
protected CommandBuilder toCommand(LaunchConfiguration configuration) {
if (configuration.getScriptDialect().equals(CMD)) {
if (configuration.getScriptDialect().equals(ShellDialects.CMD)) {
return CommandBuilder.of()
.add("/c")
.add(configuration.getScriptFile());

View file

@ -25,7 +25,6 @@ public class DataStateProviderImpl extends DataStateProvider {
}
@Override
@SuppressWarnings("unchecked")
public <T extends DataStoreState> T getState(DataStore store, Supplier<T> def) {
if (DataStorage.get() == null) {
return def.get();

View file

@ -417,7 +417,7 @@ public abstract class DataStorage {
.toList();
toDelete.forEach(entry -> entry.finalizeEntry());
this.storeEntriesSet.removeAll(toDelete);
toDelete.forEach(this.storeEntriesSet::remove);
this.listeners.forEach(l -> l.onStoreRemove(toDelete.toArray(DataStoreEntry[]::new)));
refreshValidities(false);
saveAsync();
@ -571,7 +571,7 @@ public abstract class DataStorage {
public boolean isRootEntry(DataStoreEntry entry) {
var noParent = DataStorage.get().getDefaultDisplayParent(entry).isEmpty();
var diffParentCategory = DataStorage.get()
boolean diffParentCategory = DataStorage.get()
.getDefaultDisplayParent(entry)
.map(p -> !p.getCategoryUuid().equals(entry.getCategoryUuid()))
.orElse(false);
@ -695,7 +695,7 @@ public abstract class DataStorage {
break;
}
es.add(0, current);
es.addFirst(current);
}
return es;
@ -709,7 +709,7 @@ public abstract class DataStorage {
}
public Optional<DataStoreEntry> getStoreEntryIfPresent(@NonNull DataStoreId id) {
var current = getStoreEntryIfPresent(id.getNames().get(0));
var current = getStoreEntryIfPresent(id.getNames().getFirst());
if (current.isPresent()) {
for (int i = 1; i < id.getNames().size(); i++) {
var children = getStoreChildren(current.get());

View file

@ -40,10 +40,6 @@ public class StandardStorage extends DataStorage {
return vaultKey;
}
@Override
protected void onReset() {
}
private void deleteLeftovers() {
var storesDir = getStoresDir();
var categoriesDir = getCategoriesDir();
@ -190,7 +186,7 @@ public class StandardStorage extends DataStorage {
c.ifPresent(storeCategories::add);
} catch (IOException ex) {
// IO exceptions are not expected
exception.set(new IOException("Unable to load data from " + path.toString() + ". Is it corrupted?", ex));
exception.set(new IOException("Unable to load data from " + path + ". Is it corrupted?", ex));
directoriesToKeep.add(path);
} catch (Exception ex) {
// Data corruption and schema changes are expected
@ -229,7 +225,7 @@ public class StandardStorage extends DataStorage {
storeEntries.put(entry.get(), entry.get());
} catch (IOException ex) {
// IO exceptions are not expected
exception.set(new IOException("Unable to load data from " + path.toString() + ". Is it corrupted?", ex));
exception.set(new IOException("Unable to load data from " + path + ". Is it corrupted?", ex));
directoriesToKeep.add(path);
} catch (Exception ex) {
// Data corruption and schema changes are expected

View file

@ -65,7 +65,7 @@ public class JfxHelper {
}
var size = 40;
var graphic = PrettyImageHelper.ofFixedSquare(image, (int) size).createRegion();
var graphic = PrettyImageHelper.ofFixedSquare(image, size).createRegion();
var hbox = new HBox(graphic, text);
hbox.setAlignment(Pos.CENTER_LEFT);

View file

@ -12,5 +12,5 @@ public interface LicensedFeature {
boolean isPreviewSupported();
public void throwIfUnsupported() throws LicenseRequiredException;
void throwIfUnsupported() throws LicenseRequiredException;
}

View file

@ -12,12 +12,12 @@ public class LocalShell {
private static ShellControl local;
private static ShellControl localPowershell;
public static void init() throws Exception {
public static void init() {
local = ProcessControlProvider.get().createLocalProcessControl(false).start();
localCache = new ShellControlCache(local);
}
public static ShellControl getLocalPowershell() throws Exception {
public static ShellControl getLocalPowershell() {
if (localPowershell == null) {
localPowershell = ProcessControlProvider.get().createLocalProcessControl(true)
.subShell(ShellDialects.POWERSHELL)

View file

@ -51,7 +51,7 @@ public class NamedCharacter {
.findFirst()
.orElse(null);
if (byChar != null) {
return byChar.getNames().get(0);
return byChar.getNames().getFirst();
}
return value.toString();

View file

@ -169,7 +169,7 @@ public class OptionsBuilder {
public OptionsBuilder nonNull() {
var e = lastNameReference;
var p = props.get(props.size() - 1);
var p = props.getLast();
return check(Validator.nonNull(ownValidator, e, p));
}
@ -180,19 +180,19 @@ public class OptionsBuilder {
public OptionsBuilder nonEmpty() {
var e = lastNameReference;
var p = props.get(props.size() - 1);
var p = props.getLast();
return check(Validator.nonEmpty(ownValidator, e, (ReadOnlyListProperty<?>) p));
}
public OptionsBuilder validate() {
var e = lastNameReference;
var p = props.get(props.size() - 1);
var p = props.getLast();
return check(Validator.nonNull(ownValidator, e, p));
}
public OptionsBuilder nonNull(Validator v) {
var e = lastNameReference;
var p = props.get(props.size() - 1);
var p = props.getLast();
return check(Validator.nonNull(v, e, p));
}

View file

@ -23,12 +23,12 @@ public class ProxyManagerProviderImpl extends ProxyManagerProvider {
}
@Override
public Optional<String> checkCompatibility(ShellControl s) throws Exception {
public Optional<String> checkCompatibility(ShellControl s) {
return Optional.empty();
}
@Override
public boolean setup(ShellControl s) throws Exception {
public boolean setup(ShellControl s) {
return true;
}
}

View file

@ -71,7 +71,7 @@ public class ScanAlert {
private final Function<DataStoreEntry, List<ScanProvider.ScanOperation>> applicable;
private final Stage window;
private final ObjectProperty<DataStoreEntryRef<ShellStore>> entry;
private final ListProperty<ScanProvider.ScanOperation> selected = new SimpleListProperty<ScanProvider.ScanOperation>(FXCollections.observableArrayList());
private final ListProperty<ScanProvider.ScanOperation> selected = new SimpleListProperty<>(FXCollections.observableArrayList());
private final BooleanProperty busy = new SimpleBooleanProperty();
private Dialog(Stage window, DataStoreEntryRef<ShellStore> entry, Function<DataStoreEntry, List<ScanProvider.ScanOperation>> applicable) {
@ -151,9 +151,7 @@ public class ScanAlert {
}
selected.setAll(a.stream().filter(scanOperation -> scanOperation.isDefaultSelected() && !scanOperation.isDisabled()).toList());
var r = new ListSelectorComp<ScanProvider.ScanOperation>(a,
scanOperation -> AppI18n.get(scanOperation.getNameKey()),
selected,scanOperation -> scanOperation.isDisabled(),
var r = new ListSelectorComp<>(a, scanOperation -> AppI18n.get(scanOperation.getNameKey()), selected, scanOperation -> scanOperation.isDisabled(),
a.size() > 3).createRegion();
stackPane.getChildren().add(r);
});

View file

@ -86,7 +86,7 @@ public class TerminalLauncherManager {
return ((ResultSuccess) e.getResult()).getTargetScript();
}
public static interface Result {}
public interface Result {}
@Value
public static class Entry {

View file

@ -16,7 +16,7 @@ import java.nio.file.Path;
public interface Validator {
public static Check absolutePath(Validator v, ObservableValue<Path> s) {
static Check absolutePath(Validator v, ObservableValue<Path> s) {
return v.createCheck().dependsOn("val", s).withMethod(c -> {
if (c.get("val") == null || !((Path) c.get("val")).isAbsolute()) {
c.error(AppI18n.get("app.notAnAbsolutePath"));
@ -24,7 +24,7 @@ public interface Validator {
});
}
public static Check directory(Validator v, ObservableValue<Path> s) {
static Check directory(Validator v, ObservableValue<Path> s) {
return v.createCheck().dependsOn("val", s).withMethod(c -> {
if (c.get("val") instanceof Path p && (!Files.exists(p) || !Files.isDirectory(p))) {
c.error(AppI18n.get("app.notADirectory"));
@ -107,8 +107,6 @@ public interface Validator {
/**
* Create a string property that depends on the validation result.
* Each error message will be displayed on a separate line prefixed with a bullet.
*
* @return
*/
StringBinding createStringBinding();
@ -117,7 +115,6 @@ public interface Validator {
*
* @param prefix The string to prefix each validation message with
* @param separator The string to separate consecutive validation messages with
* @return
*/
StringBinding createStringBinding(String prefix, String separator);
}

View file

@ -92,9 +92,9 @@ project.ext {
]
useBundledJavaFx = fullVersion && !(platformName == 'linux' && arch == 'arm64')
announce = System.getenv('SKIP_ANNOUNCEMENT') == null || !Boolean.parseBoolean(System.getenv('SKIP_ANNOUNCEMENT'))
changelogFile = file("$projectDir/changelogs/${rootProject.versionString}.md").exists() ?
file("$projectDir/changelogs/${rootProject.versionString}.md") :
file("$projectDir/changelogs/${rootProject.canonicalVersionString}.md")
changelogFile = file("$rootDir/dist/changelogs/${versionString}.md").exists() ?
file("$rootDir/dist/changelogs/${versionString}.md") :
file("$rootDir/dist/changelogs/${canonicalVersionString}.md")
}
if (org.gradle.internal.os.OperatingSystem.current() == org.gradle.internal.os.OperatingSystem.LINUX) {

View file

@ -76,8 +76,7 @@ public abstract class Charsetter {
}
public abstract Result read(
FailableSupplier<InputStream> in, FailableConsumer<InputStreamReader, Exception> con)
throws Exception;
FailableSupplier<InputStream> in, FailableConsumer<InputStreamReader, Exception> con);
public Result detect(StreamDataStore store) throws Exception {
Result result = new Result(null, null);

View file

@ -22,7 +22,7 @@ public enum NewLine {
public static NewLine platform() {
return Arrays.stream(values())
.filter(n -> n.getNewLineString().equals(System.getProperty("line.separator")))
.filter(n -> n.getNewLineString().equals(System.lineSeparator()))
.findFirst()
.orElseThrow();
}

View file

@ -169,7 +169,7 @@ public class StreamCharset {
}
public String toString() {
return getNames().get(0);
return getNames().getFirst();
}
public boolean hasByteOrderMark() {

View file

@ -1,6 +1,5 @@
package io.xpipe.core.dialog;
import io.xpipe.core.charsetter.Charsetter;
import io.xpipe.core.util.FailableConsumer;
import io.xpipe.core.util.FailableSupplier;
import io.xpipe.core.util.SecretValue;
@ -24,7 +23,7 @@ import java.util.function.Supplier;
* The evaluation function can be set with {@link #evaluateTo(Supplier)}.
* Alternatively, a dialogue can also copy the evaluation function of another dialogue with {@link #evaluateTo(Dialog)}.
* An evaluation result can also be mapped to another type with {@link #map(Function)}.
* It is also possible to listen for the completion of this dialogue with {@link #onCompletion(Charsetter.FailableConsumer)} )}.
* It is also possible to listen for the completion of this dialogue with {@link #onCompletion(FailableConsumer)}.
*/
public abstract class Dialog {
@ -76,7 +75,6 @@ public abstract class Dialog {
* @param description the shown question description
* @param toString a function that maps the objects to a string
* @param required signals whether choices required or can be left empty
* @param quiet
* @param def the element which is selected by default
* @param vals the range of possible elements
*/

View file

@ -154,7 +154,7 @@ public class CommandBuilder {
}
public CommandBuilder prepend(Element e) {
elements.add(0, e);
elements.addFirst(e);
return this;
}

View file

@ -6,7 +6,7 @@ import lombok.Getter;
public interface ScriptSnippet {
@Getter
public static enum ExecutionType {
enum ExecutionType {
@JsonProperty("dumbOnly")
DUMB_ONLY("dumbOnly"),
@JsonProperty("terminalOnly")

View file

@ -160,12 +160,12 @@ public interface ShellControl extends ProcessControl {
var o = new ShellOpenFunction() {
@Override
public CommandBuilder prepareWithoutInitCommand() throws Exception {
public CommandBuilder prepareWithoutInitCommand() {
return CommandBuilder.of().add(sc -> type.getLoginOpenCommand(sc));
}
@Override
public CommandBuilder prepareWithInitCommand(@NonNull String command) throws Exception {
public CommandBuilder prepareWithInitCommand(@NonNull String command) {
return CommandBuilder.ofString(command);
}
};
@ -178,12 +178,12 @@ public interface ShellControl extends ProcessControl {
var o = new ShellOpenFunction() {
@Override
public CommandBuilder prepareWithoutInitCommand() throws Exception {
public CommandBuilder prepareWithoutInitCommand() {
return CommandBuilder.of().add(sc -> sc.getShellDialect().getLoginOpenCommand(sc));
}
@Override
public CommandBuilder prepareWithInitCommand(@NonNull String command) throws Exception {
public CommandBuilder prepareWithInitCommand(@NonNull String command) {
return CommandBuilder.ofString(command);
}
};

View file

@ -5,7 +5,7 @@ import java.util.UUID;
public interface ShellDialectAskpass {
String prepareStderrPassthroughContent(ShellControl sc, UUID requestId, String prefix) throws Exception;
String prepareStderrPassthroughContent(ShellControl sc, UUID requestId, String prefix);
String prepareFixedContent(ShellControl sc, String fileName, List<String> s) throws Exception;

View file

@ -52,12 +52,12 @@ public interface ShellDumbMode {
}
@Override
public void prepareDumbInit(ShellControl shellControl) throws Exception {
public void prepareDumbInit(ShellControl shellControl) {
throw new UnsupportedOperationException();
}
@Override
public void prepareDumbExit(ShellControl shellControl) throws IOException {
public void prepareDumbExit(ShellControl shellControl) {
throw new UnsupportedOperationException();
}

View file

@ -7,12 +7,12 @@ public interface ShellOpenFunction {
static ShellOpenFunction of(String b) {
return new ShellOpenFunction() {
@Override
public CommandBuilder prepareWithoutInitCommand() throws Exception {
public CommandBuilder prepareWithoutInitCommand() {
return CommandBuilder.of().add(b);
}
@Override
public CommandBuilder prepareWithInitCommand(@NonNull String command) throws Exception {
public CommandBuilder prepareWithInitCommand(@NonNull String command) {
throw new UnsupportedOperationException();
}
};
@ -21,12 +21,12 @@ public interface ShellOpenFunction {
static ShellOpenFunction of(CommandBuilder b) {
return new ShellOpenFunction() {
@Override
public CommandBuilder prepareWithoutInitCommand() throws Exception {
public CommandBuilder prepareWithoutInitCommand() {
return b;
}
@Override
public CommandBuilder prepareWithInitCommand(@NonNull String command) throws Exception {
public CommandBuilder prepareWithInitCommand(@NonNull String command) {
return CommandBuilder.ofString(command);
}
};

View file

@ -59,7 +59,7 @@ public class ConnectionFileSystem implements FileSystem {
}
@Override
public FileSystem open() throws Exception {
public FileSystem open() {
shellControl.start();
return this;
}

View file

@ -55,7 +55,7 @@ public class FileNames {
return "";
}
return components.get(components.size() - 1);
return components.getLast();
}
public static List<String> splitHierarchy(String file) {

View file

@ -100,7 +100,7 @@ public interface FileSystem extends Closeable, AutoCloseable {
Optional<ShellControl> getShell();
FileSystem open() throws Exception;
FileSystem open();
InputStream openInput(String file) throws Exception;

View file

@ -15,7 +15,7 @@ public interface ShellStore extends DataStore, LaunchableStore, FileSystemStore,
}
@Override
default ProcessControl prepareLaunchCommand() throws Exception {
default ProcessControl prepareLaunchCommand() {
return control();
}

View file

@ -17,7 +17,7 @@ public interface StreamDataStore extends DataStore {
* Checks whether this store can be opened.
* This can be not the case for example if the underlying store does not exist.
*/
default boolean canOpen() throws Exception {
default boolean canOpen() {
return true;
}
@ -35,7 +35,7 @@ public interface StreamDataStore extends DataStore {
/**
* Opens an input stream that can be used to read its data.
*/
default InputStream openInput() throws Exception {
default InputStream openInput() {
throw new UnsupportedOperationException("Can't open store input");
}
@ -54,7 +54,7 @@ public interface StreamDataStore extends DataStore {
/**
* Opens an output stream that can be used to write data.
*/
default OutputStream openOutput() throws Exception {
default OutputStream openOutput() {
throw new UnsupportedOperationException("Can't open store output");
}
}

View file

@ -19,7 +19,7 @@ public abstract class ProxyManagerProvider {
return INSTANCE;
}
public abstract Optional<String> checkCompatibility(ShellControl pc) throws Exception;
public abstract Optional<String> checkCompatibility(ShellControl pc);
public abstract boolean setup(ShellControl pc) throws Exception;
public abstract boolean setup(ShellControl pc);
}

View file

@ -1,47 +0,0 @@
## New professional features
- Add ability to open files and directories in VSCode SSH remote environment in file browser
- Added support for fully offline licenses. You can obtain them via email request
in case you're running it on a system without internet connectivity or restricted proxy settings
## Changes
- Make current default shell also show up in shell environments to prevent confusion about missing bash environment
- Improve error messages when an additional password was requested by the connection
when none was provided instead of just showing permission denied
- Make SSH connection starting from a WSL environment use the native Windows key helper for FIDO2 keys
- Rework insights button for connection creation across the board
## Additions
- Add warning message if git vault URL was an HTTP URL and you are trying to use an SSH identity
- Add ability to clone existing connections to make the process of adding similar connections easier
- Add ability to debug local background shell in developer options
- Add notice when a professional feature is available in preview mode
- Add some more OS logos
- Add check to verify whether font loading with fontconfig works on Linux on startup
- Add more extensive note on first startup for potential issues when Malwarebytes, McAfee, or Bitdefender are installed
## Fixes
- Fix application not starting on Asahi Linux due to executable page size issue
- Fix file existence check for SSH key files reporting wrong results on Windows in directory links/junctions
- Fix k8s integration not working when user did not have permission to list nodes
- Fix rare error when switching to tray operation mode on Linux
- Fix connection state not being preserved when being added the first time
- Fix application failing to start up if OS reported invalid screen size bounds
- Fix VMware VM not being able to be parsed if configuration file did not specify an encoding or name
- Fix startup failing when installation was located on a ramdisk
- Fix some miscellaneous cache data being stored in the user home directory
- Fix error handling when jump host chain formed a loop
- Fix PowerShell remote sessions being blocked by execution policy
- Fix race condition when locking user data directory
- Fix some CLI commands not starting daemon correctly if it is not already running
- Fix text field when showing askpass window not being focused automatically
- Fix combobox selections not working well with keyboard-only workflows
- Fix many possible small NullPointerExceptions
## Preview pro features
For anyone interested in giving any new professional features a try without having to commit to buying a full license,
there is now a special preview mode available: Simply enter the license key `D18D1C9F-D3CB-49CA-A909-FF385DECD948` and get full access to newly released professional features for two weeks after their initial release date. In fact, you can try it out right now to get access to the new vscode file browser integration.

View file

@ -1,38 +0,0 @@
## Changes
- 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. they all now support host key and identity file fixes plus can be used with SSH tunnels.
- Make it possible to specify any identity to be used for SSH config connections
- 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
- Make the connection timeout value in the settings properly apply to ssh connections as well.
This should help with SSH connections that take a long time to connect.
- Include pre-rasterized images for various sizes to reduce the render load at runtime
- Implement various performance improvements
- Rework some UI elements to better work with keyboard navigation and screen readers
- Add unsupported shell notice when restricted bash is detected
- The daemon now properly reports any startup failure causes when started from the CLI via `xpipe open`
- Regularly clean logs directory to free up older log files
- Improve file browser handling in smaller window sizes
- Add support for WezTerm and Windows Terminal Preview
## Fixes
- Fix application windows on Linux not initializing with the correct size
- Fix connections to pfSense systems not working (This time properly)
- Fix NullPointerException when a Linux system did not provide any release name
- Fix startup errors when operating system reported invalid window sizes
- Fix various Exceptions caused by race conditions
## Error reporter
It seems like the current built-in error reporter service is broken right now, so I might not receive your written user feedback from it.
If you want to report any issues, please use another way until that is fixed.
## Future updates
The next upcoming update will probably be 1.8 with many new features and changes across the board.
The first test versions will be announced on Discord and Slack if you are interested.

View file

@ -1,34 +0,0 @@
## SSH Timeouts and connection time
Over time, there have always been a few complaints about SSH connection timeout errors and slow SSH connection startup. These especially popped up in the latest release even though no obvious code was changed.
As it turns out, increasing the value for `ConnectTimeout` in SSH does not actually only change the timeout after which an error is thrown, it is also used by some servers as a guideline for their response time. E.g. if you specify a 10s timeout, some servers will always take 10s to respond. This is of course not mentioned in any of the spec but is more of an implementation choice.
In the latest release this caused more errors as the timeout was set higher. It should also have affected many SSH connections basically since the release of XPipe. I don't know how many people have been affected by this, it heavily depends on which ssh server and configuration your server runs. It happens for example on my proxmox instances and AWS EC2 instances. If your connections now start up much faster than before, then you were probably affected by it.
This release should fix all of these issues simply by not specifying a connect timeout at all. Great work there.
If you are using `ConnectTimeout` in your SSH configs, just remove it as it makes everything slower without having the effect of a timeout.
I would like to exchange a few words with whoever thought: *A newly connected SSH client specified a 10s connect timeout? That means our SSH server can sit around idle for 9 seconds. That is a great idea.*
## Fixes
- Fix annoying log directory errors that occurred on first startup
- Fix SSH connections failing on Windows systems where the username contained non-ASCII characters due to an OpenSSH client bug by working around it
- Fix SSH connection failing when another RemoteCommand was set in a config file
- Fix child connection validity not updating when parent is changed from invalid to valid
- Fix some applications launched on Windows, e.g. some terminals and editors, starting in minimized mode
- Fix SSH config importer not handling file wildcards correctly when they also contained a file extension
- Fix actions that shut down XPipe, e.g. automatic updates and debug mode, not correctly executing if it exited too fast
- Fix error about nonexistent logs directory on first startup
- Fix possible NullPointers when checking whether current SSH session has died
## Error reporter
It seems like the current built-in error reporter service is broken right now, so I might not receive your written user feedback from it.
If you want to report any issues, please use another way until that is fixed.
## Previous changes in 1.7.15
- [1.7.15 changelog](https://github.com/xpipe-io/xpipe/releases/tag/1.7.15)

View file

@ -22,7 +22,7 @@ public class RefreshStoreAction implements ActionProvider {
}
@Override
public void execute() throws Exception {
public void execute() {
DataStorage.get().refreshChildren(store);
}
}

View file

@ -42,7 +42,7 @@ public class CopyPathAction implements BrowserAction, BranchAction {
if (entries.size() == 1) {
return " "
+ BrowserActionFormatter.centerEllipsis(
entries.get(0).getRawFileEntry().getPath(), 50);
entries.getFirst().getRawFileEntry().getPath(), 50);
}
return "Absolute Paths";
@ -67,7 +67,7 @@ public class CopyPathAction implements BrowserAction, BranchAction {
if (entries.size() == 1) {
return " "
+ BrowserActionFormatter.centerEllipsis(
entries.get(0).getRawFileEntry().getPath(), 50);
entries.getFirst().getRawFileEntry().getPath(), 50);
}
return "Absolute Link Paths";
@ -99,7 +99,7 @@ public class CopyPathAction implements BrowserAction, BranchAction {
if (entries.size() == 1) {
return "\""
+ BrowserActionFormatter.centerEllipsis(
entries.get(0).getRawFileEntry().getPath(), 50)
entries.getFirst().getRawFileEntry().getPath(), 50)
+ "\"";
}
@ -127,7 +127,7 @@ public class CopyPathAction implements BrowserAction, BranchAction {
if (entries.size() == 1) {
return " "
+ BrowserActionFormatter.centerEllipsis(
FileNames.getFileName(entries.get(0)
FileNames.getFileName(entries.getFirst()
.getRawFileEntry()
.getPath()),
50);
@ -157,7 +157,7 @@ public class CopyPathAction implements BrowserAction, BranchAction {
if (entries.size() == 1) {
return " "
+ BrowserActionFormatter.centerEllipsis(
FileNames.getFileName(entries.get(0)
FileNames.getFileName(entries.getFirst()
.getRawFileEntry()
.getPath()),
50);
@ -199,7 +199,7 @@ public class CopyPathAction implements BrowserAction, BranchAction {
if (entries.size() == 1) {
return "\""
+ BrowserActionFormatter.centerEllipsis(
FileNames.getFileName(entries.get(0)
FileNames.getFileName(entries.getFirst()
.getRawFileEntry()
.getPath()),
50)

View file

@ -19,7 +19,7 @@ public class FollowLinkAction implements LeafAction {
@Override
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) {
var target = FileNames.getParent(entries.get(0).getRawFileEntry().resolved().getPath());
var target = FileNames.getParent(entries.getFirst().getRawFileEntry().resolved().getPath());
model.cdAsync(target);
}

View file

@ -37,7 +37,7 @@ public class NewItemAction implements BrowserAction, BranchAction {
@Override
public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
return entries.size() == 1
&& entries.get(0)
&& entries.getFirst()
.getRawFileEntry()
.getPath()
.equals(model.getCurrentPath().get());

View file

@ -16,7 +16,7 @@ public class OpenDirectoryAction implements LeafAction {
@Override
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) {
model.cdAsync(entries.get(0).getRawFileEntry().getPath());
model.cdAsync(entries.getFirst().getRawFileEntry().getPath());
}
@Override

View file

@ -16,7 +16,7 @@ public class OpenDirectoryInNewTabAction implements LeafAction {
model.getBrowserModel()
.openFileSystemAsync(
model.getEntry(),
m -> entries.get(0).getRawFileEntry().getPath(),
m -> entries.getFirst().getRawFileEntry().getPath(),
null);
}

View file

@ -17,7 +17,7 @@ import java.util.List;
public class OpenFileWithAction implements LeafAction {
@Override
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) throws Exception {
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) {
var e = entries.getFirst();
FileOpener.openWithAnyApplication(e.getRawFileEntry());
}

View file

@ -20,7 +20,7 @@ public class OpenTerminalAction implements LeafAction {
}
@Override
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) throws Exception {
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) {
if (entries.size() == 0) {
model.openTerminalAsync(model.getCurrentDirectory() != null ? model.getCurrentDirectory().getPath() : null);
return;

View file

@ -22,8 +22,8 @@ public class PasteAction implements LeafAction {
return;
}
var target = entries.size() == 1 && entries.get(0).getRawFileEntry().getKind() == FileKind.DIRECTORY
? entries.get(0).getRawFileEntry()
var target = entries.size() == 1 && entries.getFirst().getRawFileEntry().getKind() == FileKind.DIRECTORY
? entries.getFirst().getRawFileEntry()
: model.getCurrentDirectory();
var files = clipboard.getEntries();
if (files.size() == 0) {

View file

@ -16,7 +16,7 @@ public class RenameAction implements LeafAction {
@Override
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) {
model.getFileList().getEditing().setValue(entries.get(0));
model.getFileList().getEditing().setValue(entries.getFirst());
}
@Override
@ -36,7 +36,7 @@ public class RenameAction implements LeafAction {
@Override
public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
return entries.size() == 1 && entries.get(0).getRawFileEntry().getKind() != FileKind.LINK;
return entries.size() == 1 && entries.getFirst().getRawFileEntry().getKind() != FileKind.LINK;
}
@Override

View file

@ -57,7 +57,7 @@ public abstract class ScriptStore extends JacksonizedValue implements DataStore,
}
}
private static void passInitScripts(ShellControl pc, List<SimpleScriptStore> scriptStores) throws Exception {
private static void passInitScripts(ShellControl pc, List<SimpleScriptStore> scriptStores) {
scriptStores.forEach(simpleScriptStore -> {
if (pc.getInitCommands().contains(simpleScriptStore)) {
return;

View file

@ -241,7 +241,7 @@ public class SimpleScriptStoreProvider implements DataStoreProvider {
}
@Override
public void storageInit() throws Exception {
public void storageInit() {
DataStorage.get()
.addStoreEntryIfNotPresent(DataStoreEntry.createNew(
UUID.fromString("a9945ad2-db61-4304-97d7-5dc4330691a7"),