Show empty script action in browser

This commit is contained in:
crschnick 2024-10-10 15:07:20 +00:00
parent 2680066c7f
commit 89885c11b8
15 changed files with 31 additions and 21 deletions

View file

@ -11,7 +11,6 @@ import javafx.beans.property.Property;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.collections.FXCollections;
import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList;
import lombok.Getter;
@ -35,7 +34,6 @@ public final class BrowserFileListModel {
new SimpleObjectProperty<>(FILE_TYPE_COMPARATOR);
private final Property<List<BrowserEntry>> all = new SimpleObjectProperty<>(new ArrayList<>());
private final Property<List<BrowserEntry>> shown = new SimpleObjectProperty<>(new ArrayList<>());
private final ObservableList<BrowserEntry> previousSelection = FXCollections.observableArrayList();
private final ObservableList<BrowserEntry> selection = FXCollections.observableArrayList();
private final Property<BrowserEntry> draggedOverDirectory = new SimpleObjectProperty<>();
@ -49,10 +47,6 @@ public final class BrowserFileListModel {
fileSystemModel.getFilter().addListener((observable, oldValue, newValue) -> {
refreshShown();
});
selection.addListener((ListChangeListener<? super BrowserEntry>) c -> {
previousSelection.setAll(c.getList());
});
}
public void setAll(Stream<FileEntry> newFiles) {

View file

@ -2,10 +2,13 @@ package io.xpipe.ext.base.script;
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.file.BrowserEntry;
import io.xpipe.app.browser.fs.OpenFileSystemModel;
import io.xpipe.app.browser.session.BrowserSessionModel;
import io.xpipe.app.comp.store.StoreViewState;
import io.xpipe.app.core.AppI18n;
import io.xpipe.app.core.AppLayoutModel;
import io.xpipe.app.storage.DataStoreEntryRef;
import io.xpipe.app.util.ScriptHelper;
import io.xpipe.core.process.CommandBuilder;
@ -39,13 +42,26 @@ public class RunScriptAction implements BrowserAction, BranchAction {
@Override
public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
return model.getBrowserModel() instanceof BrowserSessionModel
&& !createActionForScriptHierarchy(model, entries).isEmpty();
return model.getBrowserModel() instanceof BrowserSessionModel;
}
@Override
public List<? extends BrowserAction> getBranchingActions(OpenFileSystemModel model, List<BrowserEntry> entries) {
var actions = createActionForScriptHierarchy(model, entries);
if (actions.isEmpty()) {
actions = List.of(new LeafAction() {
@Override
public void execute(OpenFileSystemModel model, List<BrowserEntry> entries) throws Exception {
StoreViewState.get().getAllScriptsCategory().select();
AppLayoutModel.get().selectConnections();
}
@Override
public ObservableValue<String> getName(OpenFileSystemModel model, List<BrowserEntry> entries) {
return AppI18n.observable("noScriptsAvailable");
}
});
}
return actions;
}

View file

@ -70,3 +70,4 @@ tryPtb=XPipe Public Test Build
zed=Zed
windowsCredentialManager=Windows credential manager
webtop=Webtop
keeper=Keeper

View file

@ -172,7 +172,7 @@ hasServices=$COUNT$ tilgængelige tjenester
hasService=$COUNT$ tilgængelig tjeneste
openHttp=Åben HTTP-tjeneste
openHttps=Åben HTTPS-tjeneste
noScriptsAvailable=Ingen tilgængelige scripts
noScriptsAvailable=Ingen aktiverede og kompatible scripts tilgængelige
changeIcon=Skift ikon
init=Indlæg
shell=Skal

View file

@ -163,7 +163,7 @@ hasServices=$COUNT$ verfügbare Dienste
hasService=$COUNT$ verfügbarer Dienst
openHttp=Offener HTTP-Dienst
openHttps=HTTPS-Dienst öffnen
noScriptsAvailable=Keine Skripte verfügbar
noScriptsAvailable=Keine aktivierten und kompatiblen Skripte verfügbar
changeIcon=Symbol ändern
init=Init
shell=Shell

View file

@ -161,7 +161,7 @@ hasServices=$COUNT$ available services
hasService=$COUNT$ available service
openHttp=Open HTTP service
openHttps=Open HTTPS service
noScriptsAvailable=No scripts available
noScriptsAvailable=No enabled and compatible scripts available
changeIcon=Change icon
init=Init
shell=Shell
@ -176,4 +176,3 @@ untarDirectory=Untar to $DIR$
unzipDirectory=Unzip to $DIR$
unzipHere=Unzip here

View file

@ -161,7 +161,7 @@ hasServices=$COUNT$ servicios disponibles
hasService=$COUNT$ servicio disponible
openHttp=Servicio HTTP abierto
openHttps=Abrir servicio HTTPS
noScriptsAvailable=No hay guiones disponibles
noScriptsAvailable=No hay scripts habilitados y compatibles
changeIcon=Cambiar icono
init=Init
shell=Shell

View file

@ -161,7 +161,7 @@ hasServices=$COUNT$ services disponibles
hasService=$COUNT$ service disponible
openHttp=Service HTTP ouvert
openHttps=Service HTTPS ouvert
noScriptsAvailable=Pas de scripts disponibles
noScriptsAvailable=Pas de scripts activés et compatibles disponibles
changeIcon=Changer d'icône
init=Init
shell=Coquille

View file

@ -161,7 +161,7 @@ hasServices=$COUNT$ servizi disponibili
hasService=$COUNT$ servizio disponibile
openHttp=Servizio HTTP aperto
openHttps=Servizio HTTPS aperto
noScriptsAvailable=Non sono disponibili script
noScriptsAvailable=Non sono disponibili script abilitati e compatibili
changeIcon=Cambia icona
init=Init
shell=Conchiglia

View file

@ -161,7 +161,7 @@ hasServices=$COUNT$ 利用可能なサービス
hasService=$COUNT$ 利用可能なサービス
openHttp=オープンHTTPサービス
openHttps=HTTPSサービスを開く
noScriptsAvailable=スクリプトはない
noScriptsAvailable=使用可能なスクリプトと互換性のあるスクリプトがない
changeIcon=アイコンの変更
init=イニシャル
shell=シェル

View file

@ -161,7 +161,7 @@ hasServices=$COUNT$ beschikbare diensten
hasService=$COUNT$ beschikbare dienst
openHttp=Open HTTP service
openHttps=Open HTTPS service
noScriptsAvailable=Geen scripts beschikbaar
noScriptsAvailable=Geen ingeschakelde en compatibele scripts beschikbaar
changeIcon=Pictogram wijzigen
init=Init
shell=Shell

View file

@ -161,7 +161,7 @@ hasServices=$COUNT$ serviços disponíveis
hasService=$COUNT$ serviço disponível
openHttp=Abre o serviço HTTP
openHttps=Abre o serviço HTTPS
noScriptsAvailable=Não há scripts disponíveis
noScriptsAvailable=Não há scripts habilitados e compatíveis disponíveis
changeIcon=Altera o ícone
init=Init
shell=Concha

View file

@ -161,7 +161,7 @@ hasServices=$COUNT$ доступные сервисы
hasService=$COUNT$ доступный сервис
openHttp=Открытый HTTP-сервис
openHttps=Открытая служба HTTPS
noScriptsAvailable=Нет доступных скриптов
noScriptsAvailable=Отсутствие включенных и совместимых скриптов
changeIcon=Значок изменения
init=Init
shell=Shell

View file

@ -161,7 +161,7 @@ hasServices=$COUNT$ mevcut hi̇zmetler
hasService=$COUNT$ mevcut hizmet
openHttp=ık HTTP hizmeti
openHttps=HTTPS hizmetini açın
noScriptsAvailable=Mevcut senaryo yok
noScriptsAvailable=Etkin ve uyumlu komut dosyası yok
changeIcon=Simge değiştir
init=Başlangıç
shell=Kabuk

View file

@ -161,7 +161,7 @@ hasServices=$COUNT$ 可用服务
hasService=$COUNT$ 可用服务
openHttp=开放式 HTTP 服务
openHttps=打开 HTTPS 服务
noScriptsAvailable=无脚本可用
noScriptsAvailable=没有启用和兼容的脚本
changeIcon=更改图标
init=启动
shell=外壳