private void onDeploy() {
    String appName = contents_.getSelectedApp();
    if (appName == null || appName == "Create New") appName = contents_.getNewAppName();

    String account = contents_.getSelectedAccount();

    if (isSatellite_) {
      // in a satellite window, call back to the main window to do a
      // deployment
      ShinyApps.deployFromSatellite(
          sourceDir_,
          sourceFile_,
          launchCheck_.getValue(),
          ShinyAppsDeploymentRecord.create(appName, account, ""));

      // we can't raise the main window if we aren't in desktop mode, so show
      // a dialog to guide the user there
      if (!Desktop.isDesktop()) {
        display_.showMessage(
            GlobalDisplay.MSG_INFO,
            "Deployment Started",
            "RStudio is deploying "
                + appName
                + " to ShinyApps. "
                + "Check the Deploy console tab in the main window for "
                + "status updates. ");
      }
    } else {
      // in the main window, initiate the deployment directly
      events_.fireEvent(
          new ShinyAppsDeployInitiatedEvent(
              sourceDir_,
              sourceFile_,
              launchCheck_.getValue(),
              ShinyAppsDeploymentRecord.create(appName, account, "")));
    }

    closeDialog();
  }
 // Create a lookup from app URL to deployments made of this directory
 // to that URL
 private void processDeploymentRecords(JsArray<ShinyAppsDeploymentRecord> records) {
   for (int i = 0; i < records.length(); i++) {
     ShinyAppsDeploymentRecord record = records.get(i);
     deployments_.put(record.getUrl(), record);
   }
 }