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);
   }
 }
    // fetch the list of available versions, including or excluding
    // development versions and nightly builds
    protected void updateVersionList(boolean development) {
      try {
        DownloadableVaadinVersion selected = getSelectedVersion();

        List<DownloadableVaadinVersion> available =
            DownloadManager.getAvailableVersions(!development);
        // Equals and hasCode implementation in
        // AbstractVaadinVersion enables us to do this
        available.removeAll(LocalFileManager.getLocalVaadinVersions(true));

        DownloadableVaadinVersion[] versions = available.toArray(new DownloadableVaadinVersion[0]);
        fFilteredList.setComparator(new VersionStringComparator(available));
        setListElements(versions);

        // try to preserve selection
        if (selected != null) {
          setSelection(new DownloadableVaadinVersion[] {selected});
        } else {
          setSelection(getInitialElementSelections().toArray());
        }

      } catch (CoreException ex) {
        String displayMsg = "Failed to download list of available Vaadin versions";
        Throwable cause = ex.getCause();
        if (cause != null) {
          displayMsg += "\n\n" + cause.getClass().getName();
        }
        String msg = cause.getMessage();
        if (msg != null && msg.length() > 0) {
          displayMsg += ": " + msg;
        }
        ErrorUtil.displayError(displayMsg, ex, getShell());

        ErrorUtil.handleBackgroundException(
            IStatus.WARNING, "Failed to update the list of available Vaadin versions", ex);
      }
    }
  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());
    }
  }