return;
}
}
// configuration loading can be multithreaded, so begin early
final AnalyzerBeansConfiguration configuration = loadConfiguration();
if (!cliMode) {
// set up error handling that displays an error dialog
final DCUncaughtExceptionHandler exceptionHandler = new DCUncaughtExceptionHandler();
Thread.setDefaultUncaughtExceptionHandler(exceptionHandler);
// init the look and feel
LookAndFeelManager.getInstance().init();
}
// log usage
UsageLogger.getInstance().logApplicationStartup();
if (cliMode) {
final PrintWriter out = new PrintWriter(System.out);
// run in CLI mode
CliArguments arguments = _options.getCommandLineArguments();
final CliRunner runner = new CliRunner(arguments, out);
runner.run(configuration);
out.flush();
exitCommandLine(configuration, 0);
return;
} else {
// run in GUI mode
final Injector injector = Guice.createInjector(new DCModule(configuration));
final AnalysisJobBuilderWindow analysisJobBuilderWindow = injector.getInstance(AnalysisJobBuilderWindow.class);
if (_options.isSingleDatastoreMode()) {
DatastoreCatalog datastoreCatalog = configuration.getDatastoreCatalog();
Datastore singleDatastore = _options.getSingleDatastore(datastoreCatalog);
if (singleDatastore == null) {
logger.info("Single datastore mode was enabled, but datastore was null!");
} else {
logger.info("Initializing single datastore mode with {}", singleDatastore);
}
analysisJobBuilderWindow.setDatastoreSelectionEnabled(false);
analysisJobBuilderWindow.setDatastore(singleDatastore, true);
}
analysisJobBuilderWindow.open();
final UserPreferences userPreferences = injector.getInstance(UserPreferences.class);
final WindowContext windowContext = injector.getInstance(WindowContext.class);
// set up HTTP service for ExtensionSwap installation
loadExtensionSwapService(userPreferences, windowContext);
// load regex swap regexes if logged in
final RegexSwapUserPreferencesHandler regexSwapHandler = new RegexSwapUserPreferencesHandler(
(MutableReferenceDataCatalog) configuration.getReferenceDataCatalog());
userPreferences.addLoginChangeListener(regexSwapHandler);
final ExitActionListener exitActionListener = _options.getExitActionListener();
if (exitActionListener != null) {
windowContext.addExitActionListener(exitActionListener);