Class UpdatesChecker
java.lang.Object
com.amalgamasimulation.desktop.updater.UpdatesChecker
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 ClassesModifier and TypeClassDescriptionstatic enumUI action in case no updates have been found at the update site. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheckForUpdates(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 voidcheckForUpdates(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 voidcheckForUpdates(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 voidcheckForUpdates(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 booleanisUpdateSiteReachable(String p2UpdateSiteUrl, org.eclipse.core.runtime.IProgressMonitor monitor) Checks whether the P2 update site is reachable over the network.static ConnectivityDiagnosisprobeUpdateSite(String p2UpdateSiteUrl, org.eclipse.core.runtime.IProgressMonitor monitor) Checks the P2 update site and preserves HTTP and connection error details.
-
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 instanceworkbench- IWorkbench instance. Used for restarting the application after an update.sync- UISynchronize instancep2UpdateSiteUrl- 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 instanceworkbench- IWorkbench instance. Used for restarting the application after an update.sync- UISynchronize instancep2UpdateSiteUrls- 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 instanceworkbench- IWorkbench instance. Used for restarting the application after an update.sync- UISynchronize instancep2UpdateSiteUrl- 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 instanceworkbench- IWorkbench instance. Used for restarting the application after an update.sync- UISynchronize instancep2UpdateSiteUrls- 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 sitemonitor- 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.
-