diff --git a/gui/src/main/java/com/devonfw/ide/gui/App.java b/gui/src/main/java/com/devonfw/ide/gui/App.java index 125c37ecdd..74f1902ae7 100644 --- a/gui/src/main/java/com/devonfw/ide/gui/App.java +++ b/gui/src/main/java/com/devonfw/ide/gui/App.java @@ -128,7 +128,8 @@ private Parent loadMainView() throws IOException { FXMLLoader fxmlLoader = new FXMLLoader(App.class.getResource("main-view.fxml")); fxmlLoader.setResources(this.nlsService.getResourceBundle()); - fxmlLoader.setController(new MainController(System.getenv(IdeVariables.IDE_ROOT.getName()), guiStateManager, this.nlsService)); + MainController controller = new MainController(System.getenv(IdeVariables.IDE_ROOT.getName()), guiStateManager, this.nlsService); + fxmlLoader.setControllerFactory(type -> controller); return fxmlLoader.load(); } diff --git a/gui/src/main/java/com/devonfw/ide/gui/MainController.java b/gui/src/main/java/com/devonfw/ide/gui/MainController.java index cfeba46e6f..4ef28c5cab 100644 --- a/gui/src/main/java/com/devonfw/ide/gui/MainController.java +++ b/gui/src/main/java/com/devonfw/ide/gui/MainController.java @@ -127,12 +127,19 @@ private void setUpTaskListListener() { taskManager.getTasks().addListener(taskListChangeListener); } + /**Guard to ensure {@link #initialize()} runs only once across all FXML files.*/ + private boolean initialized; + @FXML private void initialize() { + if (this.initialized) { + return; + } setProjectsComboBox(); initLanguageComboBox(); selectedWorkspace.setOnAction(this::onWorkspaceSelected); + this.initialized = true; } private void onWorkspaceSelected(ActionEvent actionEvent) { diff --git a/gui/src/main/resources/com/devonfw/ide/gui/main-view.fxml b/gui/src/main/resources/com/devonfw/ide/gui/main-view.fxml index 320f7abadb..693e355919 100644 --- a/gui/src/main/resources/com/devonfw/ide/gui/main-view.fxml +++ b/gui/src/main/resources/com/devonfw/ide/gui/main-view.fxml @@ -6,6 +6,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
@@ -110,9 +32,8 @@ + + + + - - - - - - + diff --git a/gui/src/main/resources/com/devonfw/ide/gui/navigation.fxml b/gui/src/main/resources/com/devonfw/ide/gui/navigation.fxml new file mode 100644 index 0000000000..c833c478d2 --- /dev/null +++ b/gui/src/main/resources/com/devonfw/ide/gui/navigation.fxml @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gui/src/main/resources/com/devonfw/ide/gui/status-bar.fxml b/gui/src/main/resources/com/devonfw/ide/gui/status-bar.fxml new file mode 100644 index 0000000000..ca57a4e47d --- /dev/null +++ b/gui/src/main/resources/com/devonfw/ide/gui/status-bar.fxml @@ -0,0 +1,23 @@ + + + + + + + + + + + diff --git a/gui/src/test/java/com/devonfw/ide/gui/AppBaseTest.java b/gui/src/test/java/com/devonfw/ide/gui/AppBaseTest.java index 7486eee82d..220d0b18c9 100644 --- a/gui/src/test/java/com/devonfw/ide/gui/AppBaseTest.java +++ b/gui/src/test/java/com/devonfw/ide/gui/AppBaseTest.java @@ -59,7 +59,8 @@ public void start(Stage stage) throws IOException { assertThat(mainViewUrl).as("Cannot resolve main UI FXML resource!").isNotNull(); FXMLLoader fxmlLoader = new FXMLLoader(mainViewUrl); - fxmlLoader.setController(new MainController(mockIdeRoot.toString(), guiStateManager, nlsService)); + MainController controller = new MainController(mockIdeRoot.toString(), guiStateManager, nlsService); + fxmlLoader.setControllerFactory(type -> controller); fxmlLoader.setResources(nlsService.getResourceBundle()); Parent root = fxmlLoader.load(); stage.setScene(new Scene(root));