bug 2300072 - Project specific validation settings
diff --git a/bundles/org.eclipse.wst.xsl.ui/plugin.xml b/bundles/org.eclipse.wst.xsl.ui/plugin.xml
index 1d5cf51..24d784c 100644
--- a/bundles/org.eclipse.wst.xsl.ui/plugin.xml
+++ b/bundles/org.eclipse.wst.xsl.ui/plugin.xml
@@ -340,12 +340,11 @@
 			class="org.eclipse.wst.xsl.ui.internal.preferences.XSLValidationPreferencePage"
 			id="org.eclipse.wst.xsl.ui.propertyPage.project.validation"
 			category="ValidationPropertiesPage">
-<!--			<enabledWhen>
+-			<enabledWhen>
 				<adapt type="org.eclipse.core.resources.IProject">
 					
 				</adapt>
 			</enabledWhen>
--->
 		</page>		
 	</extension>
 	
diff --git a/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/preferences/AbstractValidationSettingsPage.java b/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/preferences/AbstractValidationSettingsPage.java
index 9cea2d8..b33e146 100644
--- a/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/preferences/AbstractValidationSettingsPage.java
+++ b/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/preferences/AbstractValidationSettingsPage.java
@@ -1,12 +1,14 @@
 /*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008 Standards for Technology in Automotive Retail and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
  * 
  * Contributors:
- *     IBM Corporation - initial API and implementation
+ *     David Carver (STAR) - bug 230072 - initial API and implementation
+ *                                        based on org.eclipse.wst.html.ui class of
+ *                                        the same name.
  *******************************************************************************/
 package org.eclipse.wst.xsl.ui.internal.preferences;
 
diff --git a/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/preferences/PropertyPreferencePage.java b/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/preferences/PropertyPreferencePage.java
index f1ad77b..98bae71 100644
--- a/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/preferences/PropertyPreferencePage.java
+++ b/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/preferences/PropertyPreferencePage.java
@@ -1,14 +1,14 @@
 /*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
+ * Copyright (c) 2008 Standards for Technology in Automotive Retail and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- *
+ * 
  * Contributors:
- *     IBM Corporation - initial API and implementation
- *     Jens Lukowski/Innoopract - initial renaming/restructuring
- *     
+ *     David Carver (STAR) - bug 230072 - initial API and implementation
+ *                                        based on org.eclipse.wst.html.ui class of
+ *                                        the same name.
  *******************************************************************************/
 package org.eclipse.wst.xsl.ui.internal.preferences;
 
@@ -146,7 +146,6 @@
 			line.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
 		}
 
-//		final Control common = createCommonContents(composite);
 		Common = createCommonContents(composite);
 		
 		Common.setLayoutData(new GridData(GridData.FILL_BOTH));
diff --git a/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/preferences/ValidationPreferencePage.java b/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/preferences/ValidationPreferencePage.java
index bf5d35e..bc6da74 100644
--- a/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/preferences/ValidationPreferencePage.java
+++ b/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/preferences/ValidationPreferencePage.java
@@ -26,6 +26,7 @@
  * Preference page for XSL validator preferences.
  * 
  * @author Doug Satchwell
+ * @deprecated  This has been replaced by XSLValidationPreferencePage
  */
 public class ValidationPreferencePage extends AbstractXSLPreferencePage
 {
diff --git a/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/preferences/XSLUIPreferenceInitializer.java b/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/preferences/XSLUIPreferenceInitializer.java
index 021e043..53b5e1f 100755
--- a/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/preferences/XSLUIPreferenceInitializer.java
+++ b/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/preferences/XSLUIPreferenceInitializer.java
@@ -17,11 +17,9 @@
 import org.eclipse.core.runtime.preferences.IEclipsePreferences;
 import org.eclipse.jface.preference.IPreferenceStore;
 import org.eclipse.jface.resource.ColorRegistry;
-import org.eclipse.jface.text.templates.Template;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.wst.sse.ui.internal.preferences.ui.ColorHelper;
-import org.eclipse.wst.xml.ui.internal.XMLUIPlugin;
-import org.eclipse.wst.xml.ui.internal.style.IStyleConstantsXML;
+
 import org.eclipse.wst.xsl.core.internal.XSLCorePlugin;
 import org.eclipse.wst.xsl.ui.internal.XSLUIPlugin;
 import org.eclipse.wst.xsl.ui.internal.style.IStyleConstantsXSL;
@@ -37,7 +35,6 @@
 	 * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
 	 */
 	public void initializeDefaultPreferences() {
-		IEclipsePreferences node = new DefaultScope().getNode(XSLCorePlugin.getDefault().getBundle().getSymbolicName());
 		IPreferenceStore store = XSLUIPlugin.getDefault().getPreferenceStore();
 		ColorRegistry registry = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry();
 
@@ -58,5 +55,4 @@
 		store.setDefault(IStyleConstantsXSL.TAG_NAME, styleValue);
 		
 	}
-
 }
diff --git a/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/preferences/XSLValidationPreferencePage.java b/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/preferences/XSLValidationPreferencePage.java
index 8ef04b3..51a30c1 100644
--- a/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/preferences/XSLValidationPreferencePage.java
+++ b/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/preferences/XSLValidationPreferencePage.java
@@ -1,3 +1,15 @@
+/*******************************************************************************
+ *Copyright (c) 2008 Standards for Technology in Automotive Retail and others.
+ *All rights reserved. This program and the accompanying materials
+ *are made available under the terms of the Eclipse Public License v1.0
+ *which accompanies this distribution, and is available at
+ *http://www.eclipse.org/legal/epl-v10.html
+ *
+ *Contributors:
+ *    David Carver - bug 230072 - initial API and implementation based on code from
+ *                                Doug Satchwell, Jesper Moeller, and the
+ *                                HTML Validation PreferencePage.
+ *******************************************************************************/
 package org.eclipse.wst.xsl.ui.internal.preferences;
 
 import java.util.ArrayList;
@@ -25,6 +37,7 @@
 import org.eclipse.ui.forms.events.ExpansionEvent;
 import org.eclipse.ui.forms.widgets.ExpandableComposite;
 import org.eclipse.wst.sse.ui.internal.preferences.ui.ScrolledPageContent;
+import org.eclipse.wst.sse.ui.internal.util.PixelConverter;
 import org.eclipse.wst.xsl.core.ValidationPreferences;
 import org.eclipse.wst.xsl.core.internal.XSLCorePlugin;
 import org.eclipse.wst.xsl.ui.internal.XSLUIPlugin;
@@ -38,7 +51,7 @@
 	private Map<String, Combo> combos = new HashMap<String, Combo>();
 	private List<ExpandableComposite> Expandables = new ArrayList<ExpandableComposite>();
 	private static final String SETTINGS_SECTION_NAME = "XSLValidationSeverities";//$NON-NLS-1$
-
+	private PixelConverter fPixelConverter;
 
 
 	static
@@ -48,8 +61,29 @@
 		ERROR_MAP.put(IMarker.SEVERITY_INFO, 2);
 	}
 	
-	@Override
-	protected Composite createCommonContents(Composite parent)
+	protected Control createCommonContents(Composite parent) {
+		final Composite page = new Composite(parent, SWT.NULL);
+		
+		//GridLayout
+		GridLayout layout = new GridLayout();
+		layout.numColumns = 1;
+		page.setLayout(layout);
+		
+		fPixelConverter = new PixelConverter(parent);
+		
+		final Composite content = createValidationSection(page);
+
+		loadPreferences();
+		restoreSectionExpansionStates(getDialogSettings().getSection(SETTINGS_SECTION_NAME));
+		
+		GridData gridData= new GridData(GridData.FILL, GridData.FILL, true, true);
+		gridData.heightHint = fPixelConverter.convertHeightInCharsToPixels(20);
+		content.setLayoutData(gridData);
+		
+		return page;
+	}
+	
+	protected Composite createValidationSection(Composite parent)
 	{
 		GridLayout layout= new GridLayout();
 		layout.numColumns= 2;
@@ -109,9 +143,6 @@
 		twistie = createTwistie(body,"XPath Problems",columns);
 		inner = createInnerComposite(parent, twistie, columns);
 		createCombo(inner, "Incorrect XPath syntax:", ValidationPreferences.XPATHS);
-
-		loadPreferences();
-		restoreSectionExpansionStates(getDialogSettings().getSection(SETTINGS_SECTION_NAME));
 		
 		return parent;
 	}
@@ -181,6 +212,15 @@
 		}
 	}
 	
+	@Override
+	public void dispose() {
+		storeSectionExpansionStates(getDialogSettings().addNewSection(SETTINGS_SECTION_NAME));
+		super.dispose();
+	}
+	
+	protected String getQualifier() {
+		return XSLCorePlugin.getDefault().getBundle().getSymbolicName();
+	}
 	
 	@Override
 	protected String getPreferenceNodeQualifier() {
@@ -285,5 +325,14 @@
 	protected void performDefaults() {
 		resetSeverities();
 		super.performDefaults();
+	}
+	
+	/** (non-Javadoc)
+	 * @see org.eclipse.wst.xsl.ui.internal.preferences.AbstractValidationSettingsPage#performOk()
+	 */
+	public boolean performOk() {
+		boolean result = super.performOk();
+		storeValues();
+		return result;
 	}	
 }