mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-05-04 03:40:32 +00:00
Revert split hub action provider to not be async
This commit is contained in:
@@ -12,17 +12,15 @@ import io.xpipe.app.prefs.AppPrefs;
|
||||
import io.xpipe.app.storage.DataStorage;
|
||||
import io.xpipe.app.storage.DataStoreEntryRef;
|
||||
import io.xpipe.app.terminal.*;
|
||||
import io.xpipe.app.util.ThreadHelper;
|
||||
|
||||
import javafx.beans.value.ObservableValue;
|
||||
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import lombok.extern.jackson.Jacksonized;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
public class OpenSplitHubBatchProvider implements BatchHubProvider<ShellStore> {
|
||||
|
||||
@@ -67,30 +65,21 @@ public class OpenSplitHubBatchProvider implements BatchHubProvider<ShellStore> {
|
||||
throw ErrorEventFactory.expected(new IllegalStateException(AppI18n.get("noTerminalSet")));
|
||||
}
|
||||
|
||||
var latch = new CountDownLatch(getRefs().size());
|
||||
var panes = new TerminalLauncher.Config[getRefs().size()];
|
||||
for (int i = 0; i < getRefs().size(); i++) {
|
||||
var ii = i;
|
||||
var ref = refs.get(i);
|
||||
ThreadHelper.runFailableAsync(() -> {
|
||||
try {
|
||||
var replacement = ProcessControlProvider.get().replace(ref);
|
||||
ShellStore store = replacement.getStore().asNeeded();
|
||||
var control = store.standaloneControl();
|
||||
// These prepend scripts, not append
|
||||
TerminalPromptManager.configurePromptScript(control);
|
||||
ProcessControlProvider.get().withDefaultScripts(control);
|
||||
var panes = new ArrayList<TerminalLauncher.Config>();
|
||||
for (DataStoreEntryRef<ShellStore> ref : getRefs()) {
|
||||
var replacement = ProcessControlProvider.get().replace(ref);
|
||||
ShellStore store = replacement.getStore().asNeeded();
|
||||
var control = store.standaloneControl();
|
||||
// These prepend scripts, not append
|
||||
TerminalPromptManager.configurePromptScript(control);
|
||||
ProcessControlProvider.get().withDefaultScripts(control);
|
||||
|
||||
var title = DataStorage.get().getStoreEntryDisplayName(ref.get());
|
||||
var config = new TerminalLauncher.Config(
|
||||
ref.get(), title, null, UUID.randomUUID(), true, true, control);
|
||||
panes[ii] = config;
|
||||
} finally {
|
||||
latch.countDown();
|
||||
}
|
||||
});
|
||||
var title = DataStorage.get().getStoreEntryDisplayName(ref.get());
|
||||
var config =
|
||||
new TerminalLauncher.Config(ref.get(), title, null, UUID.randomUUID(), true, true, control);
|
||||
panes.add(config);
|
||||
}
|
||||
TerminalLauncher.open(Arrays.asList(panes), true, type);
|
||||
TerminalLauncher.open(panes, true, type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user