mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-08-23 01:36:33 +00:00
Rework [stage]
This commit is contained in:
@@ -6,6 +6,7 @@ import io.xpipe.app.core.window.AppMainWindow;
|
||||
import io.xpipe.app.ext.CliProvider;
|
||||
import io.xpipe.app.ext.ExtensionException;
|
||||
import io.xpipe.app.ext.ModuleLayerLoader;
|
||||
import io.xpipe.app.ext.ProcModuleProvider;
|
||||
import io.xpipe.app.issue.*;
|
||||
import io.xpipe.app.platform.PlatformInit;
|
||||
import io.xpipe.app.platform.PlatformState;
|
||||
@@ -204,6 +205,7 @@ public abstract class AppOperationMode {
|
||||
DataStorage.get().generateCaches();
|
||||
});
|
||||
AppMainWindow.postInit();
|
||||
ProcModuleProvider.get().postInitWebtopSetup();
|
||||
} catch (Throwable ex) {
|
||||
ErrorEventFactory.fromThrowable(ex).term().handle();
|
||||
}
|
||||
|
||||
@@ -51,6 +51,8 @@ public abstract class ProcModuleProvider {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public abstract void postInitWebtopSetup();
|
||||
|
||||
public abstract String generatePublicSshKey(SecretValue privateKey, SecretRetrievalStrategy passphrase);
|
||||
|
||||
public abstract Optional<String> generatePublicSshKey(FilePath file) throws Exception;
|
||||
|
||||
@@ -458,6 +458,10 @@ public class StoreEntryWrapper {
|
||||
DataStorage.get().setOrderIndex(entry, index);
|
||||
}
|
||||
|
||||
public void expand() {
|
||||
this.expanded.set(true);
|
||||
}
|
||||
|
||||
public void toggleExpanded() {
|
||||
this.expanded.set(!expanded.getValue());
|
||||
}
|
||||
|
||||
@@ -61,6 +61,9 @@ public class StoreSectionComp extends StoreSectionBaseComp {
|
||||
indicators.apply(struc -> {
|
||||
var pane = (Pane) ((VBox) struc.getChildren().get(1)).getChildren().getFirst();
|
||||
addVisibilityListeners(struc, pane, () -> buildContent(entryButton).build());
|
||||
struc.setOnMouseClicked(e -> {
|
||||
e.consume();
|
||||
});
|
||||
});
|
||||
|
||||
return indicators.build();
|
||||
|
||||
@@ -116,7 +116,14 @@ public class StoreSectionState {
|
||||
}
|
||||
|
||||
private void addListeners() {
|
||||
Listeners.attach(enabled, all, () -> {
|
||||
Listeners.attach(enabled, all, (change) -> {
|
||||
if (change != null) {
|
||||
while (change.next()) {
|
||||
if (change.wasAdded()) {
|
||||
added.addAll(change.getAddedSubList());
|
||||
}
|
||||
}
|
||||
}
|
||||
updateAll();
|
||||
});
|
||||
|
||||
@@ -129,15 +136,6 @@ public class StoreSectionState {
|
||||
updateShown(false);
|
||||
});
|
||||
|
||||
Listeners.listen(enabled, StoreViewState.get().getAllEntries().getList(), change -> {
|
||||
while (change.next()) {
|
||||
if (change.wasAdded()) {
|
||||
added.addAll(change.getAddedSubList());
|
||||
}
|
||||
}
|
||||
updateShown(false);
|
||||
});
|
||||
|
||||
Listeners.attach(enabled, category, () -> {
|
||||
updateShown(true);
|
||||
});
|
||||
|
||||
@@ -99,6 +99,23 @@ public class Listeners {
|
||||
});
|
||||
}
|
||||
|
||||
public static <T> void attach(ObservableValue<Boolean> enabled, ObservableList<T> value, Consumer<ListChangeListener.Change<? extends T>> consumer) {
|
||||
var listener = new ListChangeListener<T>() {
|
||||
@Override
|
||||
public void onChanged(Change<? extends T> c) {
|
||||
consumer.accept(c);
|
||||
}
|
||||
};
|
||||
enabled.subscribe(v -> {
|
||||
if (v) {
|
||||
value.addListener(listener);
|
||||
} else {
|
||||
value.removeListener(listener);
|
||||
}
|
||||
});
|
||||
consumer.accept(null);
|
||||
}
|
||||
|
||||
public static <T> void listen(ObservableValue<Boolean> enabled, ObservableList<T> value, Consumer<ListChangeListener.Change<? extends T>> consumer) {
|
||||
var listener = new ListChangeListener<T>() {
|
||||
@Override
|
||||
|
||||
@@ -4,7 +4,11 @@ import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.app.core.mode.AppOperationMode;
|
||||
import io.xpipe.app.issue.ErrorEventFactory;
|
||||
import io.xpipe.app.prefs.AppPrefs;
|
||||
import io.xpipe.app.process.*;
|
||||
import io.xpipe.app.process.CommandControl;
|
||||
import io.xpipe.app.process.LocalShell;
|
||||
import io.xpipe.app.process.ProcessControl;
|
||||
import io.xpipe.app.process.ShellControl;
|
||||
import io.xpipe.app.process.ShellScript;
|
||||
import io.xpipe.app.storage.DataStorage;
|
||||
import io.xpipe.app.storage.DataStoreEntry;
|
||||
import io.xpipe.app.util.FailableFunction;
|
||||
@@ -51,10 +55,9 @@ public class TerminalLaunch {
|
||||
|
||||
if (AppOperationMode.get() == null) {
|
||||
if (command instanceof CommandControl cc) {
|
||||
var s = cc.prepareTerminalOpen(TerminalInitScriptConfig.ofName(getFullTitle()), WorkingDirectoryFunction.fixed(directory));
|
||||
TerminalLauncher.openDirect(
|
||||
getFullTitle(),
|
||||
ignored -> new ShellScript(s),
|
||||
sc -> new ShellScript(cc.getTerminalCommand().buildFull(sc)),
|
||||
ExternalTerminalType.determineFallbackTerminalToOpen(type, false));
|
||||
}
|
||||
return;
|
||||
|
||||
@@ -182,8 +182,10 @@ public class RemoteDesktopWindow {
|
||||
}
|
||||
|
||||
public void select(RemoteDesktopDockEntry entry) {
|
||||
model.select(entry);
|
||||
selected.set(entry);
|
||||
ThreadHelper.runFailableAsync(() -> {
|
||||
model.select(entry);
|
||||
selected.set(entry);
|
||||
});
|
||||
}
|
||||
|
||||
public void close(RemoteDesktopDockEntry entry, boolean closeWindowIfNeeded) {
|
||||
|
||||
@@ -342,8 +342,8 @@
|
||||
-fx-background-radius: 0;
|
||||
}
|
||||
|
||||
.store-entry-comp .store-entry-badge, .store-entry-comp .store-entry-badge.no-action, .store-entry-comp .store-entry-badge:disabled {
|
||||
-fx-opacity: 0.85;
|
||||
.store-entry-badge {
|
||||
-fx-opacity: 0.75;
|
||||
}
|
||||
|
||||
.store-entry-comp:hover .store-entry-badge.no-action, .store-entry-comp:hover .store-entry-badge.no-action, .store-entry-comp:hover .store-entry-badge:disabled {
|
||||
|
||||
Reference in New Issue
Block a user