{
// Try to read game from the configuration
final Config config = Config.getInstance();
final String defaultGameId = config.getDefaultGame();
final GameFactory gameFactory = GameFactory.getInstance();
Game game = defaultGameId == null ||
!gameFactory.hasGame(defaultGameId) ? null
: gameFactory.getGame(defaultGameId);
// If no default game is set then ask for it
if (game == null)
{
final SelectGameDialog dialog = SelectGameDialog.getInstance();
if (dialog.open() != Result.OK) return;
game = dialog.getGame();
if (dialog.isRemember()) config.setDefaultGame(game.getId());
}
createComplexTab(new ComplexEditor(new Complex(game)));
}