final Optional<IWVWMatch> matchOptional = MainWindow.this.matchesTableModel.getMatch(index);
if (matchOptional.isPresent()) {
LOGGER.debug("Incoming selection event [" + index + "] -> match=" + matchOptional.get().getId());
if (!selectedMatch.equals(matchOptional)) {
selectedMatch = matchOptional;
final IWVWMatch match = matchOptional.get();
LOGGER.info("NEW selected match=" + match.getId());
if (wrapper.isPresent()) {
MainWindow.this.allMapsModel.wireUp(MainWindow.this.wrapper.get(), match.getCenterMap(), match.getGreenMap(), match.getBlueMap(), match.getRedMap());
MainWindow.this.matchDetailsTableModel.wireUp(MainWindow.this.wrapper.get(), match, match.getCenterMap(), match.getGreenMap(), match.getBlueMap(),
match.getRedMap());
MainWindow.this.eternalMapModel.wireUp(MainWindow.this.wrapper.get(), match.getCenterMap());
MainWindow.this.greenMapModel.wireUp(MainWindow.this.wrapper.get(), match.getGreenMap());
MainWindow.this.blueMapModel.wireUp(MainWindow.this.wrapper.get(), match.getBlueMap());
MainWindow.this.redMapModel.wireUp(MainWindow.this.wrapper.get(), match.getRedMap());
MainWindow.this.wrapper.get().unregisterWVWMapListener(MainWindow.this);
MainWindow.this.wrapper.get().registerWVWMapListener(match.getCenterMap(), MainWindow.this);
MainWindow.this.wrapper.get().registerWVWMapListener(match.getGreenMap(), MainWindow.this);
MainWindow.this.wrapper.get().registerWVWMapListener(match.getBlueMap(), MainWindow.this);
MainWindow.this.wrapper.get().registerWVWMapListener(match.getRedMap(), MainWindow.this);
}
if (match.getGreenWorld().getName().isPresent()) {
MainWindow.this.greenMapToolWindow.setTitle(match.getGreenWorld().getName().get() + " Borderlands");
} else {
MainWindow.this.greenMapToolWindow.setTitle("Green Borderlands");
}
if (match.getBlueWorld().getName().isPresent()) {
MainWindow.this.blueMapToolWindow.setTitle(match.getBlueWorld().getName().get() + " Borderlands");
} else {
MainWindow.this.blueMapToolWindow.setTitle("Blue Borderlands");
}
if (match.getRedWorld().getName().isPresent()) {
MainWindow.this.redMapToolWindow.setTitle(match.getRedWorld().getName().get() + " Borderlands");
} else {
MainWindow.this.redMapToolWindow.setTitle("Red Borderlands");
}
YAGW2APIAnchorman.INSTANCE.getAnchorman().setWVWMatchFilter(match);
LOGGER.debug("Wired everything up for new selected match=" + match.getId());
} else {
LOGGER.debug("Already selected match=" + matchOptional.get().getId());
}
}
}