|
Lines 1-5
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2008, 2010 IBM Corporation and others. |
2 |
* Copyright (c) 2008, 2011 IBM Corporation and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
|
Lines 14-19
Link Here
|
| 14 |
import com.ibm.icu.util.ULocale; |
14 |
import com.ibm.icu.util.ULocale; |
| 15 |
import org.eclipse.core.runtime.*; |
15 |
import org.eclipse.core.runtime.*; |
| 16 |
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper; |
16 |
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper; |
|
|
17 |
import org.eclipse.equinox.internal.p2.garbagecollector.GarbageCollector; |
| 17 |
import org.eclipse.equinox.internal.provisional.p2.updatechecker.*; |
18 |
import org.eclipse.equinox.internal.provisional.p2.updatechecker.*; |
| 18 |
import org.eclipse.equinox.p2.core.IProvisioningAgent; |
19 |
import org.eclipse.equinox.p2.core.IProvisioningAgent; |
| 19 |
import org.eclipse.equinox.p2.engine.IProfile; |
20 |
import org.eclipse.equinox.p2.engine.IProfile; |
|
Lines 77-85
Link Here
|
| 77 |
} |
78 |
} |
| 78 |
|
79 |
|
| 79 |
public void earlyStartup() { |
80 |
public void earlyStartup() { |
|
|
81 |
garbageCollect(); |
| 80 |
scheduleUpdate(); |
82 |
scheduleUpdate(); |
| 81 |
} |
83 |
} |
| 82 |
|
84 |
|
|
|
85 |
/** |
| 86 |
* Invokes the garbage collector to discard unused plugins, if specified by a |
| 87 |
* corresponding preference. |
| 88 |
*/ |
| 89 |
private void garbageCollect() { |
| 90 |
// Nothing to do if we don't know what profile we are checking |
| 91 |
if (profileId == null) |
| 92 |
return; |
| 93 |
//check if gc is enabled |
| 94 |
IPreferenceStore pref = AutomaticUpdatePlugin.getDefault().getPreferenceStore(); |
| 95 |
if (!pref.getBoolean(PreferenceConstants.PREF_GC_ON_STARTUP)) |
| 96 |
return; |
| 97 |
IProvisioningAgent agent = (IProvisioningAgent) ServiceHelper.getService(AutomaticUpdatePlugin.getContext(), IProvisioningAgent.SERVICE_NAME); |
| 98 |
GarbageCollector collector = (GarbageCollector) agent.getService(GarbageCollector.SERVICE_NAME); |
| 99 |
if (collector == null) |
| 100 |
return; |
| 101 |
IProfileRegistry registry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME); |
| 102 |
if (registry == null) |
| 103 |
return; |
| 104 |
IProfile profile = registry.getProfile(profileId); |
| 105 |
if (profile == null) |
| 106 |
return; |
| 107 |
collector.runGC(profile); |
| 108 |
} |
| 109 |
|
| 83 |
public void shutdown() { |
110 |
public void shutdown() { |
| 84 |
removeUpdateListener(); |
111 |
removeUpdateListener(); |
| 85 |
} |
112 |
} |