protected void selectLatestLocalVersion() {
   try {
     LocalVaadinVersion newestLocalVaadinVersion = LocalFileManager.getNewestLocalVaadinVersion();
     if (newestLocalVaadinVersion != null) {
       versionCombo.setText(newestLocalVaadinVersion.getVersionNumber());
     }
   } catch (CoreException e) {
     // maybe there is no version downloaded - ignore
     ErrorUtil.handleBackgroundException(
         IStatus.WARNING,
         "Failed to select the most recent cached Vaadin version, probably no versions in cache yet",
         e);
   }
 }
  private void updateVersionCombo() {
    versionCombo.setEnabled(true);
    downloadButton.setEnabled(!useDependencyManagement);
    // Note that this can also be modified by the data model provider
    latestNightlyCheckbox.setEnabled(!useDependencyManagement);
    try {

      versionCombo.removeAll();
      // Always allow empty selection which removes Vaadin from the
      // project
      versionCombo.add("");
      versionMap.clear();

      // Vaadin 7 (dependency management) or older versions
      if (useDependencyManagement) {
        for (MavenVaadinVersion version : MavenVersionManager.getAvailableVersions(false)) {
          versionMap.put(version.getVersionNumber(), version);
          versionCombo.add(version.getVersionNumber());
        }
      } else {
        for (LocalVaadinVersion version : LocalFileManager.getLocalVaadinVersions(false)) {
          versionMap.put(version.getVersionNumber(), version);
          versionCombo.add(version.getVersionNumber());
        }
      }
      versionCombo.setText("");

      try {
        // select current version (if any)
        if (project == null) {
          return;
        }

        // TODO should use getVaadinLibraryVersion()
        IPath vaadinLibrary = ProjectUtil.getVaadinLibraryInProject(project, true);
        if (vaadinLibrary == null) {
          return;
        }

        // is the Vaadin JAR actually inside the project?
        boolean vaadinInProject = ProjectUtil.isInProject(project, vaadinLibrary);

        String currentVaadinVersionString = VersionUtil.getVaadinVersionFromJar(vaadinLibrary);
        if (currentVaadinVersionString == null) {
          return;
        }

        // There is a version of the Vaadin jar for the project. It
        // might be in WEB-INF/lib or somewhere else on the classpath.

        // Ensure the version is listed, it might be a custom jar or it
        // might have been removed from the local store for instance
        // when Eclipse was upgraded.

        // TODO should this take dependency versions into account
        // differently?
        LocalVaadinVersion projectVaadinVersion =
            new LocalVaadinVersion(
                FileType.VAADIN_RELEASE, currentVaadinVersionString, vaadinLibrary);

        // Always show current version as "6.4.8 (vaadin-*.jar)"
        String comboboxString =
            currentVaadinVersionString + " (" + projectVaadinVersion.getJarFilename() + ")";

        versionMap.put(comboboxString, projectVaadinVersion);
        // Add the string to the combo box as first
        // ("" becomes second)
        versionCombo.add(comboboxString, 0);
        versionCombo.setText(comboboxString);

        if (!vaadinInProject) {
          // If the Vaadin JAR is outside the project we just
          // show it to the user. We really do not want to delete
          // files outside the project anyway.
          versionCombo.setEnabled(false);
          downloadButton.setEnabled(false);
          latestNightlyCheckbox.setSelection(false);
          latestNightlyCheckbox.setEnabled(false);
        }
      } catch (CoreException ce) {
        // ignore if cannot select current version
        ErrorUtil.handleBackgroundException(
            IStatus.WARNING, "Failed to select the Vaadin version used in the project", ce);
      }
    } catch (CoreException ex) {
      // leave the combo empty and show an error message
      ErrorUtil.displayError("Failed to list downloaded Vaadin versions", ex, getShell());
    }
  }