Search in sources :

Example 1 with OpenProjectAction

use of org.apache.cayenne.modeler.action.OpenProjectAction in project cayenne by apache.

the class Main method launch.

protected void launch() {
    // TODO: use module auto-loading...
    final Injector injector = DIBootstrap.createInjector(appendModules(new ArrayList<Module>()));
    // init look and feel before using any Swing classes...
    injector.getInstance(PlatformInitializer.class).initLookAndFeel();
    // logger should go after Look And Feel or Logger Console will be without style
    logger.info("Starting CayenneModeler.");
    logger.info("JRE v." + System.getProperty("java.version") + " at " + System.getProperty("java.home"));
    SwingUtilities.invokeLater(new Runnable() {

        public void run() {
            Application application = injector.getInstance(Application.class);
            Application.setInstance(application);
            application.startup();
            // start initial project AFTER the app startup, as we need Application
            // preferences to be bootstrapped.
            File project = initialProjectFromArgs();
            if (project == null) {
                project = initialProjectFromPreferences();
            }
            if (project != null) {
                new OpenProjectAction(application).openProject(project);
            }
        }
    });
}
Also used : OpenProjectAction(org.apache.cayenne.modeler.action.OpenProjectAction) Injector(org.apache.cayenne.di.Injector) PlatformInitializer(org.apache.cayenne.modeler.init.platform.PlatformInitializer) ArrayList(java.util.ArrayList) File(java.io.File)

Aggregations

File (java.io.File)1 ArrayList (java.util.ArrayList)1 Injector (org.apache.cayenne.di.Injector)1 OpenProjectAction (org.apache.cayenne.modeler.action.OpenProjectAction)1 PlatformInitializer (org.apache.cayenne.modeler.init.platform.PlatformInitializer)1