Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordj2011-07-20 16:55:06 -0400
committerdj2011-07-20 16:55:06 -0400
commitfd0b0c9295a65857055ea157db45164e3a67421a (patch)
tree1e2fa02a68078fc2c1fc79bbf9ec425f8ba37f09
parent20604cd5383ddcbd4cc3405e96e8c6777d5103ec (diff)
parent8e18cfac75439f05e28030ebfcb5f92bb9ae073e (diff)
downloadrt.equinox.p2-fd0b0c9295a65857055ea157db45164e3a67421a.tar.gz
rt.equinox.p2-fd0b0c9295a65857055ea157db45164e3a67421a.tar.xz
rt.equinox.p2-fd0b0c9295a65857055ea157db45164e3a67421a.zip
Merge branch 'master' of ssh://git.eclipse.org/gitroot/equinox/rt.equinox.p2
-rw-r--r--bundles/org.eclipse.equinox.p2.garbagecollector/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/META-INF/MANIFEST.MF3
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdatePlugin.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdateScheduler.java29
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreferenceConstants.java3
5 files changed, 38 insertions, 6 deletions
diff --git a/bundles/org.eclipse.equinox.p2.garbagecollector/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.garbagecollector/META-INF/MANIFEST.MF
index 997d181c5..4d398e9ef 100644
--- a/bundles/org.eclipse.equinox.p2.garbagecollector/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.garbagecollector/META-INF/MANIFEST.MF
@@ -6,7 +6,7 @@ Bundle-Version: 1.0.200.qualifier
Bundle-Activator: org.eclipse.equinox.internal.p2.garbagecollector.GCActivator
Bundle-Vendor: %providerName
Bundle-Localization: plugin
-Export-Package: org.eclipse.equinox.internal.p2.garbagecollector;x-friends:="org.eclipse.equinox.p2.touchpoint.eclipse,org.eclipse.pde.core"
+Export-Package: org.eclipse.equinox.internal.p2.garbagecollector;x-friends:="org.eclipse.equinox.p2.touchpoint.eclipse,org.eclipse.pde.core,org.eclipse.equinox.p2.ui.sdk.scheduler"
Require-Bundle: org.eclipse.equinox.p2.engine,
org.eclipse.equinox.registry;bundle-version="[3.4.0,4.0.0)"
Import-Package: org.eclipse.core.runtime.preferences,
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/META-INF/MANIFEST.MF
index 8c03c3228..ded416037 100644
--- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %bundleName
Bundle-SymbolicName: org.eclipse.equinox.p2.ui.sdk.scheduler;singleton:=true
-Bundle-Version: 1.0.100.qualifier
+Bundle-Version: 1.1.0.qualifier
Bundle-Activator: org.eclipse.equinox.internal.p2.ui.sdk.scheduler.AutomaticUpdatePlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -19,6 +19,7 @@ Import-Package: com.ibm.icu.util;version="4.0.1",
org.eclipse.equinox.internal.p2.core.helpers,
org.eclipse.equinox.internal.p2.engine,
org.eclipse.equinox.internal.p2.engine.phases,
+ org.eclipse.equinox.internal.p2.garbagecollector,
org.eclipse.equinox.internal.p2.metadata.query,
org.eclipse.equinox.internal.p2.ui.actions,
org.eclipse.equinox.internal.p2.ui.query,
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdatePlugin.java b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdatePlugin.java
index 25bd314e6..a4dac61fd 100644
--- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdatePlugin.java
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdatePlugin.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 IBM Corporation and others.
+ * Copyright (c) 2008, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -30,7 +30,10 @@ import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
/**
- * Activator class for the automatic updates plugin
+ * Activator class for the automatic updates plugin. The automatic updates plugin
+ * is responsible for scheduling background update checks, based on update settings
+ * specified by end user settings. The implementation of update checking is provided
+ * by another plugin that provides an IUpdateChecker implementation.
*/
public class AutomaticUpdatePlugin extends AbstractUIPlugin {
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 cfb42f3cc..785a01845 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 IBM Corporation and others.
+ * Copyright (c) 2008, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -14,6 +14,7 @@ import com.ibm.icu.util.Calendar;
import com.ibm.icu.util.ULocale;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
+import org.eclipse.equinox.internal.p2.garbagecollector.GarbageCollector;
import org.eclipse.equinox.internal.provisional.p2.updatechecker.*;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.engine.IProfile;
@@ -77,9 +78,35 @@ public class AutomaticUpdateScheduler implements IStartup {
}
public void earlyStartup() {
+ garbageCollect();
scheduleUpdate();
}
+ /**
+ * Invokes the garbage collector to discard unused plugins, if specified by a
+ * corresponding preference.
+ */
+ private void garbageCollect() {
+ // Nothing to do if we don't know what profile we are checking
+ if (profileId == null)
+ return;
+ //check if gc is enabled
+ IPreferenceStore pref = AutomaticUpdatePlugin.getDefault().getPreferenceStore();
+ if (!pref.getBoolean(PreferenceConstants.PREF_GC_ON_STARTUP))
+ return;
+ IProvisioningAgent agent = (IProvisioningAgent) ServiceHelper.getService(AutomaticUpdatePlugin.getContext(), IProvisioningAgent.SERVICE_NAME);
+ GarbageCollector collector = (GarbageCollector) agent.getService(GarbageCollector.SERVICE_NAME);
+ if (collector == null)
+ return;
+ IProfileRegistry registry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME);
+ if (registry == null)
+ return;
+ IProfile profile = registry.getProfile(profileId);
+ if (profile == null)
+ return;
+ collector.runGC(profile);
+ }
+
public void shutdown() {
removeUpdateListener();
}
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreferenceConstants.java b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreferenceConstants.java
index 6f2de2be3..398c7da78 100644
--- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreferenceConstants.java
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreferenceConstants.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 IBM Corporation and others.
+ * Copyright (c) 2008, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -28,4 +28,5 @@ public class PreferenceConstants {
public static final String PREF_REMIND_240Minutes = "4 Hours";//$NON-NLS-1$
public static final String PREF_AUTO_UPDATE_INIT = "autoUpdateInit"; //$NON-NLS-1$
public static final String PREF_MIGRATED_34 = "migrated34Prefs"; //$NON-NLS-1$
+ public static final String PREF_GC_ON_STARTUP = "gcOnStartup"; //$NON-NLS-1$
}

Back to the top