package com.github.athi.athifx.gui.application;

import com.github.athi.athifx.gui.configuration.ApplicationConfiguration;
import com.github.athi.athifx.gui.configuration.ApplicationConfigurationException;
import com.github.athi.athifx.gui.configuration.AthiFXApplicationProperties;
import com.github.athi.athifx.gui.navigation.navigator.NavigationPane;
import com.github.athi.athifx.gui.notification.Notification;
import com.github.athi.athifx.injector.injection.AthiFXInjector;
import com.github.athi.athifx.injector.log.Log;
import com.google.inject.Inject;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.stage.Stage;
import org.reflections.Reflections;

import java.util.Set;

/**
 * Created by Athi
 */
public class AthiFXApplication extends Application {

    private static final Log LOGGER = Log.getLogger(AthiFXApplication.class);

    @Inject
    private AthiFXApplicationProperties applicationProperties;

    @Inject
    private NavigationPane navigationPane;

    @Inject
    private MainScreen mainScreen;

    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) throws Exception {
        initDefaultApplicationConfiguration();

        Thread.currentThread().setUncaughtExceptionHandler((thread, throwable) -> {
            LOGGER.error(throwable.getMessage(), throwable);
            Notification.error(ApplicationConfiguration.UNCAUGHT_EXCEPTION_HANDLER_NOTIFICATION_MESSAGE, throwable.getMessage());
        });

        LoadingScreen.show();

        new Thread(() -> {
            AthiFXInjector.createInjector(this, ApplicationConfiguration.INJECTOR_CONFIGURATION);
            Platform.runLater(() -> {
                LoadingScreen.close();
                mainScreen.show(primaryStage, navigationPane);
                navigationPane.setViewAsContent(applicationProperties.getViews().get(1L));
            });
        }).start();
    }

    private void initDefaultApplicationConfiguration() {
        try {
            Reflections reflections = AthiFXInjector.getReflections();
            Set<Class<? extends ApplicationConfiguration>> configuration = reflections.getSubTypesOf(ApplicationConfiguration.class);
            if (configuration.size() == 1) {
                configuration.iterator().next().newInstance().init();
            } else if (configuration.isEmpty()) {
                throw new ApplicationConfigurationException("To many application configuration implementations!!");
            } else {
                throw new ApplicationConfigurationException("No application configuration implementations!!");
            }
        } catch (Exception e) {
            throw new ApplicationConfigurationException("Application configuration exception: " + e.getMessage(), e);
        }
    }
}

@@ -1054,16 +1054,60 @@
 nScreen;
+%0A    %0A    private static Stage primaryStage;
 %0A%0A    pu
@@ -1249,16 +1249,58 @@
 ption %7B%0A
+        this.primaryStage = primaryStage;%0A
         
@@ -2051,24 +2051,108 @@
 art();%0A    %7D
+%0A    %0A    public static Stage getPrimaryStage() %7B%0A        return primaryStage;%0A    %7D
 %0A%0A    privat

Update AthiFXApplication.java