This commit is contained in:
crschnick
2026-03-19 18:26:49 +00:00
parent 08a1ac03b1
commit fe64b20dd2
22 changed files with 99 additions and 79 deletions
@@ -57,7 +57,7 @@ public class DataStoreCategoryChoiceComp extends SimpleRegionBuilder {
if (!applyExternalInitially) {
value.setValue(last);
}
var box = new ComboBox<>(StoreViewState.get().getSortedCategories(root).filtered(filter).getList());
var box = new ComboBox<>(StoreViewState.get().getSortedCategories(root, false).filtered(filter).getList());
box.setValue(value.getValue());
box.valueProperty().addListener((observable, oldValue, newValue) -> {
value.setValue(newValue);
@@ -22,10 +22,7 @@ import javafx.beans.property.SimpleStringProperty;
import javafx.css.PseudoClass;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuItem;
import javafx.scene.control.SeparatorMenuItem;
import javafx.scene.control.*;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyCodeCombination;
import javafx.scene.input.KeyEvent;
@@ -278,13 +275,18 @@ public class StoreCategoryComp extends SimpleRegionBuilder {
if (category.canMove()) {
var move = new Menu(AppI18n.get("moveTo"), new FontIcon("mdi2f-folder-move-outline"));
StoreViewState.get()
.getSortedCategories(getCategory().getRoot())
.getSortedCategories(getCategory().getRoot(), true)
.getList()
.forEach(storeCategoryWrapper -> {
MenuItem m = new MenuItem();
m.textProperty()
.setValue(" ".repeat(storeCategoryWrapper.getDepth())
+ storeCategoryWrapper.getName().getValue());
var m = new CustomMenuItem();
var l = new Label();
l.setGraphic(PrettyImageHelper.ofFixedSizeSquare(storeCategoryWrapper.getIconFile().getValue(), 16)
.padding(new Insets(0, 0, 1, 0)).build());
l.setText(storeCategoryWrapper.getName().getValue());
l.setPadding(new Insets(0, 1, 1, storeCategoryWrapper.getDepth() * 10));
m.setContent(l);
m.setOnAction(event -> {
category.moveToParent(storeCategoryWrapper.getCategory());
event.consume();
@@ -100,6 +100,16 @@ public class StoreCategoryWrapper {
return cachedParent;
}
public boolean isHierarchyExpanded() {
StoreCategoryWrapper current = this;
while ((current = current.getParent()) != null) {
if (!current.getExpanded().get()) {
return false;
}
};
return true;
}
public void select() {
PlatformThread.runLaterIfNeeded(() -> {
StoreViewState.get().getActiveCategory().setValue(this);
@@ -152,12 +162,17 @@ public class StoreCategoryWrapper {
this.expanded.set(!expanded.getValue());
}
public void update() {
public synchronized void update() {
// We are probably in shutdown then
if (StoreViewState.get() == null) {
return;
}
// We received a delayed update after removal
if (!DataStorage.get().getStoreCategories().contains(category)) {
return;
}
// Avoid reupdating name when changed from the name property!
var catName = translatedName(category.getName());
if (!catName.equals(name.getValue())) {
@@ -35,6 +35,7 @@ import javafx.scene.layout.Region;
import atlantafx.base.layout.InputGroup;
import atlantafx.base.theme.Styles;
import javafx.scene.layout.StackPane;
import org.kordamp.ikonli.javafx.FontIcon;
import java.lang.ref.WeakReference;
@@ -644,13 +645,18 @@ public abstract class StoreEntryComp extends SimpleRegionBuilder {
var move = new Menu(AppI18n.get("category"), new FontIcon("mdi2f-folder-move-outline"));
StoreViewState.get()
.getSortedCategories(
getWrapper().getCategory().getValue().getRoot())
getWrapper().getCategory().getValue().getRoot(), true)
.getList()
.forEach(storeCategoryWrapper -> {
MenuItem m = new MenuItem();
m.textProperty()
.setValue(" ".repeat(storeCategoryWrapper.getDepth())
+ storeCategoryWrapper.getName().getValue());
var m = new CustomMenuItem();
var l = new Label();
l.setGraphic(PrettyImageHelper.ofFixedSizeSquare(storeCategoryWrapper.getIconFile().getValue(), 16)
.padding(new Insets(0, 0, 1, 0)).build());
l.setText(storeCategoryWrapper.getName().getValue());
l.setPadding(new Insets(0, 1, 1, storeCategoryWrapper.getDepth() * 10));
m.setContent(l);
m.setOnAction(event -> {
getWrapper().moveTo(storeCategoryWrapper.getCategory());
event.consume();
@@ -565,7 +565,7 @@ public class StoreViewState {
}
}
public DerivedObservableList<StoreCategoryWrapper> getSortedCategories(StoreCategoryWrapper root) {
public DerivedObservableList<StoreCategoryWrapper> getSortedCategories(StoreCategoryWrapper root, boolean requireExpanded) {
Comparator<StoreCategoryWrapper> comparator = new Comparator<>() {
@Override
public int compare(StoreCategoryWrapper o1, StoreCategoryWrapper o2) {
@@ -620,6 +620,7 @@ public class StoreViewState {
};
return categories
.filtered(cat -> root == null || cat.getRoot().equals(root))
.filtered(storeCategoryWrapper -> !requireExpanded || storeCategoryWrapper.isHierarchyExpanded())
.sorted(comparator);
}
@@ -27,23 +27,27 @@ public class ScriptHelper {
@SneakyThrows
public static FilePath createExecScript(ShellDialect type, ShellControl processControl, String content) {
return createExecScript(type, processControl, content, true);
}
@SneakyThrows
public static FilePath createExecScript(ShellDialect type, ShellControl processControl, String content, boolean log) {
content = type.prepareScriptContent(processControl, content);
var fileName = "xpipe-" + getScriptHash(processControl, content);
var temp = processControl.getSystemTemporaryDirectory();
var file = temp.join(fileName + "." + type.getScriptFileEnding());
return createExecScriptRaw(processControl, file, content);
return createExecScriptRaw(processControl, file, content, log);
}
@SneakyThrows
public static FilePath createExecScriptRaw(ShellControl processControl, FilePath file, String content) {
public static FilePath createExecScriptRaw(ShellControl processControl, FilePath file, String content, boolean log) {
if (processControl.view().fileExists(file)) {
return file;
}
TrackEvent.withTrace("Writing exec script")
.tag("file", file)
.tag("content", content)
.handle();
if (log) {
TrackEvent.withTrace("Writing exec script").tag("file", file).tag("content", content).handle();
}
processControl.view().writeScriptFile(file, content);
return file;
}
@@ -35,7 +35,7 @@ public class TerminalLauncher {
var content = constructTerminalInitScript(t, processControl, workingDirectory, preInit, postInit, config, exit);
var hash = ScriptHelper.getScriptHash(processControl, content);
var file = t.getInitFileName(processControl, hash);
return ScriptHelper.createExecScriptRaw(processControl, file, content);
return ScriptHelper.createExecScriptRaw(processControl, file, content, true);
}
private static String constructTerminalInitScript(
@@ -104,12 +104,13 @@ public class RunFileScriptMenuProvider implements BrowserMenuBranchProvider {
return new BrowserMenuBranchProvider() {
@Override
public LabelGraphic getIcon() {
if (!hierarchy.isLeaf()) {
return null;
if (hierarchy.isLeaf()) {
return new LabelGraphic.ImageGraphic(hierarchy.getScript().get().getEffectiveIconFile(), 16);
} else {
var cat = hierarchy.getCategory();
var icon = cat.getEffectiveIconFile();
return new LabelGraphic.ImageGraphic(icon, 16);
}
return new LabelGraphic.CompGraphic(PrettyImageHelper.ofFixedSize(
hierarchy.getScript().get().getEffectiveIconFile(), 16, 16));
}
@Override
@@ -376,9 +376,11 @@ public class RunScriptActionProviderMenu implements HubBranchProvider<ShellStore
public LabelGraphic getIcon() {
if (hierarchy.isLeaf()) {
return new LabelGraphic.ImageGraphic(hierarchy.getScript().get().getEffectiveIconFile(), 16);
} else {
var cat = hierarchy.getCategory();
var icon = cat.getEffectiveIconFile();
return new LabelGraphic.ImageGraphic(icon, 16);
}
return new LabelGraphic.ImageGraphic("base:scriptGroup_icon.svg", 16);
}
@Override
@@ -49,7 +49,7 @@ public class ScriptCollectionSourceImportDialog {
}
private StoreCategoryWrapper findDefaultCategory() {
var all = StoreViewState.get().getSortedCategories(StoreViewState.get().getAllScriptsCategory())
var all = StoreViewState.get().getSortedCategories(StoreViewState.get().getAllScriptsCategory(), false)
.filtered(w -> w.getParent() != null &&
!w.getCategory().getUuid().equals(DataStorage.PREDEFINED_SCRIPTS_CATEGORY_UUID) &&
!w.getCategory().getUuid().equals(DataStorage.SCRIPT_SOURCES_CATEGORY_UUID));
@@ -117,7 +117,7 @@ public class ScriptStoreSetup {
}
var applicable = refs.stream()
.filter(ss -> ss.getStore().isCompatible(sc.getShellDialect()))
.filter(ss -> ss.getStore().isCompatible(sc))
.toList();
if (applicable.isEmpty()) {
return null;
Binary file not shown.

Before

Width:  |  Height:  |  Size: 455 B

After

Width:  |  Height:  |  Size: 422 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 447 B

After

Width:  |  Height:  |  Size: 415 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 615 B

After

Width:  |  Height:  |  Size: 595 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 634 B

After

Width:  |  Height:  |  Size: 593 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 828 B

After

Width:  |  Height:  |  Size: 750 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 820 B

After

Width:  |  Height:  |  Size: 749 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

+16 -22
View File
@@ -23,11 +23,11 @@
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:zoom="2.7891646"
inkscape:cx="98.595831"
inkscape:cy="115.98455"
inkscape:cx="161.33863"
inkscape:cy="124.23075"
inkscape:window-width="1920"
inkscape:window-height="1009"
inkscape:window-x="-8"
inkscape:window-height="1057"
inkscape:window-x="1912"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="Layer_1" /><defs
@@ -41,27 +41,21 @@
style="fill:#e8e8e8;fill-opacity:1;stroke-width:0.861248" /><metadata
id="metadata932"><rdf:RDF><cc:Work
rdf:about=""><dc:title>identity</dc:title></cc:Work></rdf:RDF></metadata><rect
style="fill:#bfbfbf;fill-opacity:1;stroke-width:4.71402"
style="fill:#bfbfbf;fill-opacity:0.8;stroke-width:4.38029"
id="rect1"
width="130.2903"
width="112.49566"
height="16.287502"
x="38.743805"
y="51.056995" /><rect
style="fill:#bfbfbf;fill-opacity:1;stroke-width:4.30891"
x="47.216656"
y="54.283768" /><rect
style="fill:#bfbfbf;fill-opacity:0.8;stroke-width:4.00387"
id="rect1-9"
width="108.85865"
width="93.991089"
height="16.287502"
x="38.409683"
y="80.544037" /><rect
style="fill:#bfbfbf;fill-opacity:1;stroke-width:4.65319"
x="47.237728"
y="94.885254" /><rect
style="fill:#bfbfbf;fill-opacity:0.8;stroke-width:4.32378"
id="rect1-8"
width="126.94962"
width="109.61124"
height="16.287502"
x="37.778194"
y="109.23331" /><rect
style="fill:#bfbfbf;fill-opacity:1;stroke-width:4.41658"
id="rect1-9-2"
width="114.36689"
height="16.287502"
x="37.68644"
y="138.36113" /></svg>
x="46.382923"
y="136.12308" /></svg>

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

+17 -23
View File
@@ -23,11 +23,11 @@
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:zoom="2.7891646"
inkscape:cx="98.595831"
inkscape:cy="115.98455"
inkscape:cx="161.33863"
inkscape:cy="124.23075"
inkscape:window-width="1920"
inkscape:window-height="1009"
inkscape:window-x="-8"
inkscape:window-height="1057"
inkscape:window-x="1912"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="Layer_1" /><defs
@@ -38,30 +38,24 @@
class="cls-1"
d="M 168.53751,15.715416 H 37.076569 A 22.392455,22.392455 0 0 0 14.684114,38.107871 V 169.55159 a 22.392455,22.392455 0 0 0 22.392455,22.39245 H 168.53751 a 22.392455,22.392455 0 0 0 22.39246,-22.39245 V 38.090646 a 22.392455,22.392455 0 0 0 -22.39246,-22.37523 z m 12.05748,153.836174 a 12.057476,12.057476 0 0 1 -12.05748,12.05747 H 37.076569 A 12.057476,12.057476 0 0 1 25.019094,169.55159 V 38.090646 A 12.057476,12.057476 0 0 1 37.076569,26.03317 H 168.53751 a 12.057476,12.057476 0 0 1 12.05748,12.057476 z"
id="path860"
style="fill:#222222;fill-opacity:1;stroke-width:0.861248" /><metadata
style="fill:#323232;fill-opacity:1;stroke-width:0.861248" /><metadata
id="metadata932"><rdf:RDF><cc:Work
rdf:about=""><dc:title>identity</dc:title></cc:Work></rdf:RDF></metadata><rect
style="fill:#3e3e3e;fill-opacity:1;stroke-width:4.71402"
style="fill:#353535;fill-opacity:0.80000001;stroke-width:4.38029"
id="rect1"
width="130.2903"
width="112.49566"
height="16.287502"
x="38.743805"
y="51.056995" /><rect
style="fill:#3e3e3e;fill-opacity:1;stroke-width:4.30891"
x="47.216656"
y="54.283768" /><rect
style="fill:#353535;fill-opacity:0.80000001;stroke-width:4.00387"
id="rect1-9"
width="108.85865"
width="93.991089"
height="16.287502"
x="38.409683"
y="80.544037" /><rect
style="fill:#3e3e3e;fill-opacity:1;stroke-width:4.65319"
x="47.237728"
y="94.885254" /><rect
style="fill:#353535;fill-opacity:0.80000001;stroke-width:4.32378"
id="rect1-8"
width="126.94962"
width="109.61124"
height="16.287502"
x="37.778194"
y="109.23331" /><rect
style="fill:#3e3e3e;fill-opacity:1;stroke-width:4.41658"
id="rect1-9-2"
width="114.36689"
height="16.287502"
x="37.68644"
y="138.36113" /></svg>
x="46.382923"
y="136.12308" /></svg>

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

+2 -1
View File
@@ -1499,7 +1499,8 @@ enpassVaultFileDescription=The local Enpass vault file.
#context: No hierarchy, just a single level
flat=Flat
recursive=Recursive
rdpAllowListBlocked=The selected RemoteApp does not seem to be included in the RDP allow list for the server.
#force
rdpAllowListBlocked=The selected RemoteApp is not included in the RDP allow list for the server and can't be launched.
psonoServerUrl=Server URL
psonoServerUrlDescription=URL of the psono backend server
psonoApiKey=API Key