mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-06-22 06:19:02 -04:00
Polish various features
This commit is contained in:
@@ -25,19 +25,15 @@ public class StoreEntrySection implements StorageFilter.Filterable {
|
||||
}
|
||||
|
||||
public static ObservableList<StoreEntrySection> createTopLevels() {
|
||||
var topLevel = BindingsHelper.mappedContentBinding(
|
||||
StoreViewState.get()
|
||||
.getAllEntries()
|
||||
.filtered(storeEntryWrapper ->
|
||||
!storeEntryWrapper.getEntry().getState().isUsable()
|
||||
|| storeEntryWrapper
|
||||
.getEntry()
|
||||
.getProvider()
|
||||
.getParent(storeEntryWrapper
|
||||
.getEntry()
|
||||
.getStore())
|
||||
== null),
|
||||
storeEntryWrapper -> create(storeEntryWrapper));
|
||||
var filtered = BindingsHelper.filteredContentBinding(
|
||||
StoreViewState.get().getAllEntries(),
|
||||
storeEntryWrapper -> !storeEntryWrapper.getEntry().getState().isUsable()
|
||||
|| storeEntryWrapper
|
||||
.getEntry()
|
||||
.getProvider()
|
||||
.getParent(storeEntryWrapper.getEntry().getStore())
|
||||
== null);
|
||||
var topLevel = BindingsHelper.mappedContentBinding(filtered, storeEntryWrapper -> create(storeEntryWrapper));
|
||||
var ordered = BindingsHelper.orderedContentBinding(
|
||||
topLevel,
|
||||
Comparator.<StoreEntrySection, Instant>comparing(storeEntrySection ->
|
||||
@@ -51,16 +47,15 @@ public class StoreEntrySection implements StorageFilter.Filterable {
|
||||
return new StoreEntrySection(e, FXCollections.observableArrayList());
|
||||
}
|
||||
|
||||
var children = BindingsHelper.mappedContentBinding(
|
||||
StoreViewState.get()
|
||||
.getAllEntries()
|
||||
.filtered(other -> other.getEntry().getState().isUsable()
|
||||
&& e.getEntry()
|
||||
.getStore()
|
||||
.equals(other.getEntry()
|
||||
.getProvider()
|
||||
.getParent(other.getEntry().getStore()))),
|
||||
entry1 -> create(entry1));
|
||||
var filtered = BindingsHelper.filteredContentBinding(
|
||||
StoreViewState.get().getAllEntries(),
|
||||
other -> other.getEntry().getState().isUsable()
|
||||
&& e.getEntry()
|
||||
.getStore()
|
||||
.equals(other.getEntry()
|
||||
.getProvider()
|
||||
.getParent(other.getEntry().getStore())));
|
||||
var children = BindingsHelper.mappedContentBinding(filtered, entry1 -> create(entry1));
|
||||
var ordered = BindingsHelper.orderedContentBinding(
|
||||
children,
|
||||
Comparator.<StoreEntrySection, Instant>comparing(storeEntrySection ->
|
||||
@@ -94,7 +89,9 @@ public class StoreEntrySection implements StorageFilter.Filterable {
|
||||
storeEntrySection.entry.lastAccessProperty().getValue()));
|
||||
var shown = BindingsHelper.filteredContentBinding(
|
||||
all,
|
||||
StoreViewState.get().getFilterString().map(s -> (storeEntrySection -> storeEntrySection.shouldShow(s))));
|
||||
StoreViewState.get()
|
||||
.getFilterString()
|
||||
.map(s -> (storeEntrySection -> storeEntrySection.shouldShow(s))));
|
||||
var content = new ListBoxViewComp<>(shown, all, (StoreEntrySection e) -> {
|
||||
return e.comp(false).apply(GrowAugment.create(true, false));
|
||||
})
|
||||
|
||||
@@ -80,12 +80,12 @@ public class App extends Application {
|
||||
appWindow.show();
|
||||
|
||||
// For demo purposes
|
||||
if (true) {
|
||||
stage.setX(310);
|
||||
stage.setY(178);
|
||||
stage.setWidth(1300);
|
||||
stage.setHeight(730);
|
||||
}
|
||||
// if (true) {
|
||||
// stage.setX(310);
|
||||
// stage.setY(178);
|
||||
// stage.setWidth(1300);
|
||||
// stage.setHeight(730);
|
||||
// }
|
||||
}
|
||||
|
||||
public void focus() {
|
||||
|
||||
@@ -90,6 +90,7 @@ public class AppGreetings {
|
||||
label.setGraphic(cb);
|
||||
AppFont.medium(label);
|
||||
label.setPadding(new Insets(40, 0, 10, 0));
|
||||
label.setOnMouseClicked(event -> accepted.set(!accepted.get()));
|
||||
return label;
|
||||
})
|
||||
.createRegion();
|
||||
|
||||
@@ -54,28 +54,23 @@ public abstract class ExternalApplicationType implements PrefsChoiceValue {
|
||||
}
|
||||
}
|
||||
|
||||
public static class LinuxPathApplication extends ExternalApplicationType {
|
||||
public static abstract class PathApplication extends ExternalApplicationType {
|
||||
|
||||
protected final String command;
|
||||
protected final String executable;
|
||||
|
||||
public LinuxPathApplication(String id, String command) {
|
||||
public PathApplication(String id, String executable) {
|
||||
super(id);
|
||||
this.command = command;
|
||||
this.executable = executable;
|
||||
}
|
||||
|
||||
public boolean isAvailable() {
|
||||
try (ShellProcessControl pc = ShellStore.local().create().start()) {
|
||||
return pc.executeBooleanSimpleCommand(pc.getShellType().getWhichCommand(command));
|
||||
return pc.executeBooleanSimpleCommand(pc.getShellType().getWhichCommand(executable));
|
||||
} catch (Exception e) {
|
||||
ErrorEvent.fromThrowable(e).omit().handle();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelectable() {
|
||||
return OsType.getLocal().equals(OsType.LINUX);
|
||||
}
|
||||
}
|
||||
|
||||
public abstract static class WindowsFullPathType extends ExternalApplicationType {
|
||||
|
||||
@@ -109,7 +109,7 @@ public interface ExternalEditorType extends PrefsChoiceValue {
|
||||
public void launch(Path file) throws Exception;
|
||||
|
||||
|
||||
public static class LinuxPathType extends ExternalApplicationType.LinuxPathApplication implements ExternalEditorType {
|
||||
public static class LinuxPathType extends ExternalApplicationType.PathApplication implements ExternalEditorType {
|
||||
|
||||
public LinuxPathType(String id, String command) {
|
||||
super(id, command);
|
||||
@@ -117,9 +117,14 @@ public interface ExternalEditorType extends PrefsChoiceValue {
|
||||
|
||||
@Override
|
||||
public void launch(Path file) throws IOException {
|
||||
var list = ShellTypes.getPlatformDefault().executeCommandListWithShell(command + " \"" + file + "\"");
|
||||
var list = ShellTypes.getPlatformDefault().executeCommandListWithShell(executable + " \"" + file + "\"");
|
||||
new ProcessBuilder(list).start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelectable() {
|
||||
return OsType.getLocal().equals(OsType.LINUX);
|
||||
}
|
||||
}
|
||||
|
||||
public abstract static class WindowsFullPathType extends ExternalApplicationType.WindowsFullPathType implements ExternalEditorType {
|
||||
@@ -174,7 +179,7 @@ public interface ExternalEditorType extends PrefsChoiceValue {
|
||||
var env = System.getenv("VISUAL");
|
||||
if (env != null) {
|
||||
var found = LINUX_EDITORS.stream()
|
||||
.filter(externalEditorType -> externalEditorType.command.equalsIgnoreCase(env))
|
||||
.filter(externalEditorType -> externalEditorType.executable.equalsIgnoreCase(env))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (found == null) {
|
||||
|
||||
Reference in New Issue
Block a user