String id= JavaPlugin.getDefault().getPreferenceStore().getString(PreferenceConstants.EDITOR_FOLDING_PROVIDER); JavaFoldingStructureProviderDescriptor desc= getFoldingProviderDescriptor(id); if (desc != null) { try { return desc.createProvider(); } catch (CoreException e) { JavaPlugin.log(e); }
IPreferenceStore preferenceStore= JavaPlugin.getDefault().getPreferenceStore(); String currentProviderId= preferenceStore.getString(PreferenceConstants.EDITOR_FOLDING_PROVIDER); JavaFoldingStructureProviderDescriptor desc= getFoldingProviderDescriptor(currentProviderId);   if (desc == null) { String message= Messages.format(FoldingMessages.JavaFoldingStructureProviderRegistry_warning_providerNotFound_resetToDefault, currentProviderId); JavaPlugin.log(new Status(IStatus.WARNING, JavaPlugin.getPluginId(), IStatus.OK, message, null));  String defaultProviderId= preferenceStore.getDefaultString(PreferenceConstants.EDITOR_FOLDING_PROVIDER);  desc= getFoldingProviderDescriptor(defaultProviderId); Assert.isNotNull(desc);  preferenceStore.setToDefault(PreferenceConstants.EDITOR_FOLDING_PROVIDER);
	public IJavaFoldingStructureProvider getCurrentFoldingProvider() {		String id= JavaPlugin.getDefault().getPreferenceStore().getString(PreferenceConstants.EDITOR_FOLDING_PROVIDER);		JavaFoldingStructureProviderDescriptor desc= getFoldingProviderDescriptor(id);		if (desc != null) {			try {				return desc.createProvider();			} catch (CoreException e) {				JavaPlugin.log(e);			}		}		return null;	}