diff options
author | Pascal Rapicault | 2013-01-15 19:04:57 +0000 |
---|---|---|
committer | Pascal Rapicault | 2013-01-15 19:04:57 +0000 |
commit | 446649c95063dca689f4d2c886b26975a11f3499 (patch) | |
tree | cd55b627ab0224ee8e154eb487aba874bab29c9e | |
parent | e004dc5270abd33a60da9a8d0340409bc8e4a38d (diff) | |
download | rt.equinox.p2-446649c95063dca689f4d2c886b26975a11f3499.tar.gz rt.equinox.p2-446649c95063dca689f4d2c886b26975a11f3499.tar.xz rt.equinox.p2-446649c95063dca689f4d2c886b26975a11f3499.zip |
Simple notification to let the user know that the base has changed.
-rw-r--r-- | bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdateScheduler.java | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdateScheduler.java b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdateScheduler.java index 785a01845..10e7b465c 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdateScheduler.java +++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdateScheduler.java @@ -22,8 +22,11 @@ import org.eclipse.equinox.p2.engine.IProfileRegistry; import org.eclipse.equinox.p2.engine.query.IUProfilePropertyQuery; import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.equinox.p2.query.IQuery; +import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.ui.IStartup; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.*; import org.eclipse.ui.statushandlers.StatusManager; /** @@ -78,10 +81,37 @@ public class AutomaticUpdateScheduler implements IStartup { } public void earlyStartup() { + if (baseChanged()) + return; garbageCollect(); scheduleUpdate(); } + Shell getWorkbenchWindowShell() { + IWorkbenchWindow activeWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + return activeWindow != null ? activeWindow.getShell() : null; + + } + + private boolean baseChanged() { + if (!("true".equals(System.getProperty("eclipse.ignoreUserConfiguration")))) + return false; + + IProvisioningAgent agent = (IProvisioningAgent) ServiceHelper.getService(AutomaticUpdatePlugin.getContext(), IProvisioningAgent.SERVICE_NAME); + IProfileRegistry registry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME); + IProfile currentProfile = registry.getProfile(profileId); + if (!"NEW".equals(registry.getProfileStateProperties(profileId, currentProfile.getTimestamp()).get("NEW"))) + return false; + + Display d = Display.getDefault(); + d.asyncExec(new Runnable() { + public void run() { + MessageDialog.openWarning(getWorkbenchWindowShell(), "Installation modified", "An upgrade of the eclipse installation you are using has been performed. The extensions you had installed have been disabled."); + } + }); + return true; + } + /** * Invokes the garbage collector to discard unused plugins, if specified by a * corresponding preference. |