bug 324927 removed getAllConfigItemFactories() and getAllConfigItems()
from the public infterface of ConfigurationRegistry
diff --git a/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/ConfigurationRegistry.java b/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/ConfigurationRegistry.java
index 686fd08..c245311 100644
--- a/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/ConfigurationRegistry.java
+++ b/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/ConfigurationRegistry.java
@@ -10,8 +10,6 @@
  *******************************************************************************/

 package org.eclipse.wst.xml.vex.ui.internal.config;

 

-import java.util.List;

-

 import org.eclipse.core.resources.IProject;

 

 /**

@@ -25,12 +23,8 @@
 

 	IConfigItemFactory getConfigItemFactory(String extensionPointId);

 

-	IConfigItemFactory[] getAllConfigItemFactories();

-

 	ConfigItem getConfigItem(String extensionPoint, String id);

 	

-	List<ConfigItem> getAllConfigItems(String extensionPointId);

-

 	void fireConfigChanged(final ConfigEvent e);

 	

 	void fireConfigLoaded(final ConfigEvent e);

@@ -48,6 +42,8 @@
 	

 	DocumentType getDocumentType(final String publicId);

 	

+	DocumentType[] getDocumentTypes();

+	

 	DocumentType[] getDocumentTypesWithStyles();

 	

 	Style[] getStyles(final String publicId);

diff --git a/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/ConfigurationRegistryImpl.java b/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/ConfigurationRegistryImpl.java
index a548874..dfd30c5 100644
--- a/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/ConfigurationRegistryImpl.java
+++ b/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/ConfigurationRegistryImpl.java
@@ -147,20 +147,13 @@
 	}
 
 	/**
-	 * Returns an array of all config item factories.
-	 */
-	public IConfigItemFactory[] getAllConfigItemFactories() {
-		return configItemFactories.toArray(new IConfigItemFactory[configItemFactories.size()]);
-	}
-
-	/**
 	 * Returns an array of all registered ConfigItem objects implementing the
 	 * given extension point.
 	 * 
 	 * @param extensionPointId
 	 *            ID of the desired extension point.
 	 */
-	public List<ConfigItem> getAllConfigItems(final String extensionPointId) {
+	private List<ConfigItem> getAllConfigItems(final String extensionPointId) {
 		try {
 			lock();
 			final List<ConfigItem> result = new ArrayList<ConfigItem>();
@@ -312,6 +305,13 @@
 		return null;
 	}
 
+	public DocumentType[] getDocumentTypes() {
+		final List<DocumentType> result = new ArrayList<DocumentType>();
+		for (final ConfigItem configItem : getAllConfigItems(DocumentType.EXTENSION_POINT))
+			result.add((DocumentType) configItem);
+		return result.toArray(new DocumentType[result.size()]);
+	}
+
 	/**
 	 * Return a list of document types for which there is at least one
 	 * registered style.
@@ -331,7 +331,7 @@
 
 	public Style[] getStyles(final String publicId) {
 		final ArrayList<Style> result = new ArrayList<Style>();
-		for (final ConfigItem configItem : ConfigurationRegistry.INSTANCE.getAllConfigItems(Style.EXTENSION_POINT)) {
+		for (final ConfigItem configItem : getAllConfigItems(Style.EXTENSION_POINT)) {
 			final Style style = (Style) configItem;
 			if (style.appliesTo(publicId))
 				result.add(style);
@@ -340,7 +340,7 @@
 	}
 
 	public Style getStyle(final String styleId) {
-		for (final ConfigItem configItem : ConfigurationRegistry.INSTANCE.getAllConfigItems(Style.EXTENSION_POINT)) {
+		for (final ConfigItem configItem : getAllConfigItems(Style.EXTENSION_POINT)) {
 			final Style style = (Style) configItem;
 			if (style.getUniqueId().equals(styleId))
 				return style;
diff --git a/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/ConfigurationView.java b/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/ConfigurationView.java
index 6695844..e60df80 100644
--- a/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/ConfigurationView.java
+++ b/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/ConfigurationView.java
@@ -11,9 +11,6 @@
  *******************************************************************************/
 package org.eclipse.wst.xml.vex.ui.internal.config;
 
-import java.util.Collections;
-import java.util.List;
-
 import org.eclipse.jface.viewers.ITreeContentProvider;
 import org.eclipse.jface.viewers.LabelProvider;
 import org.eclipse.jface.viewers.TreeViewer;
@@ -28,30 +25,31 @@
  */
 public class ConfigurationView extends ViewPart {
 
-	public void createPartControl(Composite parent) {
+	@Override
+	public void createPartControl(final Composite parent) {
 
-		this.parentControl = parent;
+		parentControl = parent;
 
-		ConfigurationRegistry.INSTANCE.addConfigListener(this.configListener);
-		if (ConfigurationRegistry.INSTANCE.isLoaded()) {
-			this.createTreeViewer();
-		} else {
-			this.loadingLabel = new Label(parent, SWT.NONE);
-			this.loadingLabel.setText(Messages
-					.getString("ConfigurationView.loading")); //$NON-NLS-1$
+		ConfigurationRegistry.INSTANCE.addConfigListener(configListener);
+		if (ConfigurationRegistry.INSTANCE.isLoaded())
+			createTreeViewer();
+		else {
+			loadingLabel = new Label(parent, SWT.NONE);
+			loadingLabel.setText(Messages.getString("ConfigurationView.loading")); //$NON-NLS-1$
 		}
 
 	}
 
+	@Override
 	public void dispose() {
 		super.dispose();
-		ConfigurationRegistry.INSTANCE.removeConfigListener(this.configListener);
+		ConfigurationRegistry.INSTANCE.removeConfigListener(configListener);
 	}
 
+	@Override
 	public void setFocus() {
-		if (this.treeViewer != null) {
-			this.treeViewer.getTree().setFocus();
-		}
+		if (treeViewer != null)
+			treeViewer.getTree().setFocus();
 	}
 
 	// ===================================================== PRIVATE
@@ -63,70 +61,62 @@
 	private TreeViewer treeViewer;
 
 	private void createTreeViewer() {
-		this.treeViewer = new TreeViewer(this.parentControl, SWT.SINGLE);
-		this.treeViewer.setContentProvider(new ContentProvider());
-		this.treeViewer.setLabelProvider(new MyLabelProvider());
-		this.treeViewer.setAutoExpandLevel(2);
-		this.treeViewer.setInput(ConfigurationRegistry.INSTANCE);
+		treeViewer = new TreeViewer(parentControl, SWT.SINGLE);
+		treeViewer.setContentProvider(new MyContentProvider());
+		treeViewer.setLabelProvider(new MyLabelProvider());
+		treeViewer.setAutoExpandLevel(2);
+		treeViewer.setInput(ConfigurationRegistry.INSTANCE);
 	}
 
-	private static class ContentProvider implements ITreeContentProvider {
-
-		public Object[] getChildren(Object parentElement) {
-			if (parentElement instanceof IConfigItemFactory) {
-				IConfigItemFactory factory = (IConfigItemFactory) parentElement;
-				List<ConfigItem> items = ConfigurationRegistry.INSTANCE.getAllConfigItems(
-						factory.getExtensionPointId());
-				Collections.sort(items);
-				return items.toArray();
-			} else {
-				return null;
-			}
+	private static class MyContentProvider implements ITreeContentProvider {
+		public Object[] getChildren(final Object parentElement) {
+			if (parentElement instanceof ConfigurationRegistry)
+				return ConfigurationRegistry.INSTANCE.getDocumentTypes();
+			if (parentElement instanceof DocumentType)
+				return ConfigurationRegistry.INSTANCE.getStyles(((DocumentType) parentElement).getPublicId());
+			return new Object[0];
 		}
 
-		public Object getParent(Object element) {
-			if (element instanceof ConfigItem) {
-				ConfigItem item = (ConfigItem) element;
-				return ConfigurationRegistry.INSTANCE.getConfigItemFactory(
-						item.getExtensionPointId());
-			} else {
+		public Object getParent(final Object element) {
+			if (element instanceof DocumentType)
 				return ConfigurationRegistry.INSTANCE;
-			}
+			if (element instanceof Style) 
+				return ConfigurationRegistry.INSTANCE.getDocumentType(((Style) element).getDocumentTypes().iterator().next());
+			return null;
 		}
 
-		public boolean hasChildren(Object element) {
-			return element instanceof IConfigItemFactory;
+		public boolean hasChildren(final Object element) {
+			return getChildren(element).length > 0;
 		}
 
-		public Object[] getElements(Object inputElement) {
-			return ConfigurationRegistry.INSTANCE.getAllConfigItemFactories();
+		public Object[] getElements(final Object inputElement) {
+			return getChildren(inputElement);
 		}
 
 		public void dispose() {
 		}
 
-		public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+		public void inputChanged(final Viewer viewer, final Object oldInput, final Object newInput) {
 		}
-
 	}
 
 	private static class MyLabelProvider extends LabelProvider {
-
-		public String getText(Object element) {
-			if (element instanceof IConfigItemFactory) {
-				return ((IConfigItemFactory) element).getPluralName();
-			} else {
-				return ((ConfigItem) element).getName();
-			}
+		@Override
+		public String getText(final Object element) {
+			if (element instanceof DocumentType)
+				return ((DocumentType) element).getName();
+			if (element instanceof Style)
+				return ((Style) element).getName();
+			return null;
 		}
 	}
 
-	private IConfigListener configListener = new IConfigListener() {
-		public void configChanged(ConfigEvent e) {
+	private final IConfigListener configListener = new IConfigListener() {
+		public void configChanged(final ConfigEvent e) {
 			treeViewer.refresh();
 		}
 
-		public void configLoaded(ConfigEvent e) {
+		public void configLoaded(final ConfigEvent e) {
 			loadingLabel.dispose();
 			createTreeViewer();
 			parentControl.layout();
diff --git a/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/Style.java b/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/Style.java
index c2dcc32..b060e40 100644
--- a/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/Style.java
+++ b/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/Style.java
@@ -69,22 +69,6 @@
 	}
 
 	/**
-	 * Returns an array of all styles applicable to the given public Id.
-	 * 
-	 * @param publicId
-	 *            Public ID for which to find styles.
-	 */
-	public static Style[] getStylesForDoctype(final String publicId) {
-		final List<Style> styles = new ArrayList<Style>();
-		for (final ConfigItem configItem : ConfigurationRegistry.INSTANCE.getAllConfigItems(Style.EXTENSION_POINT)) {
-			final Style style = (Style) configItem;
-			if (style.appliesTo(publicId))
-				styles.add(style);
-		}
-		return styles.toArray(new Style[styles.size()]);
-	}
-
-	/**
 	 * Returns the style sheet from which element styles are taken.
 	 */
 	public StyleSheet getStyleSheet() {
diff --git a/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/StylePropertyPage.java b/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/StylePropertyPage.java
index d95466c..739f78c 100644
--- a/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/StylePropertyPage.java
+++ b/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/StylePropertyPage.java
@@ -13,8 +13,7 @@
 
 import java.text.MessageFormat;
 import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
+import java.util.Arrays;
 import java.util.Set;
 import java.util.TreeSet;
 
@@ -38,7 +37,8 @@
  */
 public class StylePropertyPage extends PropertyPage {
 
-	protected Control createContents(Composite parent) {
+	@Override
+	protected Control createContents(final Composite parent) {
 
 		pane = new Composite(parent, SWT.NONE);
 
@@ -57,9 +57,8 @@
 
 				try { // force an incremental build
 					getPluginProject().writeConfigXml();
-				} catch (Exception ex) {
-					String message = MessageFormat.format(Messages
-							.getString("StylePropertyPage.writeError"), //$NON-NLS-1$
+				} catch (final Exception ex) {
+					final String message = MessageFormat.format(Messages.getString("StylePropertyPage.writeError"), //$NON-NLS-1$
 							new Object[] { PluginProject.PLUGIN_XML });
 					VexPlugin.getInstance().log(IStatus.ERROR, message, ex);
 				}
@@ -87,7 +86,7 @@
 
 	private void createPropertySheet() {
 
-		GridLayout layout = new GridLayout();
+		final GridLayout layout = new GridLayout();
 		layout.numColumns = 2;
 		pane.setLayout(layout);
 		GridData gd;
@@ -96,28 +95,25 @@
 
 		label = new Label(pane, SWT.NONE);
 		label.setText(Messages.getString("StylePropertyPage.name")); //$NON-NLS-1$
-		this.nameText = new Text(pane, SWT.BORDER);
+		nameText = new Text(pane, SWT.BORDER);
 		gd = new GridData();
 		gd.widthHint = NAME_WIDTH;
-		this.nameText.setLayoutData(gd);
+		nameText.setLayoutData(gd);
 
-		final String resourcePath = ((IFile) this.getElement())
-				.getProjectRelativePath().toString();
+		final String resourcePath = ((IFile) getElement()).getProjectRelativePath().toString();
 
-		final ConfigSource config = this.getPluginProject();
+		final ConfigSource config = getPluginProject();
 
-		this.style = (Style) config.getItemForResource(resourcePath);
-		if (this.style == null) {
-			this.style = new Style(config);
-			this.style.setResourcePath(resourcePath);
-			config.addItem(this.style);
+		style = (Style) config.getItemForResource(resourcePath);
+		if (style == null) {
+			style = new Style(config);
+			style.setResourcePath(resourcePath);
+			config.addItem(style);
 		}
 
 		// Generate a simple ID for this one if necessary
-		if (this.style.getSimpleId() == null
-				|| this.style.getSimpleId().length() == 0) {
-			this.style.setSimpleId(this.style.generateSimpleId());
-		}
+		if (style.getSimpleId() == null || style.getSimpleId().length() == 0)
+			style.setSimpleId(style.generateSimpleId());
 
 		label = new Label(pane, SWT.NONE);
 		label.setText(Messages.getString("StylePropertyPage.doctypes")); //$NON-NLS-1$
@@ -135,7 +131,7 @@
 		final FillLayout fillLayout = new FillLayout();
 		tablePane.setLayout(fillLayout);
 
-		this.doctypesTable = new Table(tablePane, SWT.CHECK);
+		doctypesTable = new Table(tablePane, SWT.CHECK);
 
 	}
 
@@ -145,10 +141,11 @@
 	 * @return
 	 */
 	public PluginProject getPluginProject() {
-		IFile file = (IFile) this.getElement();
+		final IFile file = (IFile) getElement();
 		return ConfigurationRegistry.INSTANCE.getPluginProject(file.getProject());
 	}
 
+	@Override
 	public boolean performOk() {
 
 		performApply();
@@ -156,35 +153,28 @@
 		return super.performOk();
 	}
 
+	@Override
 	public void performApply() {
 
-		this.style.setName(this.nameText.getText());
-
-		List<ConfigItem> doctypeList = ConfigurationRegistry.INSTANCE.getAllConfigItems(
-				DocumentType.EXTENSION_POINT);
-		Collections.sort(doctypeList);
+		style.setName(nameText.getText());
 
 		final ArrayList<String> selectedDoctypes = new ArrayList<String>();
-		for (TableItem item : this.doctypesTable.getItems()) {
-			if (item.getChecked()) {
+		for (final TableItem item : doctypesTable.getItems())
+			if (item.getChecked())
 				selectedDoctypes.add(item.getText());
-			}
-		}
 
-		this.style.removeAllDocumentTypes();
+		style.removeAllDocumentTypes();
 
-		for (ConfigItem configItem : doctypeList) {
-			DocumentType documentType = (DocumentType)configItem;
-			if (selectedDoctypes.contains(documentType.getName())) {
-				this.style.addDocumentType(documentType.getPublicId());
-			}			
-		}
+		final DocumentType[] documentTypes = ConfigurationRegistry.INSTANCE.getDocumentTypes();
+		Arrays.sort(documentTypes);
+		for (final DocumentType documentType : documentTypes)
+			if (selectedDoctypes.contains(documentType.getName()))
+				style.addDocumentType(documentType.getPublicId());
 
 		try {
-			this.getPluginProject().writeConfigXml();
-		} catch (Exception e) {
-			String message = MessageFormat.format(Messages
-					.getString("StylePropertyPage.writeError"), //$NON-NLS-1$
+			getPluginProject().writeConfigXml();
+		} catch (final Exception e) {
+			final String message = MessageFormat.format(Messages.getString("StylePropertyPage.writeError"), //$NON-NLS-1$
 					new Object[] { PluginProject.PLUGIN_XML });
 			VexPlugin.getInstance().log(IStatus.ERROR, message, e);
 		}
@@ -192,6 +182,7 @@
 		ConfigurationRegistry.INSTANCE.fireConfigChanged(new ConfigEvent(this));
 	}
 
+	@Override
 	protected void performDefaults() {
 
 		super.performDefaults();
@@ -202,13 +193,12 @@
 
 	}
 
+	@Override
 	public void dispose() {
 		super.dispose();
 
-		if (this.configListener != null) {
-			ConfigurationRegistry.INSTANCE.removeConfigListener(
-					this.configListener);
-		}
+		if (configListener != null)
+			ConfigurationRegistry.INSTANCE.removeConfigListener(configListener);
 	}
 
 	// ======================================================= PRIVATE
@@ -223,29 +213,25 @@
 	private IConfigListener configListener;
 
 	private void populateStyle() {
-		this.setText(this.nameText, this.style.getName());
+		setText(nameText, style.getName());
 
 	}
 
 	private void populateDoctypes() {
-
-		final Set<String> selectedDoctypes = new TreeSet<String>(this.style.getDocumentTypes());
+		final Set<String> selectedDoctypes = new TreeSet<String>(style.getDocumentTypes());
 		doctypesTable.removeAll();
 
-		List<ConfigItem> doctypeList = ConfigurationRegistry.INSTANCE.getAllConfigItems(
-				DocumentType.EXTENSION_POINT);
-		Collections.sort(doctypeList);
-		for (ConfigItem configItem : doctypeList) {
-			DocumentType documentType=(DocumentType)configItem;
-			TableItem item1 = new TableItem(doctypesTable, SWT.NONE);
-			item1.setText(documentType.getName());
-			if (selectedDoctypes.contains(documentType.getPublicId())) {
-				item1.setChecked(true);
-			}
+		final DocumentType[] documentTypes = ConfigurationRegistry.INSTANCE.getDocumentTypes();
+		Arrays.sort(documentTypes);
+		for (final DocumentType documentType : documentTypes) {
+			final TableItem item = new TableItem(doctypesTable, SWT.NONE);
+			item.setText(documentType.getName());
+			if (selectedDoctypes.contains(documentType.getPublicId()))
+				item.setChecked(true);
 		}
 	}
 
-	private void setText(Text textBox, String s) {
+	private void setText(final Text textBox, final String s) {
 		textBox.setText(s == null ? "" : s); //$NON-NLS-1$
 	}
 
diff --git a/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/editor/VexEditorMultiPage.java b/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/editor/VexEditorMultiPage.java
index 89caedb..554081d 100644
--- a/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/editor/VexEditorMultiPage.java
+++ b/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/editor/VexEditorMultiPage.java
@@ -109,8 +109,7 @@
 	 * Class constructor.
 	 */
 	public VexEditorMultiPage() {
-		this.debugging = VexPlugin.getInstance().isDebugging()
-				&& "true".equalsIgnoreCase(Platform.getDebugOption(VexPlugin.ID + "/debug/layout")); //$NON-NLS-1$ //$NON-NLS-2$
+		this.debugging = VexPlugin.getInstance().isDebugging() && "true".equalsIgnoreCase(Platform.getDebugOption(VexPlugin.ID + "/debug/layout")); //$NON-NLS-1$ //$NON-NLS-2$
 	}
 
 	/**
@@ -129,13 +128,11 @@
 		if (this.parentControl != null) {
 			// createPartControl was called, so we must de-register from config
 			// events
-			ConfigurationRegistry.INSTANCE.removeConfigListener(
-					this.configListener);
+			ConfigurationRegistry.INSTANCE.removeConfigListener(this.configListener);
 		}
 
 		if (getEditorInput() instanceof IFileEditorInput) {
-			ResourcesPlugin.getWorkspace().removeResourceChangeListener(
-					this.resourceChangeListener);
+			ResourcesPlugin.getWorkspace().removeResourceChangeListener(this.resourceChangeListener);
 		}
 
 	}
@@ -147,20 +144,16 @@
 		try {
 			this.resourceChangeListener.setSaving(true);
 			DocumentWriter writer = new DocumentWriter();
-			writer.setWhitespacePolicy(new CssWhitespacePolicy(this.style
-					.getStyleSheet()));
+			writer.setWhitespacePolicy(new CssWhitespacePolicy(this.style.getStyleSheet()));
 
 			if (input instanceof IFileEditorInput) {
 				ByteArrayOutputStream baos = new ByteArrayOutputStream();
 				writer.write(this.doc, baos);
 				baos.close();
-				ByteArrayInputStream bais = new ByteArrayInputStream(baos
-						.toByteArray());
-				((IFileEditorInput) input).getFile().setContents(bais, false,
-						false, monitor);
+				ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+				((IFileEditorInput) input).getFile().setContents(bais, false, false, monitor);
 			} else {
-				os = new FileOutputStream(((ILocationProvider) input).getPath(
-						input).toFile());
+				os = new FileOutputStream(((ILocationProvider) input).getPath(input).toFile());
 				writer.write(this.doc, os);
 			}
 
@@ -170,11 +163,9 @@
 		} catch (Exception ex) {
 			monitor.setCanceled(true);
 			String title = Messages.getString("VexEditor.errorSaving.title"); //$NON-NLS-1$
-			String message = MessageFormat.format(Messages
-					.getString("VexEditor.errorSaving.message"), //$NON-NLS-1$
+			String message = MessageFormat.format(Messages.getString("VexEditor.errorSaving.message"), //$NON-NLS-1$
 					new Object[] { input.getName(), ex.getMessage() });
-			MessageDialog.openError(this.getEditorSite().getShell(), title,
-					message);
+			MessageDialog.openError(this.getEditorSite().getShell(), title, message);
 			VexPlugin.getInstance().log(IStatus.ERROR, message, ex);
 		} finally {
 			if (os != null) {
@@ -196,15 +187,12 @@
 				this.resourceChangeListener.setSaving(true);
 				ByteArrayOutputStream baos = new ByteArrayOutputStream();
 				DocumentWriter writer = new DocumentWriter();
-				writer.setWhitespacePolicy(new CssWhitespacePolicy(this.style
-						.getStyleSheet()));
+				writer.setWhitespacePolicy(new CssWhitespacePolicy(this.style.getStyleSheet()));
 				writer.write(this.doc, baos);
 				baos.close();
 
-				ByteArrayInputStream bais = new ByteArrayInputStream(baos
-						.toByteArray());
-				IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(
-						path);
+				ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+				IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
 				file.create(bais, false, null);
 
 				IFileEditorInput input = new FileEditorInput(file);
@@ -216,13 +204,10 @@
 				this.firePropertyChange(EditorPart.PROP_TITLE);
 
 			} catch (Exception ex) {
-				String title = Messages
-						.getString("VexEditor.errorSaving.title"); //$NON-NLS-1$
-				String message = MessageFormat.format(Messages
-						.getString("VexEditor.errorSaving.message"), //$NON-NLS-1$
+				String title = Messages.getString("VexEditor.errorSaving.title"); //$NON-NLS-1$
+				String message = MessageFormat.format(Messages.getString("VexEditor.errorSaving.message"), //$NON-NLS-1$
 						new Object[] { path, ex.getMessage() });
-				MessageDialog.openError(this.getEditorSite().getShell(), title,
-						message);
+				MessageDialog.openError(this.getEditorSite().getShell(), title, message);
 				VexPlugin.getInstance().log(IStatus.ERROR, message, ex);
 			} finally {
 				this.resourceChangeListener.setSaving(false);
@@ -237,29 +222,14 @@
 	 * @param publicId
 	 *            Public ID for which to return the style.
 	 */
-	public static Style findStyleForDoctype(String publicId) {
+	public static Style getPreferredStyle(final String publicId) {
+		return ConfigurationRegistry.INSTANCE.getStyle(publicId, getPreferredStyleId(publicId));
+	}
 
-		IPreferencesService preferences = Platform.getPreferencesService();
-		String key = getStylePreferenceKey(publicId);
-		String preferredStyleId = preferences.getString(VexPlugin.ID, key,
-				null, null);
-
-		Preferences prefs = new InstanceScope().getNode(VexPlugin.ID);
-		preferredStyleId = prefs.get(key, null);
-
-		Style firstStyle = null;
-		for (ConfigItem configItem : ConfigurationRegistry.INSTANCE.getAllConfigItems(Style.EXTENSION_POINT)) {
-			Style style = (Style) configItem;
-			if (style.appliesTo(publicId)) {
-				if (firstStyle == null) {
-					firstStyle = style;
-				}
-				if (style.getUniqueId().equals(preferredStyleId)) {
-					return style;
-				}
-			}
-		}
-		return firstStyle;
+	private static String getPreferredStyleId(final String publicId) {
+		final Preferences prefs = new InstanceScope().getNode(VexPlugin.ID);
+		final String preferredStyleId = prefs.get(getStylePreferenceKey(publicId), null);
+		return preferredStyleId;
 	}
 
 	/**
@@ -288,28 +258,23 @@
 
 	}
 
-	public void init(IEditorSite site, IEditorInput input)
-			throws PartInitException {
+	public void init(IEditorSite site, IEditorInput input) throws PartInitException {
 
 		this.setSite(site);
 		this.setInput(input);
 
 		this.getEditorSite().setSelectionProvider(this.selectionProvider);
-		this.getEditorSite().getSelectionProvider()
-				.addSelectionChangedListener(selectionChangedListener);
+		this.getEditorSite().getSelectionProvider().addSelectionChangedListener(selectionChangedListener);
 
 		if (input instanceof IFileEditorInput) {
-			ResourcesPlugin.getWorkspace().addResourceChangeListener(
-					this.resourceChangeListener,
-					IResourceChangeEvent.POST_CHANGE);
+			ResourcesPlugin.getWorkspace().addResourceChangeListener(this.resourceChangeListener, IResourceChangeEvent.POST_CHANGE);
 		}
 	}
 
 	protected void loadInput() {
 
 		if (this.vexWidget != null) {
-			this.vexEditorListeners.fireEvent(
-					"documentUnloaded", new VexEditorMultiPageEvent(this)); //$NON-NLS-1$
+			this.vexEditorListeners.fireEvent("documentUnloaded", new VexEditorMultiPageEvent(this)); //$NON-NLS-1$
 		}
 
 		this.loaded = false;
@@ -321,21 +286,18 @@
 
 			IPath inputPath = null;
 
-			IModelManager modelManager = StructuredModelManager
-					.getModelManager();
+			IModelManager modelManager = StructuredModelManager.getModelManager();
 			IStructuredDocument structuredDocument = null;
 			IStructuredModel model = null;
 
 			if (input instanceof IFileEditorInput) {
-				inputPath = ((IFileEditorInput) input).getFile()
-						.getRawLocation();
+				inputPath = ((IFileEditorInput) input).getFile().getRawLocation();
 			} else if (input instanceof ILocationProvider) {
 				// Yuck, this a crappy way for Eclipse to do this
 				// How about an exposed IJavaFileEditorInput, pleeze?
 				inputPath = ((ILocationProvider) input).getPath(input);
 			} else {
-				String msg = MessageFormat.format(Messages
-						.getString("VexEditor.unknownInputClass"), //$NON-NLS-1$
+				String msg = MessageFormat.format(Messages.getString("VexEditor.unknownInputClass"), //$NON-NLS-1$
 						new Object[] { input.getClass() });
 				this.showLabel(msg);
 				return;
@@ -352,8 +314,7 @@
 
 			if (this.debugging) {
 				long end = System.currentTimeMillis();
-				System.out
-						.println("Parsed document in " + (end - start) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$
+				System.out.println("Parsed document in " + (end - start) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$
 			}
 
 			if (input instanceof IFileEditorInput) {
@@ -362,13 +323,12 @@
 				model = modelManager.getModelForEdit(file);
 				structuredDocument = model.getStructuredDocument();
 			}
-			
+
 			IDOMDocument domDocument = ((IDOMModel) model).getDocument();
 			doc = new Document(domDocument);
 			doc.setPublicID(domDocument.getDoctype().getPublicId());
 			doc.setSystemID(domDocument.getDoctype().getSystemId());
-			doc.setEncoding(structuredDocument.getEncodingMemento()
-					.getJavaCharsetName());
+			doc.setEncoding(structuredDocument.getEncodingMemento().getJavaCharsetName());
 			doctype = ConfigurationRegistry.INSTANCE.getDocumentType(doc.getPublicID());
 			wsFactory.getPolicy(doc.getPublicID());
 
@@ -376,14 +336,12 @@
 			// this.style is set by wsPolicyFactory
 			// Otherwise, a PartInitException would have been thrown by now
 
-			Validator validator = WTPVEXValidator.create(doctype
-					.getResourceUrl());
+			Validator validator = WTPVEXValidator.create(doctype.getResourceUrl());
 			if (validator != null) {
 				this.doc.setValidator(validator);
 				if (this.debugging) {
 					long end = System.currentTimeMillis();
-					System.out
-							.println("Got validator in " + (end - start) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$
+					System.out.println("Got validator in " + (end - start) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$
 				}
 			}
 
@@ -403,8 +361,7 @@
 			firePropertyChange(EditorPart.PROP_DIRTY);
 			this.wasDirty = isDirty();
 
-			this.vexEditorListeners.fireEvent(
-					"documentLoaded", new VexEditorMultiPageEvent(this)); //$NON-NLS-1$
+			this.vexEditorListeners.fireEvent("documentLoaded", new VexEditorMultiPageEvent(this)); //$NON-NLS-1$
 
 		} catch (SAXParseException ex) {
 
@@ -412,19 +369,16 @@
 				// TODO doc did not have document type and the user
 				// declined to select another one. Should fail silently.
 				String msg;
-				NoRegisteredDoctypeException ex2 = (NoRegisteredDoctypeException) ex
-						.getException();
+				NoRegisteredDoctypeException ex2 = (NoRegisteredDoctypeException) ex.getException();
 				if (ex2.getPublicId() == null) {
 					msg = Messages.getString("VexEditor.noDoctype"); //$NON-NLS-1$
 				} else {
-					msg = MessageFormat.format(Messages
-							.getString("VexEditor.unknownDoctype"), //$NON-NLS-1$
+					msg = MessageFormat.format(Messages.getString("VexEditor.unknownDoctype"), //$NON-NLS-1$
 							new Object[] { ex2.getPublicId() });
 				}
 				this.showLabel(msg);
 			} else if (ex.getException() instanceof NoStyleForDoctypeException) {
-				String msg = MessageFormat.format(Messages
-						.getString("VexEditor.noStyles"), //$NON-NLS-1$
+				String msg = MessageFormat.format(Messages.getString("VexEditor.noStyles"), //$NON-NLS-1$
 						new Object[] { this.doctype.getPublicId() });
 				this.showLabel(msg);
 			} else {
@@ -433,10 +387,8 @@
 					file = input.getName();
 				}
 
-				String msg = MessageFormat.format(Messages
-						.getString("VexEditor.parseError"), //$NON-NLS-1$
-						new Object[] { Integer.valueOf(ex.getLineNumber()), file,
-								ex.getLocalizedMessage() });
+				String msg = MessageFormat.format(Messages.getString("VexEditor.parseError"), //$NON-NLS-1$
+						new Object[] { Integer.valueOf(ex.getLineNumber()), file, ex.getLocalizedMessage() });
 
 				this.showLabel(msg);
 
@@ -445,8 +397,7 @@
 
 		} catch (Exception ex) {
 
-			String msg = MessageFormat.format(Messages
-					.getString("VexEditor.unexpectedError"), //$NON-NLS-1$
+			String msg = MessageFormat.format(Messages.getString("VexEditor.unexpectedError"), //$NON-NLS-1$
 					new Object[] { input.getName() });
 
 			VexPlugin.getInstance().log(IStatus.ERROR, msg, ex);
@@ -478,7 +429,6 @@
 
 		this.parentControl = parent;
 
-
 		ConfigurationRegistry.INSTANCE.addConfigListener(this.configListener);
 		if (ConfigurationRegistry.INSTANCE.isLoaded()) {
 			this.loadInput();
@@ -513,8 +463,7 @@
 
 	public void setStatus(String text) {
 		// this.statusLabel.setText(text);
-		this.getEditorSite().getActionBars().getStatusLineManager().setMessage(
-				text);
+		this.getEditorSite().getActionBars().getStatusLineManager().setMessage(text);
 	}
 
 	/**
@@ -523,23 +472,22 @@
 	 * @param style
 	 *            Style to use.
 	 */
-	public void setStyle(Style style) {
+	public void setStyle(final Style style) {
 		this.style = style;
-		if (this.vexWidget != null) {
-			this.vexWidget.setStyleSheet(style.getStyleSheet());
-			Preferences prefs = new InstanceScope().getNode(VexPlugin.ID);
-			String key = getStylePreferenceKey(this.doc.getPublicID());
-			prefs.put(key, style.getUniqueId());
-			try {
-				prefs.flush();
-			} catch (BackingStoreException e) {
-				VexPlugin
-						.getInstance()
-						.log(
-								IStatus.ERROR,
-								Messages
-										.getString("VexEditor.errorSavingStylePreference"), e); //$NON-NLS-1$
-			}
+		if (vexWidget != null) {
+			vexWidget.setStyleSheet(style.getStyleSheet());
+			setPreferredStyleId(doc.getPublicID(), style.getUniqueId());
+		}
+	}
+
+	private static void setPreferredStyleId(final String publicId, final String styleId) {
+		final Preferences prefs = new InstanceScope().getNode(VexPlugin.ID);
+		final String key = getStylePreferenceKey(publicId);
+		prefs.put(key, styleId);
+		try {
+			prefs.flush();
+		} catch (final BackingStoreException e) {
+			VexPlugin.getInstance().log(IStatus.ERROR, Messages.getString("VexEditor.errorSavingStylePreference"), e); //$NON-NLS-1$
 		}
 	}
 
@@ -566,8 +514,8 @@
 	// AND the user wants to always use the doctype for this document
 	private boolean updateDoctypeDecl;
 
-	private ListenerList<IVexEditorListener, VexEditorMultiPageEvent> vexEditorListeners =
-	    new ListenerList<IVexEditorListener, VexEditorMultiPageEvent>(IVexEditorListener.class);
+	private ListenerList<IVexEditorListener, VexEditorMultiPageEvent> vexEditorListeners = new ListenerList<IVexEditorListener, VexEditorMultiPageEvent>(
+			IVexEditorListener.class);
 
 	private SelectionProvider selectionProvider = new SelectionProvider();
 
@@ -649,8 +597,7 @@
 		this.savedUndoDepth = this.vexWidget.getUndoDepth();
 
 		// new for scopes
-		IContextService cs = (IContextService) this.getSite().getService(
-				IContextService.class);
+		IContextService cs = (IContextService) this.getSite().getService(IContextService.class);
 		cs.activateContext("org.eclipse.wst.xml.vex.ui.VexEditorContext");
 
 		this.vexWidget.addSelectionChangedListener(this.selectionProvider);
@@ -668,8 +615,7 @@
 		} else if (delta.getKind() == IResourceDelta.REMOVED) {
 			if ((delta.getFlags() & IResourceDelta.MOVED_TO) != 0) {
 				IPath toPath = delta.getMovedToPath();
-				IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(
-						toPath);
+				IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(toPath);
 				this.setInput(new FileEditorInput(file));
 			} else {
 				if (!this.isDirty()) {
@@ -688,20 +634,12 @@
 			this.loadInput();
 		} else {
 
-			String message = MessageFormat.format(Messages
-					.getString("VexEditor.docChanged.message"), //$NON-NLS-1$
+			String message = MessageFormat.format(Messages.getString("VexEditor.docChanged.message"), //$NON-NLS-1$
 					new Object[] { this.getEditorInput().getName() });
 
-			MessageDialog dlg = new MessageDialog(
-					this.getSite().getShell(),
-					Messages.getString("VexEditor.docChanged.title"), //$NON-NLS-1$
-					null,
-					message,
-					MessageDialog.QUESTION,
-					new String[] {
-							Messages.getString("VexEditor.docChanged.discard"), //$NON-NLS-1$
-							Messages
-									.getString("VexEditor.docChanged.overwrite") }, //$NON-NLS-1$
+			MessageDialog dlg = new MessageDialog(this.getSite().getShell(), Messages.getString("VexEditor.docChanged.title"), //$NON-NLS-1$
+					null, message, MessageDialog.QUESTION, new String[] { Messages.getString("VexEditor.docChanged.discard"), //$NON-NLS-1$
+							Messages.getString("VexEditor.docChanged.overwrite") }, //$NON-NLS-1$
 					1);
 
 			int result = dlg.open();
@@ -716,14 +654,11 @@
 
 	private void handleResourceDeleted() {
 
-		String message = MessageFormat.format(Messages
-				.getString("VexEditor.docDeleted.message"), //$NON-NLS-1$
+		String message = MessageFormat.format(Messages.getString("VexEditor.docDeleted.message"), //$NON-NLS-1$
 				new Object[] { this.getEditorInput().getName() });
 
-		MessageDialog dlg = new MessageDialog(this.getSite().getShell(),
-				Messages.getString("VexEditor.docDeleted.title"), //$NON-NLS-1$
-				null, message, MessageDialog.QUESTION, new String[] {
-						Messages.getString("VexEditor.docDeleted.discard"), //$NON-NLS-1$ 
+		MessageDialog dlg = new MessageDialog(this.getSite().getShell(), Messages.getString("VexEditor.docDeleted.title"), //$NON-NLS-1$
+				null, message, MessageDialog.QUESTION, new String[] { Messages.getString("VexEditor.docDeleted.discard"), //$NON-NLS-1$ 
 						Messages.getString("VexEditor.docDeleted.save") }, //$NON-NLS-1$
 				1);
 
@@ -750,8 +685,7 @@
 		public void configChanged(ConfigEvent e) {
 			if (style != null) {
 				String currId = style.getUniqueId();
-				Style newStyle = (Style) ConfigurationRegistry.INSTANCE.getConfigItem(
-						Style.EXTENSION_POINT, currId);
+				Style newStyle = (Style) ConfigurationRegistry.INSTANCE.getConfigItem(Style.EXTENSION_POINT, currId);
 				if (newStyle == null) {
 					// Oops, style went bye-bye
 					// Let's just hold on to it in case it comes back later
@@ -778,8 +712,7 @@
 	};
 
 	private EntityResolver entityResolver = new EntityResolver() {
-		public InputSource resolveEntity(String publicId, String systemId)
-				throws SAXException, IOException {
+		public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
 
 			// System.out.println("### Resolving publicId " + publicId +
 			// ", systemId " + systemId);
@@ -794,8 +727,7 @@
 				}
 
 				if (doctype == null) {
-					DocumentTypeSelectionDialog dlg = DocumentTypeSelectionDialog
-							.create(getSite().getShell(), publicId);
+					DocumentTypeSelectionDialog dlg = DocumentTypeSelectionDialog.create(getSite().getShell(), publicId);
 					dlg.open();
 					doctype = dlg.getDoctype();
 					updateDoctypeDecl = dlg.alwaysUseThisDoctype();
@@ -808,8 +740,7 @@
 				URL url = doctype.getResourceUrl();
 
 				if (url == null) {
-					String message = MessageFormat.format(Messages
-							.getString("VexEditor.noUrlForDoctype"), //$NON-NLS-1$
+					String message = MessageFormat.format(Messages.getString("VexEditor.noUrlForDoctype"), //$NON-NLS-1$
 							new Object[] { publicId });
 					throw new RuntimeException(message);
 				}
@@ -825,8 +756,7 @@
 		public IWhitespacePolicy getPolicy(String publicId) {
 
 			if (doctype == null) {
-				DocumentTypeSelectionDialog dlg = DocumentTypeSelectionDialog
-						.create(getSite().getShell(), publicId);
+				DocumentTypeSelectionDialog dlg = DocumentTypeSelectionDialog.create(getSite().getShell(), publicId);
 				dlg.open();
 				doctype = dlg.getDoctype();
 				updateDoctypeDecl = dlg.alwaysUseThisDoctype();
@@ -836,8 +766,7 @@
 				}
 			}
 
-			style = VexEditorMultiPage.findStyleForDoctype(doctype
-					.getPublicId());
+			style = ConfigurationRegistry.INSTANCE.getStyle(doctype.getPublicId());
 			if (style == null) {
 				throw new NoStyleForDoctypeException();
 			}
@@ -855,8 +784,7 @@
 				return;
 			}
 
-			IPath path = ((IFileEditorInput) getEditorInput()).getFile()
-					.getFullPath();
+			IPath path = ((IFileEditorInput) getEditorInput()).getFile().getFullPath();
 			final IResourceDelta delta = event.getDelta().findMember(path);
 			if (delta != null) {
 				Display.getDefault().asyncExec(new Runnable() {
@@ -899,7 +827,8 @@
 		private String publicId;
 	}
 
-	private static class NoStyleForDoctypeException extends RuntimeException {}
+	private static class NoStyleForDoctypeException extends RuntimeException {
+	}
 
 	private String getLocation() {
 		List<String> path = new ArrayList<String>();
@@ -928,13 +857,10 @@
 			page.setPropertySourceProvider(new IPropertySourceProvider() {
 				public IPropertySource getPropertySource(Object object) {
 					if (object instanceof Element) {
-						IStructuredSelection sel = (IStructuredSelection) vexWidget
-								.getSelection();
+						IStructuredSelection sel = (IStructuredSelection) vexWidget.getSelection();
 						boolean multi = (sel != null && sel.size() > 1);
-						Validator validator = vexWidget.getDocument()
-								.getValidator();
-						return new ElementPropertySource((VEXElement) object,
-								validator, multi);
+						Validator validator = vexWidget.getDocument().getValidator();
+						return new ElementPropertySource((VEXElement) object, validator, multi);
 					} else {
 						return null;
 					}
diff --git a/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/handlers/StyleMenu.java b/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/handlers/StyleMenu.java
index a6b335c..4aacb06 100644
--- a/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/handlers/StyleMenu.java
+++ b/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/handlers/StyleMenu.java
@@ -19,6 +19,7 @@
 import org.eclipse.ui.IWorkbench;
 import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.PlatformUI;
+import org.eclipse.wst.xml.vex.ui.internal.config.ConfigurationRegistry;
 import org.eclipse.wst.xml.vex.ui.internal.config.Style;
 import org.eclipse.wst.xml.vex.ui.internal.editor.VexEditor;
 
@@ -36,8 +37,7 @@
         if (editor == null) return;
 
         String publicId= editor.getVexWidget().getDocument().getPublicID();
-        Style[] styles = Style.getStylesForDoctype(publicId);
-        for (final Style style : styles) {
+        for (final Style style : ConfigurationRegistry.INSTANCE.getStyles(publicId)) {
             MenuItem menuItem = new MenuItem(menu, SWT.RADIO, index);
             menuItem.setText(style.getName());
             menuItem.setSelection(style == editor.getStyle());