Set enabledActivities = new HashSet(previouslyEnabledActivities);
IPreferenceStore store = WorkbenchPlugin.getDefault()
.getPreferenceStore();
IWorkbenchActivitySupport support = PlatformUI.getWorkbench()
.getActivitySupport();
IActivityManager activityManager = support.getActivityManager();
for (Iterator i = activityIdsToProcess.iterator(); i
.hasNext();) {
String activityId = (String) i.next();
String preferenceKey = createPreferenceKey(activityId);
try {
IActivity activity = activityManager.getActivity(activityId);
if ("".equals(store.getDefaultString(preferenceKey))) { //$NON-NLS-1$ // no override has been provided in the customization file
store // the default should be whatever the XML specifies
.setDefault(preferenceKey, activity
.isDefaultEnabled());
}
} catch (NotDefinedException e) {
// can't happen - we're iterating over defined activities
}
if (store.getBoolean(preferenceKey)) {
enabledActivities.add(activityId);
} else {
enabledActivities.remove(activityId);
}
}
support.setEnabledActivityIds(enabledActivities);
}