mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-10-07 23:51:28 +00:00
Squash merge xpipe 13 feature branches into master
This commit is contained in:
1 parent
6dabe53011
commit
5868fcfd33
482 files changed
+7425
-5709
No files matched your search
@@ -1,14 +1,14 @@
|
||||
package io.xpipe.ext.base.action;
|
||||
|
||||
import io.xpipe.app.browser.session.BrowserSessionModel;
|
||||
import io.xpipe.app.browser.BrowserFullSessionModel;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.app.core.AppLayoutModel;
|
||||
import io.xpipe.app.ext.ActionProvider;
|
||||
import io.xpipe.app.ext.ProcessControlProvider;
|
||||
import io.xpipe.app.ext.ShellStore;
|
||||
import io.xpipe.app.storage.DataStoreEntry;
|
||||
import io.xpipe.app.storage.DataStoreEntryRef;
|
||||
import io.xpipe.core.store.FileSystemStore;
|
||||
import io.xpipe.core.store.ShellStore;
|
||||
|
||||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
@@ -57,7 +57,7 @@ public class BrowseStoreAction implements ActionProvider {
|
||||
public void execute() throws Exception {
|
||||
DataStoreEntryRef<FileSystemStore> replacement =
|
||||
ProcessControlProvider.get().replace(entry.ref());
|
||||
BrowserSessionModel.DEFAULT.openFileSystemSync(replacement, null, new SimpleBooleanProperty());
|
||||
BrowserFullSessionModel.DEFAULT.openFileSystemSync(replacement, null, new SimpleBooleanProperty(), true);
|
||||
AppLayoutModel.get().selectBrowser();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
package io.xpipe.ext.base.action;
|
||||
|
||||
import io.xpipe.app.comp.store.StoreCreationComp;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.app.ext.ActionProvider;
|
||||
import io.xpipe.app.storage.DataStoreEntry;
|
||||
import io.xpipe.app.storage.DataStoreEntryRef;
|
||||
import io.xpipe.ext.base.script.SimpleScriptStore;
|
||||
|
||||
import javafx.beans.value.ObservableValue;
|
||||
|
||||
import lombok.Value;
|
||||
|
||||
public class EditScriptStoreAction implements ActionProvider {
|
||||
|
||||
@Override
|
||||
public LeafDataStoreCallSite<?> getLeafDataStoreCallSite() {
|
||||
return new LeafDataStoreCallSite<SimpleScriptStore>() {
|
||||
|
||||
@Override
|
||||
public boolean isSystemAction() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMajor(DataStoreEntryRef<SimpleScriptStore> o) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionProvider.Action createAction(DataStoreEntryRef<SimpleScriptStore> store) {
|
||||
return new Action(store.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<SimpleScriptStore> getApplicableClass() {
|
||||
return SimpleScriptStore.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(DataStoreEntryRef<SimpleScriptStore> store) {
|
||||
return AppI18n.observable("base.edit");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIcon(DataStoreEntryRef<SimpleScriptStore> store) {
|
||||
return "mdal-edit";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresValidStore() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Value
|
||||
static class Action implements ActionProvider.Action {
|
||||
|
||||
DataStoreEntry store;
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
StoreCreationComp.showEdit(store);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -72,7 +72,7 @@ public class RefreshChildrenStoreAction implements ActionProvider {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
DataStorage.get().refreshChildren(store, null);
|
||||
DataStorage.get().refreshChildren(store);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,12 +4,12 @@ import io.xpipe.app.comp.store.StoreViewState;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.app.ext.ActionProvider;
|
||||
import io.xpipe.app.ext.ProcessControlProvider;
|
||||
import io.xpipe.app.ext.ShellStore;
|
||||
import io.xpipe.app.prefs.AppPrefs;
|
||||
import io.xpipe.app.storage.DataStoreEntryRef;
|
||||
import io.xpipe.app.util.TerminalLauncher;
|
||||
import io.xpipe.app.terminal.TerminalLauncher;
|
||||
import io.xpipe.core.process.ShellStoreState;
|
||||
import io.xpipe.core.process.ShellTtyState;
|
||||
import io.xpipe.core.store.ShellStore;
|
||||
import io.xpipe.ext.base.script.ScriptHierarchy;
|
||||
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
@@ -33,15 +33,14 @@ public class RunScriptActionMenu implements ActionProvider {
|
||||
|
||||
@Override
|
||||
public void execute() throws Exception {
|
||||
try (var sc = shellStore.getStore().control().start()) {
|
||||
var script = hierarchy.getLeafBase().getStore().assembleScriptChain(sc);
|
||||
TerminalLauncher.open(
|
||||
shellStore.getEntry(),
|
||||
hierarchy.getLeafBase().get().getName() + " - "
|
||||
+ shellStore.get().getName(),
|
||||
null,
|
||||
sc.command(script));
|
||||
}
|
||||
var sc = shellStore.getStore().getOrStartSession();
|
||||
var script = hierarchy.getLeafBase().getStore().assembleScriptChain(sc);
|
||||
TerminalLauncher.open(
|
||||
shellStore.getEntry(),
|
||||
hierarchy.getLeafBase().get().getName() + " - "
|
||||
+ shellStore.get().getName(),
|
||||
null,
|
||||
sc.command(script));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,10 +85,9 @@ public class RunScriptActionMenu implements ActionProvider {
|
||||
|
||||
@Override
|
||||
public void execute() throws Exception {
|
||||
try (var sc = shellStore.getStore().control().start()) {
|
||||
var script = hierarchy.getLeafBase().getStore().assembleScriptChain(sc);
|
||||
sc.command(script).execute();
|
||||
}
|
||||
var sc = shellStore.getStore().getOrStartSession();
|
||||
var script = hierarchy.getLeafBase().getStore().assembleScriptChain(sc);
|
||||
sc.command(script).execute();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,13 +3,13 @@ package io.xpipe.ext.base.action;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.app.ext.ActionProvider;
|
||||
import io.xpipe.app.ext.LocalStore;
|
||||
import io.xpipe.app.ext.ShellStore;
|
||||
import io.xpipe.app.storage.DataStoreEntry;
|
||||
import io.xpipe.app.storage.DataStoreEntryRef;
|
||||
import io.xpipe.core.process.CommandControl;
|
||||
import io.xpipe.core.process.ElevationFunction;
|
||||
import io.xpipe.core.process.ShellControl;
|
||||
import io.xpipe.core.process.ShellDialects;
|
||||
import io.xpipe.core.store.ShellStore;
|
||||
|
||||
import javafx.beans.value.ObservableValue;
|
||||
|
||||
@@ -66,7 +66,7 @@ public class SampleStoreAction implements ActionProvider {
|
||||
public void execute() throws Exception {
|
||||
var docker = new LocalStore();
|
||||
// Start a shell control from the docker connection store
|
||||
try (ShellControl sc = docker.control().start()) {
|
||||
try (ShellControl sc = docker.standaloneControl().start()) {
|
||||
// Once we are here, the shell connection is initialized and we can query all kinds of information
|
||||
|
||||
// Query the detected shell dialect, e.g. cmd, powershell, sh, bash, etc.
|
||||
|
||||
@@ -2,12 +2,12 @@ package io.xpipe.ext.base.action;
|
||||
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.app.ext.ActionProvider;
|
||||
import io.xpipe.app.ext.ShellStore;
|
||||
import io.xpipe.app.storage.DataStoreEntry;
|
||||
import io.xpipe.app.storage.DataStoreEntryRef;
|
||||
import io.xpipe.app.util.ScanAlert;
|
||||
import io.xpipe.core.process.ShellStoreState;
|
||||
import io.xpipe.core.process.ShellTtyState;
|
||||
import io.xpipe.core.store.ShellStore;
|
||||
|
||||
import javafx.beans.value.ObservableValue;
|
||||
|
||||
@@ -70,7 +70,7 @@ public class ScanStoreAction implements ActionProvider {
|
||||
@Override
|
||||
public void execute() {
|
||||
if (entry == null || entry.getStore() instanceof ShellStore) {
|
||||
ScanAlert.showForShellStore(entry, null);
|
||||
ScanAlert.showForShellStore(entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.xpipe.ext.base.browser;
|
||||
|
||||
import io.xpipe.app.browser.action.LeafAction;
|
||||
import io.xpipe.app.browser.action.BrowserLeafAction;
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
|
||||
import javafx.beans.value.ObservableValue;
|
||||
@@ -15,10 +15,10 @@ import org.kordamp.ikonli.javafx.FontIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BackAction implements LeafAction {
|
||||
public class BackAction implements BrowserLeafAction {
|
||||
|
||||
@Override
|
||||
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) throws Exception {
|
||||
public void execute(BrowserFileSystemTabModel model, List<BrowserEntry> entries) throws Exception {
|
||||
model.backSync(1);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public class BackAction implements LeafAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getIcon(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public Node getIcon(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return new FontIcon("fth-arrow-left");
|
||||
}
|
||||
|
||||
@@ -37,17 +37,17 @@ public class BackAction implements LeafAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return AppI18n.observable("back");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isApplicable(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isActive(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return model.getHistory().canGoBackProperty().get();
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.xpipe.ext.base.browser;
|
||||
|
||||
import io.xpipe.app.browser.action.LeafAction;
|
||||
import io.xpipe.app.browser.action.BrowserLeafAction;
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.app.util.DesktopHelper;
|
||||
import io.xpipe.app.util.LocalShell;
|
||||
@@ -13,10 +13,10 @@ import javafx.beans.value.ObservableValue;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BrowseInNativeManagerAction implements LeafAction {
|
||||
public class BrowseInNativeManagerAction implements BrowserLeafAction {
|
||||
|
||||
@Override
|
||||
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) throws Exception {
|
||||
public void execute(BrowserFileSystemTabModel model, List<BrowserEntry> entries) throws Exception {
|
||||
ShellControl sc = model.getFileSystem().getShell().orElseThrow();
|
||||
for (BrowserEntry entry : entries) {
|
||||
var e = entry.getRawFileEntry().getPath();
|
||||
@@ -39,7 +39,7 @@ public class BrowseInNativeManagerAction implements LeafAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return switch (OsType.getLocal()) {
|
||||
case OsType.Windows windows -> AppI18n.observable("browseInWindowsExplorer");
|
||||
case OsType.Linux linux -> AppI18n.observable("browseInDefaultFileManager");
|
||||
@@ -48,7 +48,7 @@ public class BrowseInNativeManagerAction implements LeafAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isApplicable(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return model.getFileSystem()
|
||||
.getShell()
|
||||
.orElseThrow()
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package io.xpipe.ext.base.browser;
|
||||
|
||||
import io.xpipe.app.browser.action.BranchAction;
|
||||
import io.xpipe.app.browser.action.LeafAction;
|
||||
import io.xpipe.app.browser.action.BrowserBranchAction;
|
||||
import io.xpipe.app.browser.action.BrowserLeafAction;
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.core.process.CommandBuilder;
|
||||
import io.xpipe.core.process.OsType;
|
||||
@@ -16,10 +16,10 @@ import org.kordamp.ikonli.javafx.FontIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ChgrpAction implements BranchAction {
|
||||
public class ChgrpAction implements BrowserBranchAction {
|
||||
|
||||
@Override
|
||||
public Node getIcon(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public Node getIcon(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return new FontIcon("mdi2a-account-group-outline");
|
||||
}
|
||||
|
||||
@@ -29,29 +29,29 @@ public class ChgrpAction implements BranchAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return AppI18n.observable("chgrp");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isApplicable(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
var os = model.getFileSystem().getShell().orElseThrow().getOsType();
|
||||
return os != OsType.WINDOWS && os != OsType.MACOS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LeafAction> getBranchingActions(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public List<BrowserLeafAction> getBranchingActions(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return model.getCache().getGroups().entrySet().stream()
|
||||
.filter(e -> !e.getValue().equals("nohome")
|
||||
&& !e.getValue().equals("nogroup")
|
||||
&& !e.getValue().equals("nobody")
|
||||
&& (e.getKey().equals(0) || e.getKey() >= 1000))
|
||||
&& (e.getKey().equals(0) || e.getKey() >= 900))
|
||||
.map(e -> e.getValue())
|
||||
.map(s -> (LeafAction) new Chgrp(s))
|
||||
.map(s -> (BrowserLeafAction) new Chgrp(s))
|
||||
.toList();
|
||||
}
|
||||
|
||||
private static class Chgrp implements LeafAction {
|
||||
private static class Chgrp implements BrowserLeafAction {
|
||||
|
||||
private final String option;
|
||||
|
||||
@@ -60,12 +60,12 @@ public class ChgrpAction implements BranchAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return new SimpleStringProperty(option);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) throws Exception {
|
||||
public void execute(BrowserFileSystemTabModel model, List<BrowserEntry> entries) throws Exception {
|
||||
model.getFileSystem()
|
||||
.getShell()
|
||||
.orElseThrow()
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package io.xpipe.ext.base.browser;
|
||||
|
||||
import io.xpipe.app.browser.action.BranchAction;
|
||||
import io.xpipe.app.browser.action.LeafAction;
|
||||
import io.xpipe.app.browser.action.BrowserBranchAction;
|
||||
import io.xpipe.app.browser.action.BrowserLeafAction;
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.core.process.CommandBuilder;
|
||||
import io.xpipe.core.process.OsType;
|
||||
@@ -16,10 +16,10 @@ import org.kordamp.ikonli.javafx.FontIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ChmodAction implements BranchAction {
|
||||
public class ChmodAction implements BrowserBranchAction {
|
||||
|
||||
@Override
|
||||
public Node getIcon(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public Node getIcon(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return new FontIcon("mdi2w-wrench");
|
||||
}
|
||||
|
||||
@@ -29,17 +29,17 @@ public class ChmodAction implements BranchAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return AppI18n.observable("chmod");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isApplicable(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return model.getFileSystem().getShell().orElseThrow().getOsType() != OsType.WINDOWS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LeafAction> getBranchingActions(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public List<BrowserLeafAction> getBranchingActions(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return List.of(
|
||||
new Chmod("400"),
|
||||
new Chmod("600"),
|
||||
@@ -51,7 +51,7 @@ public class ChmodAction implements BranchAction {
|
||||
new Chmod("a+x"));
|
||||
}
|
||||
|
||||
private static class Chmod implements LeafAction {
|
||||
private static class Chmod implements BrowserLeafAction {
|
||||
|
||||
private final String option;
|
||||
|
||||
@@ -60,12 +60,12 @@ public class ChmodAction implements BranchAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return new SimpleStringProperty(option);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) throws Exception {
|
||||
public void execute(BrowserFileSystemTabModel model, List<BrowserEntry> entries) throws Exception {
|
||||
model.getFileSystem()
|
||||
.getShell()
|
||||
.orElseThrow()
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package io.xpipe.ext.base.browser;
|
||||
|
||||
import io.xpipe.app.browser.action.BranchAction;
|
||||
import io.xpipe.app.browser.action.LeafAction;
|
||||
import io.xpipe.app.browser.action.BrowserBranchAction;
|
||||
import io.xpipe.app.browser.action.BrowserLeafAction;
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.core.process.CommandBuilder;
|
||||
import io.xpipe.core.process.OsType;
|
||||
@@ -16,10 +16,10 @@ import org.kordamp.ikonli.javafx.FontIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ChownAction implements BranchAction {
|
||||
public class ChownAction implements BrowserBranchAction {
|
||||
|
||||
@Override
|
||||
public Node getIcon(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public Node getIcon(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return new FontIcon("mdi2a-account-edit");
|
||||
}
|
||||
|
||||
@@ -29,28 +29,28 @@ public class ChownAction implements BranchAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return AppI18n.observable("chown");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isApplicable(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
var os = model.getFileSystem().getShell().orElseThrow().getOsType();
|
||||
return os != OsType.WINDOWS && os != OsType.MACOS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LeafAction> getBranchingActions(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public List<BrowserLeafAction> getBranchingActions(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return model.getCache().getUsers().entrySet().stream()
|
||||
.filter(e -> !e.getValue().equals("nohome")
|
||||
&& !e.getValue().equals("nobody")
|
||||
&& (e.getKey().equals(0) || e.getKey() >= 1000))
|
||||
&& (e.getKey().equals(0) || e.getKey() >= 900))
|
||||
.map(e -> e.getValue())
|
||||
.map(s -> (LeafAction) new Chown(s))
|
||||
.map(s -> (BrowserLeafAction) new Chown(s))
|
||||
.toList();
|
||||
}
|
||||
|
||||
private static class Chown implements LeafAction {
|
||||
private static class Chown implements BrowserLeafAction {
|
||||
|
||||
private final String option;
|
||||
|
||||
@@ -59,12 +59,12 @@ public class ChownAction implements BranchAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return new SimpleStringProperty(option);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) throws Exception {
|
||||
public void execute(BrowserFileSystemTabModel model, List<BrowserEntry> entries) throws Exception {
|
||||
model.getFileSystem()
|
||||
.getShell()
|
||||
.orElseThrow()
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package io.xpipe.ext.base.browser;
|
||||
|
||||
import io.xpipe.app.browser.BrowserClipboard;
|
||||
import io.xpipe.app.browser.action.LeafAction;
|
||||
import io.xpipe.app.browser.action.BrowserLeafAction;
|
||||
import io.xpipe.app.browser.file.BrowserClipboard;
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
|
||||
import javafx.beans.value.ObservableValue;
|
||||
@@ -16,15 +16,15 @@ import org.kordamp.ikonli.javafx.FontIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CopyAction implements LeafAction {
|
||||
public class CopyAction implements BrowserLeafAction {
|
||||
|
||||
@Override
|
||||
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public void execute(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
BrowserClipboard.startCopy(model.getCurrentDirectory(), entries);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getIcon(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public Node getIcon(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return new FontIcon("mdi2c-content-copy");
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class CopyAction implements LeafAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return AppI18n.observable("copy");
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
package io.xpipe.ext.base.browser;
|
||||
|
||||
import io.xpipe.app.browser.action.BranchAction;
|
||||
import io.xpipe.app.browser.action.BrowserAction;
|
||||
import io.xpipe.app.browser.action.BrowserActionFormatter;
|
||||
import io.xpipe.app.browser.action.LeafAction;
|
||||
import io.xpipe.app.browser.action.BrowserBranchAction;
|
||||
import io.xpipe.app.browser.action.BrowserLeafAction;
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.app.util.ClipboardHelper;
|
||||
import io.xpipe.core.store.FileKind;
|
||||
@@ -20,7 +20,7 @@ import javafx.scene.input.KeyCombination;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class CopyPathAction implements BrowserAction, BranchAction {
|
||||
public class CopyPathAction implements BrowserAction, BrowserBranchAction {
|
||||
|
||||
@Override
|
||||
public Category getCategory() {
|
||||
@@ -33,21 +33,22 @@ public class CopyPathAction implements BrowserAction, BranchAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return AppI18n.observable("copyLocation");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LeafAction> getBranchingActions(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public List<BrowserLeafAction> getBranchingActions(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return List.of(
|
||||
new LeafAction() {
|
||||
new BrowserLeafAction() {
|
||||
@Override
|
||||
public KeyCombination getShortcut() {
|
||||
return new KeyCodeCombination(KeyCode.C, KeyCombination.ALT_DOWN, KeyCombination.SHORTCUT_DOWN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(
|
||||
BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
if (entries.size() == 1) {
|
||||
return new SimpleObjectProperty<>(BrowserActionFormatter.centerEllipsis(
|
||||
entries.getFirst().getRawFileEntry().getPath(), 50));
|
||||
@@ -57,16 +58,17 @@ public class CopyPathAction implements BrowserAction, BranchAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public void execute(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
var s = entries.stream()
|
||||
.map(entry -> entry.getRawFileEntry().getPath())
|
||||
.collect(Collectors.joining("\n"));
|
||||
ClipboardHelper.copyText(s);
|
||||
}
|
||||
},
|
||||
new LeafAction() {
|
||||
new BrowserLeafAction() {
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(
|
||||
BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
if (entries.size() == 1) {
|
||||
return new SimpleObjectProperty<>(BrowserActionFormatter.centerEllipsis(
|
||||
entries.getFirst().getRawFileEntry().getPath(), 50));
|
||||
@@ -76,7 +78,7 @@ public class CopyPathAction implements BrowserAction, BranchAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isApplicable(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return entries.stream()
|
||||
.allMatch(browserEntry ->
|
||||
browserEntry.getRawFileEntry().getKind() == FileKind.LINK);
|
||||
@@ -88,16 +90,17 @@ public class CopyPathAction implements BrowserAction, BranchAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public void execute(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
var s = entries.stream()
|
||||
.map(entry -> entry.getRawFileEntry().getPath())
|
||||
.collect(Collectors.joining("\n"));
|
||||
ClipboardHelper.copyText(s);
|
||||
}
|
||||
},
|
||||
new LeafAction() {
|
||||
new BrowserLeafAction() {
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(
|
||||
BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
if (entries.size() == 1) {
|
||||
return new SimpleObjectProperty<>("\""
|
||||
+ BrowserActionFormatter.centerEllipsis(
|
||||
@@ -109,21 +112,21 @@ public class CopyPathAction implements BrowserAction, BranchAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isApplicable(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return entries.stream()
|
||||
.anyMatch(entry ->
|
||||
entry.getRawFileEntry().getPath().contains(" "));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public void execute(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
var s = entries.stream()
|
||||
.map(entry -> "\"" + entry.getRawFileEntry().getPath() + "\"")
|
||||
.collect(Collectors.joining("\n"));
|
||||
ClipboardHelper.copyText(s);
|
||||
}
|
||||
},
|
||||
new LeafAction() {
|
||||
new BrowserLeafAction() {
|
||||
@Override
|
||||
public KeyCombination getShortcut() {
|
||||
return new KeyCodeCombination(
|
||||
@@ -131,7 +134,8 @@ public class CopyPathAction implements BrowserAction, BranchAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(
|
||||
BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
if (entries.size() == 1) {
|
||||
return new SimpleObjectProperty<>(BrowserActionFormatter.centerEllipsis(
|
||||
FileNames.getFileName(
|
||||
@@ -143,7 +147,7 @@ public class CopyPathAction implements BrowserAction, BranchAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public void execute(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
var s = entries.stream()
|
||||
.map(entry -> FileNames.getFileName(
|
||||
entry.getRawFileEntry().getPath()))
|
||||
@@ -151,9 +155,10 @@ public class CopyPathAction implements BrowserAction, BranchAction {
|
||||
ClipboardHelper.copyText(s);
|
||||
}
|
||||
},
|
||||
new LeafAction() {
|
||||
new BrowserLeafAction() {
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(
|
||||
BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
if (entries.size() == 1) {
|
||||
return new SimpleObjectProperty<>(BrowserActionFormatter.centerEllipsis(
|
||||
FileNames.getFileName(
|
||||
@@ -165,7 +170,7 @@ public class CopyPathAction implements BrowserAction, BranchAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isApplicable(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return entries.stream()
|
||||
.allMatch(browserEntry ->
|
||||
browserEntry.getRawFileEntry().getKind() == FileKind.LINK)
|
||||
@@ -183,7 +188,7 @@ public class CopyPathAction implements BrowserAction, BranchAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public void execute(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
var s = entries.stream()
|
||||
.map(entry -> FileNames.getFileName(
|
||||
entry.getRawFileEntry().getPath()))
|
||||
@@ -191,9 +196,10 @@ public class CopyPathAction implements BrowserAction, BranchAction {
|
||||
ClipboardHelper.copyText(s);
|
||||
}
|
||||
},
|
||||
new LeafAction() {
|
||||
new BrowserLeafAction() {
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(
|
||||
BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
if (entries.size() == 1) {
|
||||
return new SimpleObjectProperty<>("\""
|
||||
+ BrowserActionFormatter.centerEllipsis(
|
||||
@@ -208,14 +214,14 @@ public class CopyPathAction implements BrowserAction, BranchAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isApplicable(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return entries.stream().anyMatch(entry -> FileNames.getFileName(
|
||||
entry.getRawFileEntry().getPath())
|
||||
.contains(" "));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public void execute(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
var s = entries.stream()
|
||||
.map(entry -> "\""
|
||||
+ FileNames.getFileName(
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package io.xpipe.ext.base.browser;
|
||||
|
||||
import io.xpipe.app.browser.action.LeafAction;
|
||||
import io.xpipe.app.browser.action.BrowserLeafAction;
|
||||
import io.xpipe.app.browser.file.BrowserAlerts;
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.file.FileSystemHelper;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.browser.file.BrowserFileSystemHelper;
|
||||
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.core.store.FileKind;
|
||||
|
||||
@@ -18,21 +18,21 @@ import org.kordamp.ikonli.javafx.FontIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class DeleteAction implements LeafAction {
|
||||
public class DeleteAction implements BrowserLeafAction {
|
||||
|
||||
@Override
|
||||
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) throws Exception {
|
||||
public void execute(BrowserFileSystemTabModel model, List<BrowserEntry> entries) throws Exception {
|
||||
var toDelete = entries.stream().map(entry -> entry.getRawFileEntry()).toList();
|
||||
if (!BrowserAlerts.showDeleteAlert(toDelete)) {
|
||||
return;
|
||||
}
|
||||
|
||||
FileSystemHelper.delete(toDelete);
|
||||
BrowserFileSystemHelper.delete(toDelete);
|
||||
model.refreshSync();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getIcon(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public Node getIcon(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return new FontIcon("mdi2d-delete");
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public class DeleteAction implements LeafAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return AppI18n.observable(
|
||||
"deleteFile",
|
||||
entries.stream()
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package io.xpipe.ext.base.browser;
|
||||
|
||||
import io.xpipe.app.browser.action.LeafAction;
|
||||
import io.xpipe.app.browser.action.BrowserLeafAction;
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.file.FileSystemHelper;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.browser.file.BrowserFileSystemHelper;
|
||||
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.core.store.FileKind;
|
||||
|
||||
@@ -14,17 +14,17 @@ import org.kordamp.ikonli.javafx.FontIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class DeleteLinkAction implements LeafAction {
|
||||
public class DeleteLinkAction implements BrowserLeafAction {
|
||||
|
||||
@Override
|
||||
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) throws Exception {
|
||||
public void execute(BrowserFileSystemTabModel model, List<BrowserEntry> entries) throws Exception {
|
||||
var toDelete = entries.stream().map(entry -> entry.getRawFileEntry()).toList();
|
||||
FileSystemHelper.delete(toDelete);
|
||||
BrowserFileSystemHelper.delete(toDelete);
|
||||
model.refreshSync();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getIcon(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public Node getIcon(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return new FontIcon("mdi2d-delete");
|
||||
}
|
||||
|
||||
@@ -34,12 +34,12 @@ public class DeleteLinkAction implements LeafAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return AppI18n.observable("deleteLink");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isApplicable(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return entries.stream()
|
||||
.allMatch(browserEntry -> browserEntry.getRawFileEntry().getKind() == FileKind.LINK);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package io.xpipe.ext.base.browser;
|
||||
|
||||
import io.xpipe.app.browser.BrowserFileOpener;
|
||||
import io.xpipe.app.browser.action.LeafAction;
|
||||
import io.xpipe.app.browser.action.BrowserLeafAction;
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.browser.file.BrowserFileOpener;
|
||||
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.app.prefs.AppPrefs;
|
||||
import io.xpipe.core.store.FileKind;
|
||||
@@ -18,7 +18,7 @@ import org.kordamp.ikonli.javafx.FontIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class EditFileAction implements LeafAction {
|
||||
public class EditFileAction implements BrowserLeafAction {
|
||||
|
||||
@Override
|
||||
public KeyCombination getShortcut() {
|
||||
@@ -26,14 +26,14 @@ public class EditFileAction implements LeafAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public void execute(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
for (BrowserEntry entry : entries) {
|
||||
BrowserFileOpener.openInTextEditor(model, entry.getRawFileEntry());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getIcon(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public Node getIcon(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return new FontIcon("mdi2p-pencil");
|
||||
}
|
||||
|
||||
@@ -43,19 +43,19 @@ public class EditFileAction implements LeafAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
var e = AppPrefs.get().externalEditor().getValue();
|
||||
return AppI18n.observable(
|
||||
"editWithEditor", e != null ? e.toTranslatedString().getValue() : "?");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isApplicable(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return entries.stream().allMatch(entry -> entry.getRawFileEntry().getKind() == FileKind.FILE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isActive(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
var e = AppPrefs.get().externalEditor().getValue();
|
||||
return e != null;
|
||||
}
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
package io.xpipe.ext.base.browser;
|
||||
|
||||
import io.xpipe.app.browser.action.ApplicationPathAction;
|
||||
import io.xpipe.app.browser.action.LeafAction;
|
||||
import io.xpipe.app.browser.action.BrowserApplicationPathAction;
|
||||
import io.xpipe.app.browser.action.BrowserLeafAction;
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
|
||||
import io.xpipe.core.process.CommandBuilder;
|
||||
import io.xpipe.core.process.ShellControl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class ExecuteApplicationAction implements LeafAction, ApplicationPathAction {
|
||||
public abstract class ExecuteApplicationAction implements BrowserLeafAction, BrowserApplicationPathAction {
|
||||
|
||||
@Override
|
||||
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) throws Exception {
|
||||
public void execute(BrowserFileSystemTabModel model, List<BrowserEntry> entries) throws Exception {
|
||||
ShellControl sc = model.getFileSystem().getShell().orElseThrow();
|
||||
for (BrowserEntry entry : entries) {
|
||||
var command = createCommand(model, entry);
|
||||
@@ -32,5 +32,5 @@ public abstract class ExecuteApplicationAction implements LeafAction, Applicatio
|
||||
return false;
|
||||
}
|
||||
|
||||
protected abstract CommandBuilder createCommand(OpenFileSystemModel model, BrowserEntry entry);
|
||||
protected abstract CommandBuilder createCommand(BrowserFileSystemTabModel model, BrowserEntry entry);
|
||||
}
|
||||
@@ -2,7 +2,7 @@ package io.xpipe.ext.base.browser;
|
||||
|
||||
import io.xpipe.app.browser.action.BrowserAction;
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
|
||||
import io.xpipe.app.browser.icon.BrowserIconFileType;
|
||||
import io.xpipe.app.browser.icon.BrowserIcons;
|
||||
|
||||
@@ -13,12 +13,12 @@ import java.util.List;
|
||||
public interface FileTypeAction extends BrowserAction {
|
||||
|
||||
@Override
|
||||
default Node getIcon(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
default Node getIcon(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return BrowserIcons.createIcon(getType()).createRegion();
|
||||
}
|
||||
|
||||
@Override
|
||||
default boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
default boolean isApplicable(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
var t = getType();
|
||||
return entries.stream().allMatch(entry -> t.matches(entry.getRawFileEntry()));
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.xpipe.ext.base.browser;
|
||||
|
||||
import io.xpipe.app.browser.action.LeafAction;
|
||||
import io.xpipe.app.browser.action.BrowserLeafAction;
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.core.store.FileKind;
|
||||
import io.xpipe.core.store.FileNames;
|
||||
@@ -14,17 +14,17 @@ import org.kordamp.ikonli.javafx.FontIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class FollowLinkAction implements LeafAction {
|
||||
public class FollowLinkAction implements BrowserLeafAction {
|
||||
|
||||
@Override
|
||||
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public void execute(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
var target = FileNames.getParent(
|
||||
entries.getFirst().getRawFileEntry().resolved().getPath());
|
||||
model.cdAsync(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getIcon(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public Node getIcon(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return new FontIcon("mdi2a-arrow-top-right-thick");
|
||||
}
|
||||
|
||||
@@ -34,12 +34,12 @@ public class FollowLinkAction implements LeafAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return AppI18n.observable("followLink");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isApplicable(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return entries.size() == 1
|
||||
&& entries.stream()
|
||||
.allMatch(entry -> entry.getRawFileEntry().getKind() == FileKind.LINK
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.xpipe.ext.base.browser;
|
||||
|
||||
import io.xpipe.app.browser.action.LeafAction;
|
||||
import io.xpipe.app.browser.action.BrowserLeafAction;
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
|
||||
import javafx.beans.value.ObservableValue;
|
||||
@@ -15,10 +15,10 @@ import org.kordamp.ikonli.javafx.FontIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ForwardAction implements LeafAction {
|
||||
public class ForwardAction implements BrowserLeafAction {
|
||||
|
||||
@Override
|
||||
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) throws Exception {
|
||||
public void execute(BrowserFileSystemTabModel model, List<BrowserEntry> entries) throws Exception {
|
||||
model.forthSync(1);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public class ForwardAction implements LeafAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getIcon(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public Node getIcon(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return new FontIcon("fth-arrow-right");
|
||||
}
|
||||
|
||||
@@ -37,17 +37,17 @@ public class ForwardAction implements LeafAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return AppI18n.observable("goForward");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isApplicable(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isActive(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return model.getHistory().canGoForthProperty().get();
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@ package io.xpipe.ext.base.browser;
|
||||
|
||||
import io.xpipe.app.browser.action.BrowserActionFormatter;
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
|
||||
import io.xpipe.app.browser.icon.BrowserIconFileType;
|
||||
import io.xpipe.core.process.CommandBuilder;
|
||||
import io.xpipe.core.process.ShellControl;
|
||||
@@ -20,17 +20,17 @@ public class JarAction extends MultiExecuteAction implements JavaAction, FileTyp
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return new SimpleStringProperty("java -jar " + BrowserActionFormatter.filesArgument(entries));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isApplicable(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return super.isApplicable(model, entries) && FileTypeAction.super.isApplicable(model, entries);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CommandBuilder createCommand(ShellControl sc, OpenFileSystemModel model, BrowserEntry entry) {
|
||||
protected CommandBuilder createCommand(ShellControl sc, BrowserFileSystemTabModel model, BrowserEntry entry) {
|
||||
return CommandBuilder.of()
|
||||
.add("java", "-jar")
|
||||
.addFile(entry.getRawFileEntry().getPath());
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.xpipe.ext.base.browser;
|
||||
|
||||
import io.xpipe.app.browser.action.ApplicationPathAction;
|
||||
import io.xpipe.app.browser.action.BrowserApplicationPathAction;
|
||||
|
||||
public interface JavaAction extends ApplicationPathAction {
|
||||
public interface JavaAction extends BrowserApplicationPathAction {
|
||||
|
||||
@Override
|
||||
default String getExecutable() {
|
||||
|
||||
@@ -2,7 +2,7 @@ package io.xpipe.ext.base.browser;
|
||||
|
||||
import io.xpipe.app.browser.action.BrowserActionFormatter;
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
|
||||
import io.xpipe.app.browser.icon.BrowserIconFileType;
|
||||
import io.xpipe.core.store.FileNames;
|
||||
|
||||
@@ -19,12 +19,12 @@ public class JavapAction extends ToFileCommandAction implements FileTypeAction,
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return new SimpleStringProperty("javap -c -p " + BrowserActionFormatter.filesArgument(entries));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isApplicable(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return super.isApplicable(model, entries) && FileTypeAction.super.isApplicable(model, entries);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public class JavapAction extends ToFileCommandAction implements FileTypeAction,
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String createCommand(OpenFileSystemModel model, BrowserEntry entry) {
|
||||
protected String createCommand(BrowserFileSystemTabModel model, BrowserEntry entry) {
|
||||
return "javap -c -p "
|
||||
+ FileNames.quoteIfNecessary(entry.getRawFileEntry().getPath());
|
||||
}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
package io.xpipe.ext.base.browser;
|
||||
|
||||
import io.xpipe.app.browser.action.BranchAction;
|
||||
import io.xpipe.app.browser.action.LeafAction;
|
||||
import io.xpipe.app.browser.action.BrowserBranchAction;
|
||||
import io.xpipe.app.browser.action.BrowserLeafAction;
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.app.prefs.AppPrefs;
|
||||
import io.xpipe.app.util.TerminalLauncher;
|
||||
import io.xpipe.core.process.CommandBuilder;
|
||||
import io.xpipe.core.process.ShellControl;
|
||||
|
||||
@@ -14,40 +13,43 @@ import javafx.beans.value.ObservableValue;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class MultiExecuteAction implements BranchAction {
|
||||
public abstract class MultiExecuteAction implements BrowserBranchAction {
|
||||
|
||||
protected abstract CommandBuilder createCommand(ShellControl sc, OpenFileSystemModel model, BrowserEntry entry);
|
||||
protected abstract CommandBuilder createCommand(
|
||||
ShellControl sc, BrowserFileSystemTabModel model, BrowserEntry entry);
|
||||
|
||||
@Override
|
||||
public List<LeafAction> getBranchingActions(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public List<BrowserLeafAction> getBranchingActions(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return List.of(
|
||||
new LeafAction() {
|
||||
new BrowserLeafAction() {
|
||||
|
||||
@Override
|
||||
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public void execute(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
model.withShell(
|
||||
pc -> {
|
||||
for (BrowserEntry entry : entries) {
|
||||
var cmd = pc.command(createCommand(pc, model, entry));
|
||||
if (cmd == null) {
|
||||
var c = createCommand(pc, model, entry);
|
||||
if (c == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
TerminalLauncher.open(
|
||||
model.getEntry().getEntry(),
|
||||
var cmd = pc.command(c);
|
||||
model.openTerminalAsync(
|
||||
entry.getRawFileEntry().getName(),
|
||||
model.getCurrentDirectory() != null
|
||||
? model.getCurrentDirectory()
|
||||
.getPath()
|
||||
: null,
|
||||
cmd);
|
||||
cmd,
|
||||
entries.size() == 1);
|
||||
}
|
||||
},
|
||||
false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(
|
||||
BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
var t = AppPrefs.get().terminalType().getValue();
|
||||
return AppI18n.observable(
|
||||
"executeInTerminal",
|
||||
@@ -55,14 +57,14 @@ public abstract class MultiExecuteAction implements BranchAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isApplicable(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return AppPrefs.get().terminalType().getValue() != null;
|
||||
}
|
||||
},
|
||||
new LeafAction() {
|
||||
new BrowserLeafAction() {
|
||||
|
||||
@Override
|
||||
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public void execute(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
model.withShell(
|
||||
pc -> {
|
||||
for (BrowserEntry entry : entries) {
|
||||
@@ -81,7 +83,8 @@ public abstract class MultiExecuteAction implements BranchAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(
|
||||
BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return AppI18n.observable("executeInBackground");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
package io.xpipe.ext.base.browser;
|
||||
|
||||
import io.xpipe.app.browser.action.BranchAction;
|
||||
import io.xpipe.app.browser.action.LeafAction;
|
||||
import io.xpipe.app.browser.action.BrowserBranchAction;
|
||||
import io.xpipe.app.browser.action.BrowserLeafAction;
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.app.issue.ErrorEvent;
|
||||
import io.xpipe.app.prefs.AppPrefs;
|
||||
import io.xpipe.app.util.TerminalLauncher;
|
||||
import io.xpipe.core.process.CommandBuilder;
|
||||
import io.xpipe.core.process.ProcessOutputException;
|
||||
import io.xpipe.core.process.ShellControl;
|
||||
@@ -17,37 +16,43 @@ import javafx.beans.value.ObservableValue;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
public abstract class MultiExecuteSelectionAction implements BranchAction {
|
||||
public abstract class MultiExecuteSelectionAction implements BrowserBranchAction {
|
||||
|
||||
protected abstract CommandBuilder createCommand(
|
||||
ShellControl sc, OpenFileSystemModel model, List<BrowserEntry> entries);
|
||||
ShellControl sc, BrowserFileSystemTabModel model, List<BrowserEntry> entries);
|
||||
|
||||
protected abstract String getTerminalTitle();
|
||||
|
||||
@Override
|
||||
public List<LeafAction> getBranchingActions(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public List<BrowserLeafAction> getBranchingActions(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return List.of(
|
||||
new LeafAction() {
|
||||
new BrowserLeafAction() {
|
||||
|
||||
@Override
|
||||
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public void execute(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
model.withShell(
|
||||
pc -> {
|
||||
var cmd = pc.command(createCommand(pc, model, entries));
|
||||
TerminalLauncher.open(
|
||||
model.getEntry().getEntry(),
|
||||
var c = createCommand(pc, model, entries);
|
||||
if (c == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
var cmd = pc.command(c);
|
||||
model.openTerminalAsync(
|
||||
getTerminalTitle(),
|
||||
model.getCurrentDirectory() != null
|
||||
? model.getCurrentDirectory()
|
||||
.getPath()
|
||||
: null,
|
||||
cmd);
|
||||
cmd,
|
||||
true);
|
||||
},
|
||||
false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(
|
||||
BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
var t = AppPrefs.get().terminalType().getValue();
|
||||
return AppI18n.observable(
|
||||
"executeInTerminal",
|
||||
@@ -55,14 +60,14 @@ public abstract class MultiExecuteSelectionAction implements BranchAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isApplicable(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return AppPrefs.get().terminalType().getValue() != null;
|
||||
}
|
||||
},
|
||||
new LeafAction() {
|
||||
new BrowserLeafAction() {
|
||||
|
||||
@Override
|
||||
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public void execute(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
model.withShell(
|
||||
pc -> {
|
||||
var cmd = createCommand(pc, model, entries);
|
||||
@@ -88,7 +93,8 @@ public abstract class MultiExecuteSelectionAction implements BranchAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(
|
||||
BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return AppI18n.observable("executeInBackground");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package io.xpipe.ext.base.browser;
|
||||
|
||||
import io.xpipe.app.browser.action.BranchAction;
|
||||
import io.xpipe.app.browser.action.BrowserAction;
|
||||
import io.xpipe.app.browser.action.LeafAction;
|
||||
import io.xpipe.app.browser.action.BrowserBranchAction;
|
||||
import io.xpipe.app.browser.action.BrowserLeafAction;
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
|
||||
import io.xpipe.app.browser.icon.BrowserIcons;
|
||||
import io.xpipe.app.comp.Comp;
|
||||
import io.xpipe.app.comp.base.ModalOverlayComp;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.app.fxcomps.Comp;
|
||||
import io.xpipe.app.util.OptionsBuilder;
|
||||
import io.xpipe.core.process.OsType;
|
||||
|
||||
@@ -21,10 +21,10 @@ import org.kordamp.ikonli.javafx.FontIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class NewItemAction implements BrowserAction, BranchAction {
|
||||
public class NewItemAction implements BrowserAction, BrowserBranchAction {
|
||||
|
||||
@Override
|
||||
public Node getIcon(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public Node getIcon(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return new FontIcon("mdi2p-plus-box-outline");
|
||||
}
|
||||
|
||||
@@ -39,12 +39,12 @@ public class NewItemAction implements BrowserAction, BranchAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return AppI18n.observable("new");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isApplicable(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return entries.size() == 1
|
||||
&& entries.getFirst()
|
||||
.getRawFileEntry()
|
||||
@@ -53,11 +53,11 @@ public class NewItemAction implements BrowserAction, BranchAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LeafAction> getBranchingActions(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public List<BrowserLeafAction> getBranchingActions(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return List.of(
|
||||
new LeafAction() {
|
||||
new BrowserLeafAction() {
|
||||
@Override
|
||||
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public void execute(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
var name = new SimpleStringProperty();
|
||||
model.getOverlay()
|
||||
.setValue(new ModalOverlayComp.OverlayContent(
|
||||
@@ -77,18 +77,19 @@ public class NewItemAction implements BrowserAction, BranchAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getIcon(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public Node getIcon(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return BrowserIcons.createDefaultFileIcon().createRegion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(
|
||||
BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return AppI18n.observable("file");
|
||||
}
|
||||
},
|
||||
new LeafAction() {
|
||||
new BrowserLeafAction() {
|
||||
@Override
|
||||
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public void execute(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
var name = new SimpleStringProperty();
|
||||
model.getOverlay()
|
||||
.setValue(new ModalOverlayComp.OverlayContent(
|
||||
@@ -108,18 +109,19 @@ public class NewItemAction implements BrowserAction, BranchAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getIcon(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public Node getIcon(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return BrowserIcons.createDefaultDirectoryIcon().createRegion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(
|
||||
BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return AppI18n.observable("directory");
|
||||
}
|
||||
},
|
||||
new LeafAction() {
|
||||
new BrowserLeafAction() {
|
||||
@Override
|
||||
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public void execute(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
var linkName = new SimpleStringProperty();
|
||||
var target = new SimpleStringProperty();
|
||||
model.getOverlay()
|
||||
@@ -141,17 +143,18 @@ public class NewItemAction implements BrowserAction, BranchAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getIcon(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public Node getIcon(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return BrowserIcons.createDefaultFileIcon().createRegion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(
|
||||
BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return AppI18n.observable("symbolicLink");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isApplicable(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return model.getFileSystem().getShell().orElseThrow().getOsType() != OsType.WINDOWS;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.xpipe.ext.base.browser;
|
||||
|
||||
import io.xpipe.app.browser.action.LeafAction;
|
||||
import io.xpipe.app.browser.action.BrowserLeafAction;
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.core.store.FileKind;
|
||||
|
||||
@@ -16,15 +16,15 @@ import org.kordamp.ikonli.javafx.FontIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class OpenDirectoryAction implements LeafAction {
|
||||
public class OpenDirectoryAction implements BrowserLeafAction {
|
||||
|
||||
@Override
|
||||
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public void execute(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
model.cdAsync(entries.getFirst().getRawFileEntry().getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getIcon(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public Node getIcon(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return new FontIcon("mdi2f-folder-open");
|
||||
}
|
||||
|
||||
@@ -39,12 +39,12 @@ public class OpenDirectoryAction implements LeafAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return AppI18n.observable("open");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isApplicable(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return entries.size() == 1
|
||||
&& entries.stream().allMatch(entry -> entry.getRawFileEntry().getKind() == FileKind.DIRECTORY);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package io.xpipe.ext.base.browser;
|
||||
|
||||
import io.xpipe.app.browser.action.LeafAction;
|
||||
import io.xpipe.app.browser.BrowserFullSessionModel;
|
||||
import io.xpipe.app.browser.action.BrowserLeafAction;
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.browser.session.BrowserSessionModel;
|
||||
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.core.store.FileKind;
|
||||
|
||||
@@ -17,18 +17,18 @@ import org.kordamp.ikonli.javafx.FontIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class OpenDirectoryInNewTabAction implements LeafAction {
|
||||
public class OpenDirectoryInNewTabAction implements BrowserLeafAction {
|
||||
|
||||
@Override
|
||||
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
if (model.getBrowserModel() instanceof BrowserSessionModel bm) {
|
||||
public void execute(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
if (model.getBrowserModel() instanceof BrowserFullSessionModel bm) {
|
||||
bm.openFileSystemAsync(
|
||||
model.getEntry(), m -> entries.getFirst().getRawFileEntry().getPath(), null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getIcon(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public Node getIcon(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return new FontIcon("mdi2f-folder-open-outline");
|
||||
}
|
||||
|
||||
@@ -48,13 +48,13 @@ public class OpenDirectoryInNewTabAction implements LeafAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return AppI18n.observable("openInNewTab");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
return model.getBrowserModel() instanceof BrowserSessionModel
|
||||
public boolean isApplicable(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return model.getBrowserModel() instanceof BrowserFullSessionModel
|
||||
&& entries.size() == 1
|
||||
&& entries.stream().allMatch(entry -> entry.getRawFileEntry().getKind() == FileKind.DIRECTORY);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package io.xpipe.ext.base.browser;
|
||||
|
||||
import io.xpipe.app.browser.BrowserFileOpener;
|
||||
import io.xpipe.app.browser.action.LeafAction;
|
||||
import io.xpipe.app.browser.action.BrowserLeafAction;
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.browser.file.BrowserFileOpener;
|
||||
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.core.store.FileKind;
|
||||
|
||||
@@ -17,17 +17,17 @@ import org.kordamp.ikonli.javafx.FontIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class OpenFileDefaultAction implements LeafAction {
|
||||
public class OpenFileDefaultAction implements BrowserLeafAction {
|
||||
|
||||
@Override
|
||||
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public void execute(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
for (var entry : entries) {
|
||||
BrowserFileOpener.openInDefaultApplication(model, entry.getRawFileEntry());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getIcon(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public Node getIcon(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return new FontIcon("mdi2b-book-open-variant");
|
||||
}
|
||||
|
||||
@@ -42,12 +42,12 @@ public class OpenFileDefaultAction implements LeafAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return AppI18n.observable("openWithDefaultApplication");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isApplicable(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return model.getFileList().getEditing().getValue() == null
|
||||
&& entries.stream().allMatch(entry -> entry.getRawFileEntry().getKind() == FileKind.FILE);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package io.xpipe.ext.base.browser;
|
||||
|
||||
import io.xpipe.app.browser.BrowserFileOpener;
|
||||
import io.xpipe.app.browser.action.LeafAction;
|
||||
import io.xpipe.app.browser.action.BrowserLeafAction;
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.browser.file.BrowserFileOpener;
|
||||
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.core.process.OsType;
|
||||
import io.xpipe.core.store.FileKind;
|
||||
@@ -18,16 +18,16 @@ import org.kordamp.ikonli.javafx.FontIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class OpenFileWithAction implements LeafAction {
|
||||
public class OpenFileWithAction implements BrowserLeafAction {
|
||||
|
||||
@Override
|
||||
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public void execute(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
var e = entries.getFirst();
|
||||
BrowserFileOpener.openWithAnyApplication(model, e.getRawFileEntry());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getIcon(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public Node getIcon(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return new FontIcon("mdi2b-book-open-page-variant-outline");
|
||||
}
|
||||
|
||||
@@ -42,12 +42,12 @@ public class OpenFileWithAction implements LeafAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return AppI18n.observable("openFileWith");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isApplicable(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return OsType.getLocal().equals(OsType.WINDOWS)
|
||||
&& entries.size() == 1
|
||||
&& entries.stream().allMatch(entry -> entry.getRawFileEntry().getKind() == FileKind.FILE);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.xpipe.ext.base.browser;
|
||||
|
||||
import io.xpipe.app.browser.action.LeafAction;
|
||||
import io.xpipe.app.browser.action.BrowserLeafAction;
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.app.util.LocalShell;
|
||||
import io.xpipe.core.process.CommandBuilder;
|
||||
@@ -19,10 +19,10 @@ import javafx.scene.input.KeyCombination;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class OpenNativeFileDetailsAction implements LeafAction {
|
||||
public class OpenNativeFileDetailsAction implements BrowserLeafAction {
|
||||
|
||||
@Override
|
||||
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) throws Exception {
|
||||
public void execute(BrowserFileSystemTabModel model, List<BrowserEntry> entries) throws Exception {
|
||||
ShellControl sc = model.getFileSystem().getShell().get();
|
||||
for (BrowserEntry entry : entries) {
|
||||
var e = entry.getRawFileEntry().getPath();
|
||||
@@ -99,12 +99,12 @@ public class OpenNativeFileDetailsAction implements LeafAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return AppI18n.observable("showDetails");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isApplicable(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
var sc = model.getFileSystem().getShell().orElseThrow();
|
||||
return sc.getLocalSystemAccess().supportsFileSystemAccess();
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.xpipe.ext.base.browser;
|
||||
|
||||
import io.xpipe.app.browser.action.LeafAction;
|
||||
import io.xpipe.app.browser.action.BrowserLeafAction;
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.app.prefs.AppPrefs;
|
||||
import io.xpipe.core.store.FileKind;
|
||||
@@ -15,22 +15,23 @@ import javafx.scene.input.KeyCombination;
|
||||
|
||||
import org.kordamp.ikonli.javafx.FontIcon;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class OpenTerminalAction implements LeafAction {
|
||||
public class OpenTerminalAction implements BrowserLeafAction {
|
||||
|
||||
@Override
|
||||
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
if (entries.size() == 0) {
|
||||
model.openTerminalAsync(
|
||||
model.getCurrentDirectory() != null
|
||||
? model.getCurrentDirectory().getPath()
|
||||
: null);
|
||||
return;
|
||||
}
|
||||
|
||||
for (var entry : entries) {
|
||||
model.openTerminalAsync(entry.getRawFileEntry().getPath());
|
||||
public void execute(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
var dirs = entries.size() > 0
|
||||
? entries.stream()
|
||||
.map(browserEntry -> browserEntry.getRawFileEntry().getPath())
|
||||
.toList()
|
||||
: model.getCurrentDirectory() != null
|
||||
? List.of(model.getCurrentDirectory().getPath())
|
||||
: Collections.singletonList((String) null);
|
||||
for (String dir : dirs) {
|
||||
var name = (dir != null ? dir + " - " : "") + model.getName();
|
||||
model.openTerminalAsync(name, dir, model.getFileSystem().getShell().orElseThrow(), dirs.size() == 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +40,7 @@ public class OpenTerminalAction implements LeafAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getIcon(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public Node getIcon(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return new FontIcon("mdi2c-console");
|
||||
}
|
||||
|
||||
@@ -54,17 +55,17 @@ public class OpenTerminalAction implements LeafAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return AppI18n.observable("openInTerminal");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isApplicable(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return entries.stream().allMatch(entry -> entry.getRawFileEntry().getKind() == FileKind.DIRECTORY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isActive(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
var t = AppPrefs.get().terminalType().getValue();
|
||||
return t != null;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package io.xpipe.ext.base.browser;
|
||||
|
||||
import io.xpipe.app.browser.BrowserClipboard;
|
||||
import io.xpipe.app.browser.action.LeafAction;
|
||||
import io.xpipe.app.browser.action.BrowserLeafAction;
|
||||
import io.xpipe.app.browser.file.BrowserClipboard;
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
|
||||
import io.xpipe.app.browser.file.BrowserFileTransferMode;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.core.store.FileKind;
|
||||
|
||||
@@ -18,10 +18,10 @@ import org.kordamp.ikonli.javafx.FontIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PasteAction implements LeafAction {
|
||||
public class PasteAction implements BrowserLeafAction {
|
||||
|
||||
@Override
|
||||
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public void execute(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
var clipboard = BrowserClipboard.retrieveCopy();
|
||||
if (clipboard == null) {
|
||||
return;
|
||||
@@ -44,7 +44,7 @@ public class PasteAction implements LeafAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getIcon(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public Node getIcon(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return new FontIcon("mdi2c-content-paste");
|
||||
}
|
||||
|
||||
@@ -64,12 +64,12 @@ public class PasteAction implements LeafAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return AppI18n.observable("paste");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isApplicable(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return (entries.size() == 1
|
||||
&& entries.stream()
|
||||
.allMatch(entry -> entry.getRawFileEntry().getKind() == FileKind.DIRECTORY))
|
||||
@@ -77,7 +77,7 @@ public class PasteAction implements LeafAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isActive(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return BrowserClipboard.retrieveCopy() != null;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.xpipe.ext.base.browser;
|
||||
|
||||
import io.xpipe.app.browser.action.LeafAction;
|
||||
import io.xpipe.app.browser.action.BrowserLeafAction;
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
|
||||
import javafx.beans.value.ObservableValue;
|
||||
@@ -15,10 +15,10 @@ import org.kordamp.ikonli.javafx.FontIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class RefreshDirectoryAction implements LeafAction {
|
||||
public class RefreshDirectoryAction implements BrowserLeafAction {
|
||||
|
||||
@Override
|
||||
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) throws Exception {
|
||||
public void execute(BrowserFileSystemTabModel model, List<BrowserEntry> entries) throws Exception {
|
||||
model.refreshSync();
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public class RefreshDirectoryAction implements LeafAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getIcon(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public Node getIcon(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return new FontIcon("mdmz-refresh");
|
||||
}
|
||||
|
||||
@@ -37,17 +37,17 @@ public class RefreshDirectoryAction implements LeafAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return AppI18n.observable("refresh");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isApplicable(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isActive(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return !model.getInOverview().get();
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.xpipe.ext.base.browser;
|
||||
|
||||
import io.xpipe.app.browser.action.LeafAction;
|
||||
import io.xpipe.app.browser.action.BrowserLeafAction;
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.core.store.FileKind;
|
||||
|
||||
@@ -16,15 +16,15 @@ import org.kordamp.ikonli.javafx.FontIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class RenameAction implements LeafAction {
|
||||
public class RenameAction implements BrowserLeafAction {
|
||||
|
||||
@Override
|
||||
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public void execute(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
model.getFileList().getEditing().setValue(entries.getFirst());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getIcon(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public Node getIcon(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return new FontIcon("mdi2r-rename-box");
|
||||
}
|
||||
|
||||
@@ -39,12 +39,12 @@ public class RenameAction implements LeafAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return AppI18n.observable("rename");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isApplicable(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return entries.size() == 1 && entries.getFirst().getRawFileEntry().getKind() != FileKind.LINK;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package io.xpipe.ext.base.browser;
|
||||
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.core.process.CommandBuilder;
|
||||
import io.xpipe.core.process.OsType;
|
||||
@@ -54,7 +54,7 @@ public class RunAction extends MultiExecuteAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getIcon(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public Node getIcon(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return new FontIcon("mdi2p-play");
|
||||
}
|
||||
|
||||
@@ -64,16 +64,16 @@ public class RunAction extends MultiExecuteAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return AppI18n.observable("run");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isApplicable(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return entries.stream().allMatch(entry -> isExecutable(entry.getRawFileEntry()));
|
||||
}
|
||||
|
||||
protected CommandBuilder createCommand(ShellControl sc, OpenFileSystemModel model, BrowserEntry entry) {
|
||||
protected CommandBuilder createCommand(ShellControl sc, BrowserFileSystemTabModel model, BrowserEntry entry) {
|
||||
return CommandBuilder.of()
|
||||
.add(sc.getShellDialect()
|
||||
.runScriptCommand(sc, entry.getRawFileEntry().getPath()));
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
package io.xpipe.ext.base.browser;
|
||||
|
||||
import io.xpipe.app.browser.action.ApplicationPathAction;
|
||||
import io.xpipe.app.browser.action.LeafAction;
|
||||
import io.xpipe.app.browser.action.BrowserApplicationPathAction;
|
||||
import io.xpipe.app.browser.action.BrowserLeafAction;
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
|
||||
import io.xpipe.app.util.FileOpener;
|
||||
import io.xpipe.core.process.ShellControl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class ToFileCommandAction implements LeafAction, ApplicationPathAction {
|
||||
public abstract class ToFileCommandAction implements BrowserLeafAction, BrowserApplicationPathAction {
|
||||
|
||||
@Override
|
||||
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) throws Exception {
|
||||
public void execute(BrowserFileSystemTabModel model, List<BrowserEntry> entries) throws Exception {
|
||||
ShellControl sc = model.getFileSystem().getShell().orElseThrow();
|
||||
for (BrowserEntry entry : entries) {
|
||||
var command = createCommand(model, entry);
|
||||
@@ -23,5 +23,5 @@ public abstract class ToFileCommandAction implements LeafAction, ApplicationPath
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract String createCommand(OpenFileSystemModel model, BrowserEntry entry);
|
||||
protected abstract String createCommand(BrowserFileSystemTabModel model, BrowserEntry entry);
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
package io.xpipe.ext.base.browser.compress;
|
||||
|
||||
import io.xpipe.app.browser.action.BranchAction;
|
||||
import io.xpipe.app.browser.action.BrowserAction;
|
||||
import io.xpipe.app.browser.action.LeafAction;
|
||||
import io.xpipe.app.browser.action.BrowserBranchAction;
|
||||
import io.xpipe.app.browser.action.BrowserLeafAction;
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
|
||||
import io.xpipe.app.comp.Comp;
|
||||
import io.xpipe.app.comp.base.ModalOverlayComp;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.app.fxcomps.Comp;
|
||||
import io.xpipe.app.util.CommandSupport;
|
||||
import io.xpipe.core.process.CommandBuilder;
|
||||
import io.xpipe.core.process.OsType;
|
||||
@@ -24,7 +24,7 @@ import org.kordamp.ikonli.javafx.FontIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class BaseCompressAction implements BrowserAction, BranchAction {
|
||||
public abstract class BaseCompressAction implements BrowserAction, BrowserBranchAction {
|
||||
|
||||
private final boolean directory;
|
||||
|
||||
@@ -33,7 +33,7 @@ public abstract class BaseCompressAction implements BrowserAction, BranchAction
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(OpenFileSystemModel model) throws Exception {
|
||||
public void init(BrowserFileSystemTabModel model) throws Exception {
|
||||
var sc = model.getFileSystem().getShell().orElseThrow();
|
||||
|
||||
var foundTar = CommandSupport.findProgram(sc, "tar");
|
||||
@@ -59,7 +59,7 @@ public abstract class BaseCompressAction implements BrowserAction, BranchAction
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getIcon(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public Node getIcon(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return new FontIcon("mdi2a-archive");
|
||||
}
|
||||
|
||||
@@ -69,12 +69,12 @@ public abstract class BaseCompressAction implements BrowserAction, BranchAction
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return AppI18n.observable(directory ? "compressContents" : "compress");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isApplicable(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
var ext = List.of("zip", "tar", "tar.gz", "tgz", "7z", "rar", "xar");
|
||||
if (entries.stream().anyMatch(browserEntry -> ext.stream()
|
||||
.anyMatch(s ->
|
||||
@@ -88,7 +88,7 @@ public abstract class BaseCompressAction implements BrowserAction, BranchAction
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LeafAction> getBranchingActions(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public List<BrowserLeafAction> getBranchingActions(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return List.of(
|
||||
new Windows7zAction(),
|
||||
new WindowsZipAction(),
|
||||
@@ -108,10 +108,10 @@ public abstract class BaseCompressAction implements BrowserAction, BranchAction
|
||||
});
|
||||
}
|
||||
|
||||
private abstract class Action implements LeafAction {
|
||||
private abstract class Action implements BrowserLeafAction {
|
||||
|
||||
@Override
|
||||
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public void execute(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
var name = new SimpleStringProperty(directory ? entries.getFirst().getFileName() : null);
|
||||
model.getOverlay()
|
||||
.setValue(new ModalOverlayComp.OverlayContent(
|
||||
@@ -140,11 +140,11 @@ public abstract class BaseCompressAction implements BrowserAction, BranchAction
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return new SimpleStringProperty("." + getExtension());
|
||||
}
|
||||
|
||||
protected abstract void create(String fileName, OpenFileSystemModel model, List<BrowserEntry> entries);
|
||||
protected abstract void create(String fileName, BrowserFileSystemTabModel model, List<BrowserEntry> entries);
|
||||
|
||||
protected abstract String getExtension();
|
||||
}
|
||||
@@ -152,7 +152,7 @@ public abstract class BaseCompressAction implements BrowserAction, BranchAction
|
||||
private class WindowsZipAction extends Action {
|
||||
|
||||
@Override
|
||||
protected void create(String fileName, OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
protected void create(String fileName, BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
var base = new FilePath(model.getCurrentDirectory().getPath());
|
||||
var target = base.join(fileName);
|
||||
var command = CommandBuilder.of()
|
||||
@@ -195,7 +195,7 @@ public abstract class BaseCompressAction implements BrowserAction, BranchAction
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isApplicable(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return model.getFileSystem().getShell().orElseThrow().getOsType() == OsType.WINDOWS;
|
||||
}
|
||||
}
|
||||
@@ -203,7 +203,7 @@ public abstract class BaseCompressAction implements BrowserAction, BranchAction
|
||||
private class UnixZipAction extends Action {
|
||||
|
||||
@Override
|
||||
protected void create(String fileName, OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
protected void create(String fileName, BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
var base = new FilePath(model.getCurrentDirectory().getPath());
|
||||
var target = base.join(fileName);
|
||||
var command = CommandBuilder.of().add("zip", "-r", "-");
|
||||
@@ -240,12 +240,12 @@ public abstract class BaseCompressAction implements BrowserAction, BranchAction
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isActive(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return model.getCache().getInstalledApplications().get("zip");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isApplicable(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return model.getFileSystem().getShell().orElseThrow().getOsType() != OsType.WINDOWS;
|
||||
}
|
||||
}
|
||||
@@ -253,7 +253,7 @@ public abstract class BaseCompressAction implements BrowserAction, BranchAction
|
||||
private class Windows7zAction extends Action {
|
||||
|
||||
@Override
|
||||
protected void create(String fileName, OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
protected void create(String fileName, BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
var base = new FilePath(model.getCurrentDirectory().getPath());
|
||||
var target = base.join(fileName);
|
||||
var command = CommandBuilder.of()
|
||||
@@ -282,12 +282,12 @@ public abstract class BaseCompressAction implements BrowserAction, BranchAction
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isActive(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return model.getCache().getMultiPurposeCache().containsKey("7zExecutable");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isApplicable(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return model.getFileSystem().getShell().orElseThrow().getOsType() == OsType.WINDOWS;
|
||||
}
|
||||
}
|
||||
@@ -301,7 +301,7 @@ public abstract class BaseCompressAction implements BrowserAction, BranchAction
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void create(String fileName, OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
protected void create(String fileName, BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
var tar = CommandBuilder.of()
|
||||
.add("tar", "-c")
|
||||
.addIf(gz, "-z")
|
||||
@@ -331,12 +331,12 @@ public abstract class BaseCompressAction implements BrowserAction, BranchAction
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isActive(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return model.getCache().getInstalledApplications().get("tar");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isApplicable(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return model.getFileSystem().getShell().orElseThrow().getOsType() != OsType.WINDOWS || !directory;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package io.xpipe.ext.base.browser.compress;
|
||||
|
||||
import io.xpipe.app.browser.action.ApplicationPathAction;
|
||||
import io.xpipe.app.browser.action.LeafAction;
|
||||
import io.xpipe.app.browser.action.BrowserApplicationPathAction;
|
||||
import io.xpipe.app.browser.action.BrowserLeafAction;
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
|
||||
import io.xpipe.app.browser.icon.BrowserIconFileType;
|
||||
import io.xpipe.app.browser.icon.BrowserIcons;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
@@ -15,7 +15,7 @@ import javafx.scene.Node;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BaseUntarAction implements ApplicationPathAction, LeafAction {
|
||||
public class BaseUntarAction implements BrowserApplicationPathAction, BrowserLeafAction {
|
||||
|
||||
private final boolean gz;
|
||||
private final boolean toDirectory;
|
||||
@@ -26,7 +26,7 @@ public class BaseUntarAction implements ApplicationPathAction, LeafAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getIcon(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public Node getIcon(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return BrowserIcons.createIcon(BrowserIconFileType.byId("zip")).createRegion();
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class BaseUntarAction implements ApplicationPathAction, LeafAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) throws Exception {
|
||||
public void execute(BrowserFileSystemTabModel model, List<BrowserEntry> entries) throws Exception {
|
||||
model.runAsync(
|
||||
() -> {
|
||||
ShellControl sc = model.getFileSystem().getShell().orElseThrow();
|
||||
@@ -66,7 +66,7 @@ public class BaseUntarAction implements ApplicationPathAction, LeafAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
var sep = model.getFileSystem().getShell().orElseThrow().getOsType().getFileSystemSeparator();
|
||||
var dir = entries.size() > 1 ? "[...]" : getTarget(entries.getFirst().getFileName()) + sep;
|
||||
return toDirectory ? AppI18n.observable("untarDirectory", dir) : AppI18n.observable("untarHere");
|
||||
@@ -77,7 +77,7 @@ public class BaseUntarAction implements ApplicationPathAction, LeafAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isApplicable(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
if (gz) {
|
||||
return entries.stream()
|
||||
.allMatch(entry -> entry.getRawFileEntry().getPath().endsWith(".tar.gz")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package io.xpipe.ext.base.browser.compress;
|
||||
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
|
||||
import io.xpipe.app.browser.icon.BrowserIconFileType;
|
||||
import io.xpipe.app.browser.icon.BrowserIcons;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
@@ -23,7 +23,7 @@ public abstract class BaseUnzipUnixAction extends ExecuteApplicationAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getIcon(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public Node getIcon(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return BrowserIcons.createIcon(BrowserIconFileType.byId("zip")).createRegion();
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public abstract class BaseUnzipUnixAction extends ExecuteApplicationAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CommandBuilder createCommand(OpenFileSystemModel model, BrowserEntry entry) {
|
||||
protected CommandBuilder createCommand(BrowserFileSystemTabModel model, BrowserEntry entry) {
|
||||
var command = CommandBuilder.of()
|
||||
.add("unzip", "-o")
|
||||
.addFile(entry.getRawFileEntry().getPath());
|
||||
@@ -54,7 +54,7 @@ public abstract class BaseUnzipUnixAction extends ExecuteApplicationAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
var sep = model.getFileSystem().getShell().orElseThrow().getOsType().getFileSystemSeparator();
|
||||
var dir = entries.size() > 1 ? "[...]" : getTarget(entries.getFirst().getFileName()) + sep;
|
||||
return toDirectory ? AppI18n.observable("unzipDirectory", dir) : AppI18n.observable("unzipHere");
|
||||
@@ -65,7 +65,7 @@ public abstract class BaseUnzipUnixAction extends ExecuteApplicationAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isApplicable(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return entries.stream()
|
||||
.allMatch(entry -> entry.getRawFileEntry().getPath().endsWith(".zip"))
|
||||
&& !model.getFileSystem().getShell().orElseThrow().getOsType().equals(OsType.WINDOWS);
|
||||
|
||||
+8
-8
@@ -1,8 +1,8 @@
|
||||
package io.xpipe.ext.base.browser.compress;
|
||||
|
||||
import io.xpipe.app.browser.action.LeafAction;
|
||||
import io.xpipe.app.browser.action.BrowserLeafAction;
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
|
||||
import io.xpipe.app.browser.icon.BrowserIconFileType;
|
||||
import io.xpipe.app.browser.icon.BrowserIcons;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
@@ -16,7 +16,7 @@ import javafx.scene.Node;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class BaseUnzipWindowsAction implements LeafAction {
|
||||
public abstract class BaseUnzipWindowsAction implements BrowserLeafAction {
|
||||
|
||||
private final boolean toDirectory;
|
||||
|
||||
@@ -25,12 +25,12 @@ public abstract class BaseUnzipWindowsAction implements LeafAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node getIcon(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public Node getIcon(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return BrowserIcons.createIcon(BrowserIconFileType.byId("zip")).createRegion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) throws Exception {
|
||||
public void execute(BrowserFileSystemTabModel model, List<BrowserEntry> entries) throws Exception {
|
||||
model.runAsync(
|
||||
() -> {
|
||||
var sc = model.getFileSystem().getShell().orElseThrow();
|
||||
@@ -49,7 +49,7 @@ public abstract class BaseUnzipWindowsAction implements LeafAction {
|
||||
true);
|
||||
}
|
||||
|
||||
private void runCommand(ShellControl sc, OpenFileSystemModel model, BrowserEntry entry) throws Exception {
|
||||
private void runCommand(ShellControl sc, BrowserFileSystemTabModel model, BrowserEntry entry) throws Exception {
|
||||
var command = CommandBuilder.of().add("Expand-Archive", "-Force");
|
||||
if (toDirectory) {
|
||||
var target = getTarget(entry.getRawFileEntry().getPath());
|
||||
@@ -67,7 +67,7 @@ public abstract class BaseUnzipWindowsAction implements LeafAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
var sep = model.getFileSystem().getShell().orElseThrow().getOsType().getFileSystemSeparator();
|
||||
var dir = entries.size() > 1 ? "[...]" : getTarget(entries.getFirst().getFileName()) + sep;
|
||||
return toDirectory ? AppI18n.observable("unzipDirectory", dir) : AppI18n.observable("unzipHere");
|
||||
@@ -78,7 +78,7 @@ public abstract class BaseUnzipWindowsAction implements LeafAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public boolean isApplicable(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return entries.stream()
|
||||
.allMatch(entry -> entry.getRawFileEntry().getPath().endsWith(".zip"))
|
||||
&& model.getFileSystem().getShell().orElseThrow().getOsType().equals(OsType.WINDOWS);
|
||||
|
||||
+5
-5
@@ -1,10 +1,10 @@
|
||||
package io.xpipe.ext.base.desktop;
|
||||
|
||||
import io.xpipe.app.browser.session.BrowserSessionModel;
|
||||
import io.xpipe.app.browser.BrowserFullSessionModel;
|
||||
import io.xpipe.app.comp.store.StoreChoiceComp;
|
||||
import io.xpipe.app.comp.store.StoreEntryWrapper;
|
||||
import io.xpipe.app.comp.store.StoreViewState;
|
||||
import io.xpipe.app.ext.*;
|
||||
import io.xpipe.app.fxcomps.impl.DataStoreChoiceComp;
|
||||
import io.xpipe.app.storage.ContextualFileReference;
|
||||
import io.xpipe.app.storage.DataStoreEntry;
|
||||
import io.xpipe.app.util.DataStoreFormatter;
|
||||
@@ -27,7 +27,7 @@ public class DesktopApplicationStoreProvider implements DataStoreProvider {
|
||||
|
||||
@Override
|
||||
public ActionProvider.Action browserAction(
|
||||
BrowserSessionModel sessionModel, DataStoreEntry store, BooleanProperty busy) {
|
||||
BrowserFullSessionModel sessionModel, DataStoreEntry store, BooleanProperty busy) {
|
||||
return launchAction(store);
|
||||
}
|
||||
|
||||
@@ -68,8 +68,8 @@ public class DesktopApplicationStoreProvider implements DataStoreProvider {
|
||||
return new OptionsBuilder()
|
||||
.nameAndDescription("desktopBase")
|
||||
.addComp(
|
||||
new DataStoreChoiceComp<>(
|
||||
DataStoreChoiceComp.Mode.HOST,
|
||||
new StoreChoiceComp<>(
|
||||
StoreChoiceComp.Mode.HOST,
|
||||
entry,
|
||||
host,
|
||||
DesktopBaseStore.class,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package io.xpipe.ext.base.desktop;
|
||||
|
||||
import io.xpipe.app.browser.session.BrowserSessionModel;
|
||||
import io.xpipe.app.browser.BrowserFullSessionModel;
|
||||
import io.xpipe.app.comp.base.IntegratedTextAreaComp;
|
||||
import io.xpipe.app.comp.store.StoreChoiceComp;
|
||||
import io.xpipe.app.comp.store.StoreEntryWrapper;
|
||||
import io.xpipe.app.comp.store.StoreViewState;
|
||||
import io.xpipe.app.ext.*;
|
||||
import io.xpipe.app.fxcomps.impl.DataStoreChoiceComp;
|
||||
import io.xpipe.app.storage.DataStoreEntry;
|
||||
import io.xpipe.app.util.DataStoreFormatter;
|
||||
import io.xpipe.app.util.OptionsBuilder;
|
||||
@@ -28,7 +28,7 @@ public class DesktopCommandStoreProvider implements DataStoreProvider {
|
||||
|
||||
@Override
|
||||
public ActionProvider.Action browserAction(
|
||||
BrowserSessionModel sessionModel, DataStoreEntry store, BooleanProperty busy) {
|
||||
BrowserFullSessionModel sessionModel, DataStoreEntry store, BooleanProperty busy) {
|
||||
return launchAction(store);
|
||||
}
|
||||
|
||||
@@ -68,8 +68,8 @@ public class DesktopCommandStoreProvider implements DataStoreProvider {
|
||||
return new OptionsBuilder()
|
||||
.nameAndDescription("desktopEnvironmentBase")
|
||||
.addComp(
|
||||
new DataStoreChoiceComp<>(
|
||||
DataStoreChoiceComp.Mode.HOST,
|
||||
new StoreChoiceComp<>(
|
||||
StoreChoiceComp.Mode.HOST,
|
||||
entry,
|
||||
env,
|
||||
DesktopEnvironmentStore.class,
|
||||
|
||||
@@ -2,6 +2,7 @@ package io.xpipe.ext.base.desktop;
|
||||
|
||||
import io.xpipe.app.storage.DataStoreEntryRef;
|
||||
import io.xpipe.app.terminal.ExternalTerminalType;
|
||||
import io.xpipe.app.terminal.TerminalLaunchConfiguration;
|
||||
import io.xpipe.app.util.Validators;
|
||||
import io.xpipe.core.process.OsType;
|
||||
import io.xpipe.core.process.ShellDialect;
|
||||
@@ -99,7 +100,7 @@ public class DesktopEnvironmentStore extends JacksonizedValue
|
||||
.createScript(
|
||||
dialect,
|
||||
dialect.prepareTerminalInitFileOpenCommand(dialect, null, scriptFile.toString(), false));
|
||||
var launchConfig = new ExternalTerminalType.LaunchConfiguration(null, name, name, launchScriptFile, dialect);
|
||||
var launchConfig = new TerminalLaunchConfiguration(null, name, name, true, launchScriptFile, dialect);
|
||||
base.getStore().runDesktopScript(name, launchCommand.apply(launchConfig));
|
||||
}
|
||||
|
||||
|
||||
+9
-9
@@ -1,15 +1,15 @@
|
||||
package io.xpipe.ext.base.desktop;
|
||||
|
||||
import io.xpipe.app.browser.session.BrowserSessionModel;
|
||||
import io.xpipe.app.browser.BrowserFullSessionModel;
|
||||
import io.xpipe.app.comp.Comp;
|
||||
import io.xpipe.app.comp.base.ChoiceComp;
|
||||
import io.xpipe.app.comp.base.IntegratedTextAreaComp;
|
||||
import io.xpipe.app.comp.store.StoreChoiceComp;
|
||||
import io.xpipe.app.comp.store.StoreEntryWrapper;
|
||||
import io.xpipe.app.comp.store.StoreListChoiceComp;
|
||||
import io.xpipe.app.comp.store.StoreViewState;
|
||||
import io.xpipe.app.core.AppExtensionManager;
|
||||
import io.xpipe.app.ext.*;
|
||||
import io.xpipe.app.fxcomps.Comp;
|
||||
import io.xpipe.app.fxcomps.impl.ChoiceComp;
|
||||
import io.xpipe.app.fxcomps.impl.DataStoreChoiceComp;
|
||||
import io.xpipe.app.fxcomps.impl.DataStoreListChoiceComp;
|
||||
import io.xpipe.app.storage.DataStoreEntry;
|
||||
import io.xpipe.app.terminal.ExternalTerminalType;
|
||||
import io.xpipe.app.util.DataStoreFormatter;
|
||||
@@ -35,7 +35,7 @@ public class DesktopEnvironmentStoreProvider implements DataStoreProvider {
|
||||
|
||||
@Override
|
||||
public ActionProvider.Action browserAction(
|
||||
BrowserSessionModel sessionModel, DataStoreEntry store, BooleanProperty busy) {
|
||||
BrowserFullSessionModel sessionModel, DataStoreEntry store, BooleanProperty busy) {
|
||||
return launchAction(store);
|
||||
}
|
||||
|
||||
@@ -110,8 +110,8 @@ public class DesktopEnvironmentStoreProvider implements DataStoreProvider {
|
||||
return new OptionsBuilder()
|
||||
.nameAndDescription("desktopHost")
|
||||
.addComp(
|
||||
new DataStoreChoiceComp<>(
|
||||
DataStoreChoiceComp.Mode.HOST,
|
||||
new StoreChoiceComp<>(
|
||||
StoreChoiceComp.Mode.HOST,
|
||||
entry,
|
||||
host,
|
||||
DesktopBaseStore.class,
|
||||
@@ -132,7 +132,7 @@ public class DesktopEnvironmentStoreProvider implements DataStoreProvider {
|
||||
.nonNull()
|
||||
.nameAndDescription("desktopSnippets")
|
||||
.addComp(
|
||||
new DataStoreListChoiceComp<>(
|
||||
new StoreListChoiceComp<>(
|
||||
scripts,
|
||||
ScriptStore.class,
|
||||
scriptStore -> !scripts.contains(scriptStore),
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package io.xpipe.ext.base.script;
|
||||
|
||||
import io.xpipe.app.browser.action.BranchAction;
|
||||
import io.xpipe.app.browser.BrowserFullSessionModel;
|
||||
import io.xpipe.app.browser.action.BrowserAction;
|
||||
import io.xpipe.app.browser.action.LeafAction;
|
||||
import io.xpipe.app.browser.action.BrowserBranchAction;
|
||||
import io.xpipe.app.browser.action.BrowserLeafAction;
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.fs.OpenFileSystemModel;
|
||||
import io.xpipe.app.browser.session.BrowserSessionModel;
|
||||
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
|
||||
import io.xpipe.app.comp.store.StoreViewState;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.app.core.AppLayoutModel;
|
||||
@@ -23,10 +23,10 @@ import org.kordamp.ikonli.javafx.FontIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class RunScriptAction implements BrowserAction, BranchAction {
|
||||
public class RunScriptAction implements BrowserAction, BrowserBranchAction {
|
||||
|
||||
@Override
|
||||
public Node getIcon(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public Node getIcon(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return new FontIcon("mdi2c-code-greater-than");
|
||||
}
|
||||
|
||||
@@ -36,28 +36,29 @@ public class RunScriptAction implements BrowserAction, BranchAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return AppI18n.observable("runScript");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
return model.getBrowserModel() instanceof BrowserSessionModel;
|
||||
public boolean isApplicable(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return model.getBrowserModel() instanceof BrowserFullSessionModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends BrowserAction> getBranchingActions(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public List<? extends BrowserAction> getBranchingActions(
|
||||
BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
var actions = createActionForScriptHierarchy(model, entries);
|
||||
if (actions.isEmpty()) {
|
||||
actions = List.of(new LeafAction() {
|
||||
actions = List.of(new BrowserLeafAction() {
|
||||
@Override
|
||||
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) throws Exception {
|
||||
public void execute(BrowserFileSystemTabModel model, List<BrowserEntry> entries) throws Exception {
|
||||
StoreViewState.get().getAllScriptsCategory().select();
|
||||
AppLayoutModel.get().selectConnections();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return AppI18n.observable("noScriptsAvailable");
|
||||
}
|
||||
});
|
||||
@@ -66,7 +67,7 @@ public class RunScriptAction implements BrowserAction, BranchAction {
|
||||
}
|
||||
|
||||
private List<? extends BrowserAction> createActionForScriptHierarchy(
|
||||
OpenFileSystemModel model, List<BrowserEntry> selected) {
|
||||
BrowserFileSystemTabModel model, List<BrowserEntry> selected) {
|
||||
var sc = model.getFileSystem().getShell().orElseThrow();
|
||||
var hierarchy = ScriptHierarchy.buildEnabledHierarchy(ref -> {
|
||||
if (!ref.getStore().isFileScript()) {
|
||||
@@ -81,7 +82,8 @@ public class RunScriptAction implements BrowserAction, BranchAction {
|
||||
return createActionForScriptHierarchy(model, hierarchy).getBranchingActions(model, selected);
|
||||
}
|
||||
|
||||
private BranchAction createActionForScriptHierarchy(OpenFileSystemModel model, ScriptHierarchy hierarchy) {
|
||||
private BrowserBranchAction createActionForScriptHierarchy(
|
||||
BrowserFileSystemTabModel model, ScriptHierarchy hierarchy) {
|
||||
if (hierarchy.isLeaf()) {
|
||||
return createActionForScript(model, hierarchy.getLeafBase());
|
||||
}
|
||||
@@ -89,33 +91,34 @@ public class RunScriptAction implements BrowserAction, BranchAction {
|
||||
var list = hierarchy.getChildren().stream()
|
||||
.map(c -> createActionForScriptHierarchy(model, c))
|
||||
.toList();
|
||||
return new BranchAction() {
|
||||
return new BrowserBranchAction() {
|
||||
@Override
|
||||
public List<? extends BrowserAction> getBranchingActions(
|
||||
OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
var b = hierarchy.getBase();
|
||||
return new SimpleStringProperty(b != null ? b.get().getName() : null);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private BranchAction createActionForScript(OpenFileSystemModel model, DataStoreEntryRef<SimpleScriptStore> ref) {
|
||||
private BrowserBranchAction createActionForScript(
|
||||
BrowserFileSystemTabModel model, DataStoreEntryRef<SimpleScriptStore> ref) {
|
||||
return new MultiExecuteSelectionAction() {
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
|
||||
public ObservableValue<String> getName(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return new SimpleStringProperty(ref.get().getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CommandBuilder createCommand(
|
||||
ShellControl sc, OpenFileSystemModel model, List<BrowserEntry> selected) {
|
||||
if (!(model.getBrowserModel() instanceof BrowserSessionModel)) {
|
||||
ShellControl sc, BrowserFileSystemTabModel model, List<BrowserEntry> selected) {
|
||||
if (!(model.getBrowserModel() instanceof BrowserFullSessionModel)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
package io.xpipe.ext.base.script;
|
||||
|
||||
import io.xpipe.app.comp.base.SystemStateComp;
|
||||
import io.xpipe.app.comp.store.StoreEntryWrapper;
|
||||
import io.xpipe.app.comp.store.StoreSection;
|
||||
import io.xpipe.app.comp.store.StoreViewState;
|
||||
import io.xpipe.app.comp.Comp;
|
||||
import io.xpipe.app.comp.store.*;
|
||||
import io.xpipe.app.ext.*;
|
||||
import io.xpipe.app.fxcomps.Comp;
|
||||
import io.xpipe.app.fxcomps.impl.DataStoreChoiceComp;
|
||||
import io.xpipe.app.storage.DataStoreEntry;
|
||||
import io.xpipe.app.util.OptionsBuilder;
|
||||
import io.xpipe.core.store.DataStore;
|
||||
@@ -57,8 +53,8 @@ public class ScriptGroupStoreProvider implements EnabledParentStoreProvider, Dat
|
||||
.name("scriptGroup")
|
||||
.description("scriptGroupDescription")
|
||||
.addComp(
|
||||
new DataStoreChoiceComp<>(
|
||||
DataStoreChoiceComp.Mode.OTHER,
|
||||
new StoreChoiceComp<>(
|
||||
StoreChoiceComp.Mode.OTHER,
|
||||
entry,
|
||||
group,
|
||||
ScriptGroupStore.class,
|
||||
|
||||
@@ -1,19 +1,15 @@
|
||||
package io.xpipe.ext.base.script;
|
||||
|
||||
import io.xpipe.app.comp.Comp;
|
||||
import io.xpipe.app.comp.base.IntegratedTextAreaComp;
|
||||
import io.xpipe.app.comp.base.ListSelectorComp;
|
||||
import io.xpipe.app.comp.base.SystemStateComp;
|
||||
import io.xpipe.app.comp.store.StoreEntryWrapper;
|
||||
import io.xpipe.app.comp.store.StoreViewState;
|
||||
import io.xpipe.app.comp.store.*;
|
||||
import io.xpipe.app.core.AppExtensionManager;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.app.ext.DataStoreCreationCategory;
|
||||
import io.xpipe.app.ext.DataStoreProvider;
|
||||
import io.xpipe.app.ext.EnabledParentStoreProvider;
|
||||
import io.xpipe.app.ext.GuiDialog;
|
||||
import io.xpipe.app.fxcomps.Comp;
|
||||
import io.xpipe.app.fxcomps.impl.DataStoreChoiceComp;
|
||||
import io.xpipe.app.fxcomps.impl.DataStoreListChoiceComp;
|
||||
import io.xpipe.app.storage.DataStoreEntry;
|
||||
import io.xpipe.app.util.DataStoreFormatter;
|
||||
import io.xpipe.app.util.MarkdownBuilder;
|
||||
@@ -152,7 +148,7 @@ public class SimpleScriptStoreProvider implements EnabledParentStoreProvider, Da
|
||||
.description("snippetsDescription")
|
||||
.longDescription("base:scriptDependencies")
|
||||
.addComp(
|
||||
new DataStoreListChoiceComp<>(
|
||||
new StoreListChoiceComp<>(
|
||||
others,
|
||||
ScriptStore.class,
|
||||
scriptStore -> !scriptStore.get().equals(entry) && !others.contains(scriptStore),
|
||||
@@ -181,8 +177,8 @@ public class SimpleScriptStoreProvider implements EnabledParentStoreProvider, Da
|
||||
.name("scriptGroup")
|
||||
.description("scriptGroupDescription")
|
||||
.addComp(
|
||||
new DataStoreChoiceComp<>(
|
||||
DataStoreChoiceComp.Mode.OTHER,
|
||||
new StoreChoiceComp<>(
|
||||
StoreChoiceComp.Mode.OTHER,
|
||||
null,
|
||||
group,
|
||||
ScriptGroupStore.class,
|
||||
|
||||
+2
-7
@@ -1,15 +1,10 @@
|
||||
package io.xpipe.ext.base.service;
|
||||
|
||||
import io.xpipe.app.comp.base.StoreToggleComp;
|
||||
import io.xpipe.app.comp.base.SystemStateComp;
|
||||
import io.xpipe.app.comp.store.StoreEntryComp;
|
||||
import io.xpipe.app.comp.store.StoreEntryWrapper;
|
||||
import io.xpipe.app.comp.store.StoreSection;
|
||||
import io.xpipe.app.comp.store.StoreViewState;
|
||||
import io.xpipe.app.comp.Comp;
|
||||
import io.xpipe.app.comp.store.*;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.app.ext.DataStoreProvider;
|
||||
import io.xpipe.app.ext.DataStoreUsageCategory;
|
||||
import io.xpipe.app.fxcomps.Comp;
|
||||
import io.xpipe.app.prefs.AppPrefs;
|
||||
import io.xpipe.app.storage.DataStorage;
|
||||
import io.xpipe.app.storage.DataStoreEntry;
|
||||
|
||||
@@ -4,7 +4,10 @@ import io.xpipe.app.storage.DataStoreEntryRef;
|
||||
import io.xpipe.app.util.HostHelper;
|
||||
import io.xpipe.app.util.LicenseProvider;
|
||||
import io.xpipe.app.util.Validators;
|
||||
import io.xpipe.core.store.*;
|
||||
import io.xpipe.core.store.DataStore;
|
||||
import io.xpipe.core.store.NetworkTunnelSession;
|
||||
import io.xpipe.core.store.NetworkTunnelStore;
|
||||
import io.xpipe.core.store.SingletonSessionStore;
|
||||
import io.xpipe.core.util.JacksonizedValue;
|
||||
|
||||
import lombok.Getter;
|
||||
@@ -35,7 +38,7 @@ public abstract class AbstractServiceStore extends JacksonizedValue
|
||||
public NetworkTunnelSession newSession() throws Exception {
|
||||
LicenseProvider.get().getFeature("services").throwIfUnsupported();
|
||||
var l = localPort != null ? localPort : HostHelper.findRandomOpenPortOnAllLocalInterfaces();
|
||||
return getHost().getStore().sessionChain(l, remotePort);
|
||||
return getHost().getStore().sessionChain(l, remotePort, "localhost");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
package io.xpipe.ext.base.service;
|
||||
|
||||
import io.xpipe.app.comp.base.SystemStateComp;
|
||||
import io.xpipe.app.comp.store.DenseStoreEntryComp;
|
||||
import io.xpipe.app.comp.store.StoreEntryComp;
|
||||
import io.xpipe.app.comp.store.StoreEntryWrapper;
|
||||
import io.xpipe.app.comp.store.StoreSection;
|
||||
import io.xpipe.app.comp.Comp;
|
||||
import io.xpipe.app.comp.store.*;
|
||||
import io.xpipe.app.ext.ActionProvider;
|
||||
import io.xpipe.app.ext.DataStoreProvider;
|
||||
import io.xpipe.app.ext.DataStoreUsageCategory;
|
||||
import io.xpipe.app.ext.SingletonSessionStoreProvider;
|
||||
import io.xpipe.app.fxcomps.Comp;
|
||||
import io.xpipe.app.storage.DataStorage;
|
||||
import io.xpipe.app.storage.DataStoreEntry;
|
||||
import io.xpipe.app.util.DataStoreFormatter;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package io.xpipe.ext.base.service;
|
||||
|
||||
import io.xpipe.app.comp.store.StoreChoiceComp;
|
||||
import io.xpipe.app.comp.store.StoreViewState;
|
||||
import io.xpipe.app.ext.DataStoreCreationCategory;
|
||||
import io.xpipe.app.ext.GuiDialog;
|
||||
import io.xpipe.app.fxcomps.impl.DataStoreChoiceComp;
|
||||
import io.xpipe.app.storage.DataStoreEntry;
|
||||
import io.xpipe.app.util.OptionsBuilder;
|
||||
import io.xpipe.core.store.DataStore;
|
||||
@@ -36,7 +36,7 @@ public class CustomServiceStoreProvider extends AbstractServiceStoreProvider {
|
||||
var q = new OptionsBuilder()
|
||||
.nameAndDescription("serviceHost")
|
||||
.addComp(
|
||||
DataStoreChoiceComp.other(
|
||||
StoreChoiceComp.other(
|
||||
host,
|
||||
NetworkTunnelStore.class,
|
||||
n -> n.getStore().isLocallyTunneable(),
|
||||
|
||||
@@ -5,7 +5,6 @@ import io.xpipe.app.util.FixedHierarchyStore;
|
||||
import io.xpipe.app.util.Validators;
|
||||
import io.xpipe.core.store.DataStore;
|
||||
import io.xpipe.core.store.FixedChildStore;
|
||||
import io.xpipe.core.store.ValidationContext;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import lombok.AccessLevel;
|
||||
@@ -22,7 +21,7 @@ import java.util.List;
|
||||
@Jacksonized
|
||||
@JsonTypeName("fixedServiceGroup")
|
||||
public class FixedServiceGroupStore extends AbstractServiceGroupStore<FixedServiceCreatorStore>
|
||||
implements DataStore, FixedHierarchyStore<ValidationContext<?>> {
|
||||
implements DataStore, FixedHierarchyStore {
|
||||
|
||||
@Override
|
||||
public void checkComplete() throws Throwable {
|
||||
@@ -32,14 +31,8 @@ public class FixedServiceGroupStore extends AbstractServiceGroupStore<FixedServi
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<? extends DataStoreEntryRef<? extends FixedChildStore>> listChildren(ValidationContext<?> context)
|
||||
throws Exception {
|
||||
public List<? extends DataStoreEntryRef<? extends FixedChildStore>> listChildren() throws Exception {
|
||||
return (List<? extends DataStoreEntryRef<? extends FixedChildStore>>)
|
||||
getParent().getStore().createFixedServices();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValidationContext<?> createContext() throws Exception {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,22 +1,18 @@
|
||||
package io.xpipe.ext.base.store;
|
||||
|
||||
import io.xpipe.app.browser.session.BrowserSessionModel;
|
||||
import io.xpipe.app.comp.base.OsLogoComp;
|
||||
import io.xpipe.app.comp.base.SystemStateComp;
|
||||
import io.xpipe.app.browser.BrowserFullSessionModel;
|
||||
import io.xpipe.app.comp.Comp;
|
||||
import io.xpipe.app.comp.store.OsLogoComp;
|
||||
import io.xpipe.app.comp.store.StoreEntryWrapper;
|
||||
import io.xpipe.app.comp.store.StoreSection;
|
||||
import io.xpipe.app.ext.ActionProvider;
|
||||
import io.xpipe.app.ext.DataStoreProvider;
|
||||
import io.xpipe.app.ext.DataStoreUsageCategory;
|
||||
import io.xpipe.app.ext.ProcessControlProvider;
|
||||
import io.xpipe.app.fxcomps.Comp;
|
||||
import io.xpipe.app.comp.store.SystemStateComp;
|
||||
import io.xpipe.app.ext.*;
|
||||
import io.xpipe.app.resources.SystemIcons;
|
||||
import io.xpipe.app.storage.DataStorage;
|
||||
import io.xpipe.app.storage.DataStoreEntry;
|
||||
import io.xpipe.app.util.DataStoreFormatter;
|
||||
import io.xpipe.app.util.TerminalLauncher;
|
||||
import io.xpipe.app.terminal.TerminalLauncher;
|
||||
import io.xpipe.app.util.ShellStoreFormat;
|
||||
import io.xpipe.core.process.ShellStoreState;
|
||||
import io.xpipe.core.store.ShellStore;
|
||||
import io.xpipe.ext.base.script.ScriptStore;
|
||||
|
||||
import javafx.beans.property.BooleanProperty;
|
||||
@@ -31,7 +27,7 @@ public interface ShellStoreProvider extends DataStoreProvider {
|
||||
public void execute() throws Exception {
|
||||
var replacement = ProcessControlProvider.get().replace(entry.ref());
|
||||
ShellStore store = replacement.getStore().asNeeded();
|
||||
var control = ScriptStore.controlWithDefaultScripts(store.control());
|
||||
var control = ScriptStore.controlWithDefaultScripts(store.tempControl());
|
||||
control.onInit(sc -> {
|
||||
if (entry.getStorePersistentState() instanceof ShellStoreState shellStoreState
|
||||
&& shellStoreState.getShellDialect() == null) {
|
||||
@@ -52,7 +48,7 @@ public interface ShellStoreProvider extends DataStoreProvider {
|
||||
|
||||
@Override
|
||||
default ActionProvider.Action browserAction(
|
||||
BrowserSessionModel sessionModel, DataStoreEntry store, BooleanProperty busy) {
|
||||
BrowserFullSessionModel sessionModel, DataStoreEntry store, BooleanProperty busy) {
|
||||
return new ActionProvider.Action() {
|
||||
@Override
|
||||
public void execute() {
|
||||
@@ -72,6 +68,6 @@ public interface ShellStoreProvider extends DataStoreProvider {
|
||||
|
||||
@Override
|
||||
default ObservableValue<String> informationString(StoreSection section) {
|
||||
return DataStoreFormatter.shellInformation(section.getWrapper());
|
||||
return ShellStoreFormat.shellStore(section, state -> null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package io.xpipe.ext.base.store;
|
||||
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.app.ext.ActionProvider;
|
||||
import io.xpipe.app.storage.DataStoreEntryRef;
|
||||
import io.xpipe.core.store.DataStore;
|
||||
|
||||
import javafx.beans.value.ObservableValue;
|
||||
|
||||
import lombok.Value;
|
||||
|
||||
public class StoreRestartAction implements ActionProvider {
|
||||
|
||||
@Override
|
||||
public LeafDataStoreCallSite<?> getLeafDataStoreCallSite() {
|
||||
return new LeafDataStoreCallSite<DataStore>() {
|
||||
|
||||
@Override
|
||||
public ActionProvider.Action createAction(DataStoreEntryRef<DataStore> store) {
|
||||
return new Action(store);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<DataStore> getApplicableClass() {
|
||||
return DataStore.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> getName(DataStoreEntryRef<DataStore> store) {
|
||||
return AppI18n.observable("restart");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIcon(DataStoreEntryRef<DataStore> store) {
|
||||
return "mdi2r-restart";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresValidStore() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(DataStoreEntryRef<DataStore> o) {
|
||||
return o.getStore() instanceof StartableStore && o.getStore() instanceof StoppableStore;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Value
|
||||
static class Action implements ActionProvider.Action {
|
||||
|
||||
DataStoreEntryRef<DataStore> entry;
|
||||
|
||||
@Override
|
||||
public void execute() throws Exception {
|
||||
((StoppableStore) entry.getStore()).stop();
|
||||
((StartableStore) entry.getStore()).start();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import io.xpipe.ext.base.desktop.DesktopEnvironmentStoreProvider;
|
||||
import io.xpipe.ext.base.script.*;
|
||||
import io.xpipe.ext.base.service.*;
|
||||
import io.xpipe.ext.base.store.StorePauseAction;
|
||||
import io.xpipe.ext.base.store.StoreRestartAction;
|
||||
import io.xpipe.ext.base.store.StoreStartAction;
|
||||
import io.xpipe.ext.base.store.StoreStopAction;
|
||||
|
||||
@@ -76,6 +77,7 @@ open module io.xpipe.ext.base {
|
||||
StoreStopAction,
|
||||
StoreStartAction,
|
||||
StorePauseAction,
|
||||
StoreRestartAction,
|
||||
ServiceOpenAction,
|
||||
ServiceOpenHttpAction,
|
||||
ServiceOpenHttpsAction,
|
||||
@@ -86,6 +88,7 @@ open module io.xpipe.ext.base {
|
||||
LaunchStoreAction,
|
||||
XPipeUrlAction,
|
||||
EditStoreAction,
|
||||
EditScriptStoreAction,
|
||||
BrowseStoreAction,
|
||||
ScanStoreAction,
|
||||
ChangeStoreIconAction;
|
||||
|
||||
Reference in new issue
Block a user