Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Arthorne2008-04-24 09:39:21 -0400
committerJohn Arthorne2008-04-24 09:39:21 -0400
commitcc245bd83cfe574ec52dec840295222f26cfd06d (patch)
tree1dd9cc4a80c7a5032af581d864d2c4a49959b039 /bundles
parent20a108077d63012c1fd748f48e1a7e18e5072d9a (diff)
downloadrt.equinox.p2-cc245bd83cfe574ec52dec840295222f26cfd06d.tar.gz
rt.equinox.p2-cc245bd83cfe574ec52dec840295222f26cfd06d.tar.xz
rt.equinox.p2-cc245bd83cfe574ec52dec840295222f26cfd06d.zip
Bug 227032 [ui] Early startup extension shows up weird
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/prefs/ClassicUpdateInitializer.java57
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/prefs/PreferenceConstants.java1
2 files changed, 45 insertions, 13 deletions
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/prefs/ClassicUpdateInitializer.java b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/prefs/ClassicUpdateInitializer.java
index 511ab30bb..81f56a957 100644
--- a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/prefs/ClassicUpdateInitializer.java
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/prefs/ClassicUpdateInitializer.java
@@ -12,31 +12,62 @@ package org.eclipse.equinox.internal.p2.ui.sdk.prefs;
import java.util.HashSet;
import java.util.Set;
-import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.core.runtime.preferences.*;
+import org.eclipse.equinox.internal.p2.ui.sdk.ProvSDKUIActivator;
+import org.eclipse.equinox.internal.provisional.p2.ui.ProvUI;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.activities.IMutableActivityManager;
import org.eclipse.ui.activities.IWorkbenchActivitySupport;
+import org.eclipse.ui.statushandlers.StatusManager;
+import org.osgi.service.prefs.BackingStoreException;
public class ClassicUpdateInitializer extends AbstractPreferenceInitializer {
+ private static final String P_ENABLED = "enabled"; //$NON-NLS-1$
private static final String ACTIVITY_ID = "org.eclipse.equinox.p2.ui.sdk.classicUpdate"; //$NON-NLS-1$
+ private static final String UPDATE_PLUGIN_ID = "org.eclipse.update.scheduler"; //$NON-NLS-1$
public void initializeDefaultPreferences() {
IWorkbench workbench = PlatformUI.getWorkbench();
- if (workbench == null) {
- return;
+ if (workbench != null) {
+ final IWorkbenchActivitySupport activitySupport = workbench.getActivitySupport();
+ IMutableActivityManager createWorkingCopy = activitySupport.createWorkingCopy();
+ Set activityIds = createWorkingCopy.getEnabledActivityIds();
+ final Set enabledActivityIds = new HashSet(activityIds);
+ enabledActivityIds.remove(ACTIVITY_ID);
+ workbench.getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ //activity change listeners may touch widgets
+ activitySupport.setEnabledActivityIds(enabledActivityIds);
+ }
+ });
}
- final IWorkbenchActivitySupport activitySupport = workbench.getActivitySupport();
- IMutableActivityManager createWorkingCopy = activitySupport.createWorkingCopy();
- Set activityIds = createWorkingCopy.getEnabledActivityIds();
- final Set enabledActivityIds = new HashSet(activityIds);
- enabledActivityIds.remove(ACTIVITY_ID);
- workbench.getDisplay().asyncExec(new Runnable() {
- public void run() {
- //activity change listeners may touch widgets
- activitySupport.setEnabledActivityIds(enabledActivityIds);
+ Preferences prefP2 = ProvSDKUIActivator.getDefault().getPluginPreferences();
+ //only migrate auto-update preference from UM once
+ boolean autoUpdateInit = prefP2.getBoolean(PreferenceConstants.PREF_AUTO_UPDATE_INIT);
+ if (!autoUpdateInit) {
+ // get UM automatic update preference
+ IPreferencesService preferencesService = Platform.getPreferencesService();
+ org.osgi.service.prefs.Preferences instanceScope = preferencesService.getRootNode().node(InstanceScope.SCOPE);
+ try {
+ boolean updateNodeExists = instanceScope.nodeExists(UPDATE_PLUGIN_ID);
+ org.osgi.service.prefs.Preferences prefUM = instanceScope.node(UPDATE_PLUGIN_ID);
+ boolean enableUpdate = prefUM.getBoolean(P_ENABLED, false);
+ // set p2 automatic update preference to match UM preference
+ prefP2.setValue(PreferenceConstants.PREF_AUTO_UPDATE_ENABLED, enableUpdate);
+ prefP2.setValue(PreferenceConstants.PREF_AUTO_UPDATE_INIT, true);
+ ProvSDKUIActivator.getDefault().savePluginPreferences();
+ // turn off UM automatic update preference if it exists
+ if (updateNodeExists) {
+ prefUM.putBoolean(P_ENABLED, false);
+ prefUM.flush();
+ }
+ } catch (BackingStoreException e) {
+ ProvUI.handleException(e, "Error saving classic update preferences", StatusManager.LOG); //$NON-NLS-1$
}
- });
+ }
}
}
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/prefs/PreferenceConstants.java b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/prefs/PreferenceConstants.java
index b396d4d7f..cf6e9cbfe 100644
--- a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/prefs/PreferenceConstants.java
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/prefs/PreferenceConstants.java
@@ -27,4 +27,5 @@ public class PreferenceConstants {
public static final String PREF_OPEN_WIZARD_ON_ERROR_PLAN = "allowNonOKPlan"; //$NON-NLS-1$
public static final String PREF_GENERATE_ARCHIVEREPOFOLDER = "generateReposForArchive"; //$NON-NLS-1$
public static final String PREF_AUTO_INSTALL_BUNDLES = "autoInstallBundles"; //$NON-NLS-1$
+ public static final String PREF_AUTO_UPDATE_INIT = "autoUpdateInit"; //$NON-NLS-1$
}

Back to the top