修复刷新缓存与样式测试隔离

This commit is contained in:
张家训
2026-08-01 17:17:31 +08:00
parent 855195e286
commit cd1218b575
3 changed files with 203 additions and 15 deletions
@@ -54,6 +54,7 @@ public class MainWindow {
}
public void refreshNavItems(List<NavItem> newItems) {
embeddedCache.clear();
navItems = new ArrayList<>(newItems);
navigationRail.setItems(navItems);
showWelcomePage();
@@ -155,7 +156,10 @@ public class MainWindow {
if (item.action != null) {
item.action.run();
}
showEmbeddedFor(item);
if (!showEmbeddedFor(item)) {
navigationRail.clearSelection();
showWelcomePage();
}
}
private void showPluginToolbar(String title) {
@@ -200,15 +204,17 @@ public class MainWindow {
currentEmbedded = null;
}
private void showEmbeddedFor(NavItem item) {
private boolean showEmbeddedFor(NavItem item) {
if (item.pluginId == null) {
hidePluginToolbar();
return;
return false;
}
EmbeddedEntry entry = embeddedCache.get(item.pluginId);
if (entry != null) {
switchToEmbedded(item.pluginId, entry);
return true;
}
return false;
}
public void embedPlugin(String pluginId, String ignoredIcon, String name, Parent content) {