Skip to content

Commit 41f71d4

Browse files
committed
Rework launchable stores
1 parent 9b7cca8 commit 41f71d4

File tree

6 files changed

+8
-64
lines changed

6 files changed

+8
-64
lines changed

core/src/main/java/io/xpipe/core/process/ShellTtyState.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public enum ShellTtyState {
99
@JsonProperty("none")
1010
NONE(true, false, false, true, true),
1111
@JsonProperty("merged")
12-
MERGED_STDERR(false, false, false, false, true),
12+
MERGED_STDERR(false, true, false, false, false),
1313
@JsonProperty("pty")
1414
PTY_ALLOCATED(false, true, true, false, false);
1515

core/src/main/java/io/xpipe/core/store/LaunchableStore.java

-6
This file was deleted.

core/src/main/java/io/xpipe/core/store/ShellStore.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import io.xpipe.core.process.ProcessControl;
44
import io.xpipe.core.process.ShellControl;
55

6-
public interface ShellStore extends DataStore, LaunchableStore, FileSystemStore, ValidatableStore {
6+
public interface ShellStore extends DataStore, FileSystemStore, ValidatableStore {
77

88
static boolean isLocal(ShellStore s) {
99
return s instanceof LocalStore;

ext/base/src/main/java/io/xpipe/ext/base/action/LaunchStoreAction.java

+4-39
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,10 @@
22

33
import io.xpipe.app.core.AppI18n;
44
import io.xpipe.app.ext.ActionProvider;
5-
import io.xpipe.app.storage.DataStorage;
6-
import io.xpipe.app.storage.DataStoreEntry;
75
import io.xpipe.app.storage.DataStoreEntryRef;
8-
import io.xpipe.app.util.TerminalLauncher;
96
import io.xpipe.core.store.DataStore;
10-
import io.xpipe.core.store.LaunchableStore;
11-
import io.xpipe.core.store.ShellStore;
12-
import io.xpipe.ext.base.script.ScriptStore;
13-
147
import javafx.beans.value.ObservableValue;
158

16-
import lombok.Value;
17-
189
public class LaunchStoreAction implements ActionProvider {
1910

2011
@Override
@@ -33,7 +24,7 @@ public boolean canLinkTo() {
3324

3425
@Override
3526
public ActionProvider.Action createAction(DataStoreEntryRef<DataStore> store) {
36-
return new Action(store.get());
27+
return store.get().getProvider().launchAction(store.get());
3728
}
3829

3930
@Override
@@ -44,8 +35,7 @@ public Class<DataStore> getApplicableClass() {
4435
@Override
4536
public boolean isApplicable(DataStoreEntryRef<DataStore> o) {
4637
return o.get().getValidity().isUsable()
47-
&& (o.getStore() instanceof LaunchableStore
48-
|| o.get().getProvider().launchAction(o.get()) != null);
38+
&& (o.get().getProvider().launchAction(o.get()) != null);
4939
}
5040

5141
@Override
@@ -66,7 +56,7 @@ public DefaultDataStoreCallSite<?> getDefaultDataStoreCallSite() {
6656

6757
@Override
6858
public ActionProvider.Action createAction(DataStoreEntryRef<DataStore> store) {
69-
return new Action(store.get());
59+
return store.get().getProvider().launchAction(store.get());
7060
}
7161

7262
@Override
@@ -77,33 +67,8 @@ public Class<DataStore> getApplicableClass() {
7767
@Override
7868
public boolean isApplicable(DataStoreEntryRef<DataStore> o) {
7969
return o.get().getValidity().isUsable()
80-
&& (o.getStore() instanceof LaunchableStore
81-
|| o.get().getProvider().launchAction(o.get()) != null);
70+
&& (o.get().getProvider().launchAction(o.get()) != null);
8271
}
8372
};
8473
}
85-
86-
@Value
87-
static class Action implements ActionProvider.Action {
88-
89-
DataStoreEntry entry;
90-
91-
@Override
92-
public void execute() throws Exception {
93-
var storeName = DataStorage.get().getStoreEntryDisplayName(entry);
94-
if (entry.getStore() instanceof ShellStore s) {
95-
TerminalLauncher.open(entry, storeName, null, ScriptStore.controlWithDefaultScripts(s.control()));
96-
return;
97-
}
98-
99-
if (entry.getStore() instanceof LaunchableStore s) {
100-
s.launch();
101-
return;
102-
}
103-
104-
if (entry.getProvider().launchAction(entry) != null) {
105-
entry.getProvider().launchAction(entry).execute();
106-
}
107-
}
108-
}
10974
}

ext/base/src/main/java/io/xpipe/ext/base/action/XPipeUrlAction.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ public Action createAction(List<String> args) throws Exception {
4343
if (!entry.getValidity().isUsable()) {
4444
return null;
4545
}
46-
return new LaunchStoreAction.Action(entry);
46+
var p = entry.getProvider();
47+
return p.launchAction(entry);
4748
}
4849
case "action" -> {
4950
var id = args.get(1);

ext/base/src/main/java/io/xpipe/ext/base/store/LaunchableTerminalStore.java

-16
This file was deleted.

0 commit comments

Comments
 (0)