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.SimpleBooleanProperty;
import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.SimpleObjectProperty;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
import lombok.Getter; import lombok.Getter;
@ -35,7 +34,6 @@ public final class BrowserFileListModel {
new SimpleObjectProperty<>(FILE_TYPE_COMPARATOR); new SimpleObjectProperty<>(FILE_TYPE_COMPARATOR);
private final Property<List<BrowserEntry>> all = new SimpleObjectProperty<>(new ArrayList<>()); private final Property<List<BrowserEntry>> all = new SimpleObjectProperty<>(new ArrayList<>());
private final Property<List<BrowserEntry>> shown = 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 ObservableList<BrowserEntry> selection = FXCollections.observableArrayList();
private final Property<BrowserEntry> draggedOverDirectory = new SimpleObjectProperty<>(); private final Property<BrowserEntry> draggedOverDirectory = new SimpleObjectProperty<>();
@ -49,10 +47,6 @@ public final class BrowserFileListModel {
fileSystemModel.getFilter().addListener((observable, oldValue, newValue) -> { fileSystemModel.getFilter().addListener((observable, oldValue, newValue) -> {
refreshShown(); refreshShown();
}); });
selection.addListener((ListChangeListener<? super BrowserEntry>) c -> {
previousSelection.setAll(c.getList());
});
} }
public void setAll(Stream<FileEntry> newFiles) { 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.BranchAction;
import io.xpipe.app.browser.action.BrowserAction; 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.file.BrowserEntry;
import io.xpipe.app.browser.fs.OpenFileSystemModel; import io.xpipe.app.browser.fs.OpenFileSystemModel;
import io.xpipe.app.browser.session.BrowserSessionModel; 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.AppI18n;
import io.xpipe.app.core.AppLayoutModel;
import io.xpipe.app.storage.DataStoreEntryRef; import io.xpipe.app.storage.DataStoreEntryRef;
import io.xpipe.app.util.ScriptHelper; import io.xpipe.app.util.ScriptHelper;
import io.xpipe.core.process.CommandBuilder; import io.xpipe.core.process.CommandBuilder;
@ -39,13 +42,26 @@ public class RunScriptAction implements BrowserAction, BranchAction {
@Override @Override
public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) { public boolean isApplicable(OpenFileSystemModel model, List<BrowserEntry> entries) {
return model.getBrowserModel() instanceof BrowserSessionModel return model.getBrowserModel() instanceof BrowserSessionModel;
&& !createActionForScriptHierarchy(model, entries).isEmpty();
} }
@Override @Override
public List<? extends BrowserAction> getBranchingActions(OpenFileSystemModel model, List<BrowserEntry> entries) { public List<? extends BrowserAction> getBranchingActions(OpenFileSystemModel model, List<BrowserEntry> entries) {
var actions = createActionForScriptHierarchy(model, 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; return actions;
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -161,7 +161,7 @@ hasServices=$COUNT$ serviços disponíveis
hasService=$COUNT$ serviço disponível hasService=$COUNT$ serviço disponível
openHttp=Abre o serviço HTTP openHttp=Abre o serviço HTTP
openHttps=Abre o serviço HTTPS 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 changeIcon=Altera o ícone
init=Init init=Init
shell=Concha shell=Concha

View file

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

View file

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

View file

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