提交
This commit is contained in:
@@ -92,8 +92,6 @@ public class WorkUtilsApplication implements CommandLineRunner {
|
||||
public void run(String... args) throws Exception {
|
||||
if (args.length == 0) {
|
||||
showMainWindow();
|
||||
} else if ("--console".equals(args[0])) {
|
||||
showInteractiveMenu();
|
||||
} else {
|
||||
processCommand(args);
|
||||
}
|
||||
@@ -104,14 +102,12 @@ public class WorkUtilsApplication implements CommandLineRunner {
|
||||
private void showMainWindow() throws InterruptedException {
|
||||
JfxBootstrap.await();
|
||||
if (JfxBootstrap.isFailed()) {
|
||||
System.err.println("JavaFX 初始化失败,回退到控制台模式");
|
||||
showInteractiveMenu();
|
||||
System.err.println("JavaFX 初始化失败,程序退出。");
|
||||
return;
|
||||
}
|
||||
|
||||
// 始终使用亮色主题
|
||||
Theme.Mode mode = Theme.Mode.LIGHT;
|
||||
Platform.runLater(() -> Theme.applyTheme(mode));
|
||||
// 初始化亮色主题
|
||||
Platform.runLater(Theme::initTheme);
|
||||
|
||||
// 设置导航栏刷新回调(插件管理中启用/禁用后刷新侧边栏)
|
||||
settingsService.setNavItemsRefresher(items -> Platform.runLater(() -> {
|
||||
@@ -262,28 +258,7 @@ public class WorkUtilsApplication implements CommandLineRunner {
|
||||
}
|
||||
}
|
||||
|
||||
private void openSettingsStandalone() {
|
||||
if (settingsWindow == null) {
|
||||
settingsWindow = settingsService.createSettingsWindow(null);
|
||||
}
|
||||
javafx.stage.Stage s = settingsWindow.getStage();
|
||||
if (s != null) {
|
||||
s.show();
|
||||
}
|
||||
}
|
||||
|
||||
/** @deprecated 保留兼容旧路径 */
|
||||
private void openSettingsWindow() {
|
||||
new Thread(() -> settingsService.showSettings(null, null),
|
||||
"SettingsWindow-Thread").start();
|
||||
}
|
||||
|
||||
// ==================== 控制台模式(降级) ====================
|
||||
|
||||
private void showInteractiveMenu() {
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
pluginManager.runMainMenu(scanner);
|
||||
}
|
||||
// ==================== 命令行模式 ====================
|
||||
|
||||
private void processCommand(String... args) throws Exception {
|
||||
String command = args[0].toLowerCase();
|
||||
|
||||
Reference in New Issue
Block a user