/* @formatter:on */
 @Override
 public void closeDialog() {
   if (SwingUtilities.isEventDispatchThread()) {
     this.dialog.setVisible(false);
   } else {
     SwingUtilities.invokeLater(
         new Runnable() {
           @Override
           public void run() {
             FlightCreateDialogController.this.dialog.setVisible(false);
           }
         });
   }
 }
  /**
   * Constructor
   *
   * @param flightCoords Coordinates of the flight
   * @param firstSegmentOffset Offset that will be added to the flight's coordinates for the first
   *     segment
   */
  public FlightCreateDialogController(
      final Coordinate flightCoords, final Coordinate firstSegmentOffset) {
    this.firstSegmentOffset = firstSegmentOffset;

    // Load all aircrafts
    OperationalZoneActions action = new OperationalZoneActions();

    final List<Aircraft> aircrafts = action.fetchAllAircrafts();

    // Make sure the dialog is created and populated in the EDT
    if (SwingUtilities.isEventDispatchThread()) {
      this.createDialog(aircrafts, flightCoords.getLat(), flightCoords.getLon());
    } else {
      SwingUtilities.invokeLater(
          new Runnable() {
            @Override
            public void run() {
              FlightCreateDialogController.this.createDialog(
                  aircrafts, flightCoords.getLat(), flightCoords.getLon());
            }
          });
    }
  }