Class UpdatesChecker

java.lang.Object
com.amalgamasimulation.desktop.updater.UpdatesChecker

public class UpdatesChecker extends Object
Provides convenience methods for updating a desktop RCP application.

How to use

In your Eclipse RCP application, add a button or a menu item labeled "Check for updates" (or similar). In its handler, call the checkForUpdates(Shell, IWorkbench, UISynchronize, String) method, which will check for available updates and prompt the user to perform the update if any are found.

Overloaded versions of this method also support:

  • a list of update site mirror URLs (instead of a single URL);
  • an action type to specify behavior when no updates are found (by default, a UI dialog is shown).
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    UI action in case no updates have been found at the update site.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    checkForUpdates(org.eclipse.swt.widgets.Shell shell, org.eclipse.e4.ui.workbench.IWorkbench workbench, org.eclipse.e4.ui.di.UISynchronize sync, String p2UpdateSiteUrl)
    Checks if there are new feature and bundle versions available at the application's P2 update site.
    static void
    checkForUpdates(org.eclipse.swt.widgets.Shell shell, org.eclipse.e4.ui.workbench.IWorkbench workbench, org.eclipse.e4.ui.di.UISynchronize sync, String p2UpdateSiteUrl, UpdatesChecker.ActionIfNoUpdatesFound actionIfNoUpdatesFound)
    Checks if there are new feature and bundle versions available at the application's P2 update site.
    static void
    checkForUpdates(org.eclipse.swt.widgets.Shell shell, org.eclipse.e4.ui.workbench.IWorkbench workbench, org.eclipse.e4.ui.di.UISynchronize sync, List<String> p2UpdateSiteUrls)
    Checks if there are new feature and bundle versions available at the application's P2 update site.
    static void
    checkForUpdates(org.eclipse.swt.widgets.Shell shell, org.eclipse.e4.ui.workbench.IWorkbench workbench, org.eclipse.e4.ui.di.UISynchronize sync, List<String> p2UpdateSiteUrls, UpdatesChecker.ActionIfNoUpdatesFound actionIfNoUpdatesFound)
    Checks if there are new feature and bundle versions available at the application's P2 update site.
    static boolean
    isUpdateSiteReachable(String p2UpdateSiteUrl, org.eclipse.core.runtime.IProgressMonitor monitor)
    Checks whether the P2 update site is reachable over the network.
    probeUpdateSite(String p2UpdateSiteUrl, org.eclipse.core.runtime.IProgressMonitor monitor)
    Checks the P2 update site and preserves HTTP and connection error details.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • UpdatesChecker

      public UpdatesChecker()
  • Method Details

    • checkForUpdates

      public static void checkForUpdates(org.eclipse.swt.widgets.Shell shell, org.eclipse.e4.ui.workbench.IWorkbench workbench, org.eclipse.e4.ui.di.UISynchronize sync, String p2UpdateSiteUrl)
      Checks if there are new feature and bundle versions available at the application's P2 update site. If any - initiates an update.
      Parameters:
      shell - Shell instance
      workbench - IWorkbench instance. Used for restarting the application after an update.
      sync - UISynchronize instance
      p2UpdateSiteUrl - URL of the update site, e.g., "https://example.com/repository/myproject"
    • checkForUpdates

      public static void checkForUpdates(org.eclipse.swt.widgets.Shell shell, org.eclipse.e4.ui.workbench.IWorkbench workbench, org.eclipse.e4.ui.di.UISynchronize sync, List<String> p2UpdateSiteUrls)
      Checks if there are new feature and bundle versions available at the application's P2 update site. If any - initiates an update.
      Parameters:
      shell - Shell instance
      workbench - IWorkbench instance. Used for restarting the application after an update.
      sync - UISynchronize instance
      p2UpdateSiteUrls - URLs of the update site, e.g., "https://example.com/repository/myproject"
    • checkForUpdates

      public static void checkForUpdates(org.eclipse.swt.widgets.Shell shell, org.eclipse.e4.ui.workbench.IWorkbench workbench, org.eclipse.e4.ui.di.UISynchronize sync, String p2UpdateSiteUrl, UpdatesChecker.ActionIfNoUpdatesFound actionIfNoUpdatesFound)
      Checks if there are new feature and bundle versions available at the application's P2 update site. If any - initiates an update.
      Parameters:
      shell - Shell instance
      workbench - IWorkbench instance. Used for restarting the application after an update.
      sync - UISynchronize instance
      p2UpdateSiteUrl - URL of the update site, e.g., "https://example.com/repository/myproject"
      actionIfNoUpdatesFound - whether to show a message if no updates are found
      See Also:
    • checkForUpdates

      public static void checkForUpdates(org.eclipse.swt.widgets.Shell shell, org.eclipse.e4.ui.workbench.IWorkbench workbench, org.eclipse.e4.ui.di.UISynchronize sync, List<String> p2UpdateSiteUrls, UpdatesChecker.ActionIfNoUpdatesFound actionIfNoUpdatesFound)
      Checks if there are new feature and bundle versions available at the application's P2 update site. If any - initiates an update.
      Parameters:
      shell - Shell instance
      workbench - IWorkbench instance. Used for restarting the application after an update.
      sync - UISynchronize instance
      p2UpdateSiteUrls - URLs of the update site, e.g., "https://example.com/repository/myproject"
      actionIfNoUpdatesFound - whether to show a message if no updates are found
    • isUpdateSiteReachable

      public static boolean isUpdateSiteReachable(String p2UpdateSiteUrl, org.eclipse.core.runtime.IProgressMonitor monitor)
      Checks whether the P2 update site is reachable over the network.
      Parameters:
      p2UpdateSiteUrl - URL of the update site
      monitor - progress monitor (may be null)
      Returns:
      true if the host answers with HTTP 2xx; false otherwise
    • probeUpdateSite

      public static ConnectivityDiagnosis probeUpdateSite(String p2UpdateSiteUrl, org.eclipse.core.runtime.IProgressMonitor monitor)
      Checks the P2 update site and preserves HTTP and connection error details.