[197947] "Honour all schema locations" doesn't affect XML validation
diff --git a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/XMLValidationConfiguration.java b/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/XMLValidationConfiguration.java
index 2b01b88..c4208ee 100644
--- a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/XMLValidationConfiguration.java
+++ b/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/XMLValidationConfiguration.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2006, 2009 IBM Corporation 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
@@ -24,8 +24,13 @@
*/
public static String WARN_NO_GRAMMAR = "WARN_NO_GRAMMAR"; //$NON-NLS-1$
public static String INDICATE_NO_GRAMMAR = "INDICATE_NO_GRAMMAR"; //$NON-NLS-1$
+ public static String USE_XINCLUDE = "USE_XINCLUDE"; //$NON-NLS-1$
+ public static String HONOUR_ALL_SCHEMA_LOCATIONS = "HONOUR_ALL_SCHEMA_LOCATIONS"; //$NON-NLS-1$
+
private boolean warn_no_grammar_value = false;
private int indicate_no_grammar_value = 1;
+ private boolean use_xinclude = false;
+ private boolean honour_all_schema_locations_value = false;
/**
* Set a feature of this configuration.
@@ -41,6 +46,10 @@
{
if(WARN_NO_GRAMMAR.equals(feature))
warn_no_grammar_value = value;
+ else if(USE_XINCLUDE.equals(feature))
+ use_xinclude = value;
+ else if(HONOUR_ALL_SCHEMA_LOCATIONS.equals(feature))
+ honour_all_schema_locations_value = value;
else
throw new Exception("Feature not recognized."); //$NON-NLS-1$
@@ -81,7 +90,11 @@
{
if(WARN_NO_GRAMMAR.equals(feature))
return warn_no_grammar_value;
-
+ else if(USE_XINCLUDE.equals(feature))
+ return use_xinclude;
+ if(HONOUR_ALL_SCHEMA_LOCATIONS.equals(feature))
+ return honour_all_schema_locations_value;
+
throw new Exception("Feature not recognized."); //$NON-NLS-1$
}
diff --git a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/XMLValidationInfo.java b/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/XMLValidationInfo.java
index 888bc40..1113eb9 100644
--- a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/XMLValidationInfo.java
+++ b/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/XMLValidationInfo.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2006 IBM Corporation and others.
+ * Copyright (c) 2001, 2009 IBM Corporation 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
@@ -190,6 +190,9 @@
return errorCustomizationManager;
}
+ /**
+ * @deprecated Use {@link XMLValidationConfiguration} instead.
+ */
public boolean isUseXInclude() {
return XMLCorePlugin.getDefault().getPluginPreferences().getBoolean(XMLCorePreferenceNames.USE_XINCLUDE);
}
diff --git a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/XMLValidator.java b/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/XMLValidator.java
index 3b1f8dc..ad69888 100644
--- a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/XMLValidator.java
+++ b/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/XMLValidator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
+ * Copyright (c) 2001, 2009 IBM Corporation 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
@@ -167,7 +167,6 @@
reader.setFeature("http://xml.org/sax/features/namespaces", valinfo.isNamespaceEncountered()); //$NON-NLS-1$
reader.setFeature("http://xml.org/sax/features/validation", valinfo.isGrammarEncountered()); //$NON-NLS-1$
reader.setFeature("http://apache.org/xml/features/validation/schema", valinfo.isGrammarEncountered()); //$NON-NLS-1$
- reader.setFeature("http://apache.org/xml/features/xinclude", valinfo.isUseXInclude()); //$NON-NLS-1$
reader.setContentHandler(new DefaultHandler()
{
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
@@ -320,6 +319,15 @@
valinfo.setGrammarEncountered(helper.isGrammarEncountered);
XMLReader reader = createXMLReader(valinfo, entityResolver);
+ // Set the configuration option
+ if (configuration.getFeature(XMLValidationConfiguration.HONOUR_ALL_SCHEMA_LOCATIONS))
+ {
+ reader.setFeature("http://apache.org/xml/features/honour-all-schemaLocations", true); //$NON-NLS-1$
+ }
+ if (configuration.getFeature(XMLValidationConfiguration.USE_XINCLUDE))
+ {
+ reader.setFeature("http://apache.org/xml/features/xinclude", true); //$NON-NLS-1$
+ }
XMLErrorHandler errorhandler = new XMLErrorHandler(valinfo);
reader.setErrorHandler(errorhandler);
diff --git a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/eclipse/Validator.java b/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/eclipse/Validator.java
index b0a4fac..4aae874 100644
--- a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/eclipse/Validator.java
+++ b/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/eclipse/Validator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
+ * Copyright (c) 2001, 2009 IBM Corporation 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
@@ -15,6 +15,7 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Preferences;
import org.eclipse.wst.validation.ValidationResult;
import org.eclipse.wst.validation.ValidationState;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
@@ -59,7 +60,10 @@
XMLValidationConfiguration configuration = new XMLValidationConfiguration();
try
{
+ Preferences pluginPreferences = XMLCorePlugin.getDefault().getPluginPreferences();
configuration.setFeature(XMLValidationConfiguration.INDICATE_NO_GRAMMAR, indicateNoGrammar);
+ configuration.setFeature(XMLValidationConfiguration.USE_XINCLUDE, pluginPreferences.getBoolean(XMLCorePreferenceNames.USE_XINCLUDE));
+ configuration.setFeature(XMLValidationConfiguration.HONOUR_ALL_SCHEMA_LOCATIONS, pluginPreferences.getBoolean(XMLCorePreferenceNames.HONOUR_ALL_SCHEMA_LOCATIONS));
}
catch(Exception e)
{
diff --git a/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/preferences/XMLCorePreferenceInitializer.java b/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/preferences/XMLCorePreferenceInitializer.java
index 20091c2..69803c3 100644
--- a/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/preferences/XMLCorePreferenceInitializer.java
+++ b/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/preferences/XMLCorePreferenceInitializer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and others.
+ * Copyright (c) 2005, 2009 IBM Corporation 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
@@ -60,5 +60,6 @@
// 1 = IMarker.SEVERITY_WARNING
node.putInt(XMLCorePreferenceNames.INDICATE_NO_GRAMMAR, 1);
node.putBoolean(XMLCorePreferenceNames.USE_XINCLUDE, false);
+ node.putBoolean(XMLCorePreferenceNames.HONOUR_ALL_SCHEMA_LOCATIONS, false);
}
}
diff --git a/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/preferences/XMLCorePreferenceNames.java b/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/preferences/XMLCorePreferenceNames.java
index f572af5..9f0b6cb 100644
--- a/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/preferences/XMLCorePreferenceNames.java
+++ b/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/preferences/XMLCorePreferenceNames.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and others.
+ * Copyright (c) 2005, 2009 IBM Corporation 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
@@ -212,4 +212,15 @@
* </p>
*/
public static final String SPACE_BEFORE_EMPTY_CLOSE_TAG = "spaceBeforeEmptyCloseTag";//$NON-NLS-1$
+
+ /**
+ * Indicates whether or not all schema locations for XSD should be honoured
+ * during XSD validation of XML.
+ * <p>
+ * Value is of type <code>boolean</code>.<br />
+ * Possible values: {TRUE, FALSE}
+ * </p>
+ *
+ */
+ public static final String HONOUR_ALL_SCHEMA_LOCATIONS = "honourAllSchemaLocations";//$NON-NLS-1$
}
diff --git a/bundles/org.eclipse.wst.xml.ui/plugin.properties b/bundles/org.eclipse.wst.xml.ui/plugin.properties
index 5e94108..8befdb6 100644
--- a/bundles/org.eclipse.wst.xml.ui/plugin.properties
+++ b/bundles/org.eclipse.wst.xml.ui/plugin.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2001, 2008 IBM Corporation and others.
+# Copyright (c) 2001, 2009 IBM Corporation 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
@@ -17,6 +17,7 @@
XML.name=XML
XML_Files.name=XML Files
XML_Source.name=Editor
+XML_Validator.name=Validation
XML_Templates.name=Templates
XML_Styles.name=Styles
XML_Syntax_Coloring=Syntax Coloring
diff --git a/bundles/org.eclipse.wst.xml.ui/plugin.xml b/bundles/org.eclipse.wst.xml.ui/plugin.xml
index 98f0597..d6caef8 100644
--- a/bundles/org.eclipse.wst.xml.ui/plugin.xml
+++ b/bundles/org.eclipse.wst.xml.ui/plugin.xml
@@ -167,7 +167,6 @@
class="org.eclipse.wst.xml.ui.internal.preferences.XMLFilesPreferencePage"
id="org.eclipse.wst.xml.ui.preferences.xml.xml">
<keywordReference id="org.eclipse.wst.xml.ui.files"/>
- <keywordReference id="org.eclipse.wst.xml.ui.severities"/>
</page>
<!-- XML PREFERENCE PAGES -->
<page
@@ -204,6 +203,13 @@
class="org.eclipse.wst.xml.ui.internal.preferences.XMLTypingPreferencePage"
id="org.eclipse.wst.sse.ui.preferences.xml.typing">
</page>
+ <page
+ name="%XML_Validator.name"
+ category="org.eclipse.wst.xml.ui.preferences.xml.xml"
+ class="org.eclipse.wst.xml.ui.internal.preferences.XMLValidatorPreferencePage"
+ id="org.eclipse.wst.sse.ui.preferences.xml.validation">
+ <keywordReference id="org.eclipse.wst.xml.ui.severities"/>
+ </page>
</extension>
<!-- Keywords for preference and properties pages -->
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIMessages.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIMessages.java
index 17ba660..85ad0ef 100644
--- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIMessages.java
+++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIMessages.java
@@ -305,6 +305,7 @@
public static String previousSibling_label;
public static String previousSibling_description;
public static String Use_XInclude;
+ public static String Honour_all_schema_locations;
public static String Open;
public static String _UI_BUTTON_SORT;
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIPluginResources.properties b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIPluginResources.properties
index 3fe73d4..1239b77 100644
--- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIPluginResources.properties
+++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIPluginResources.properties
@@ -245,7 +245,7 @@
EOL_Mac=Mac
EOL_NoTranslation=No translation
Validating_files=Validating files
-Indicate_no_grammar_specified=Indicate when no grammar is specified:
+Indicate_no_grammar_specified=Indicate when no &grammar is specified:
Indicate_no_grammar_specified_severities=Error,Warning,Ignore
XMLFilesPreferencePage_ExtensionLabel=Add this suffix (if not specified):
XMLFilesPreferencePage_ExtensionError=Suffix must be one of the following {0}.
@@ -327,7 +327,8 @@
SyntaxColoringPage_6=&Underline
EmptyFilePreferencePage_0=Expand the tree to edit preferences for a specific feature.
_UI_STRUCTURED_TEXT_EDITOR_PREFS_LINK=XML editing preferences. Note that some preferences may be set on the <a>{0}</a> preference page.
-Use_XInclude=Process XML Inclusions
+Use_XInclude=Process XML &Inclusions
+Honour_all_schema_locations=&Honour all XML schema locations
nextSibling_label=Next Sibling
nextSibling_description=Go to Next Sibling
previousSibling_label=Previous Sibling
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/editor/IHelpContextIds.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/editor/IHelpContextIds.java
index d64004f..f7542e3 100644
--- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/editor/IHelpContextIds.java
+++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/editor/IHelpContextIds.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2006 IBM Corporation and others.
+ * Copyright (c) 2001, 2009 IBM Corporation 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
@@ -39,6 +39,8 @@
public static final String XML_PREFWEBX_STYLES_HELPID = PREFIX + "webx0062"; //$NON-NLS-1$
// XML Templates Preference page
public static final String XML_PREFWEBX_TEMPLATES_HELPID = PREFIX + "webx0063"; //$NON-NLS-1$
+ // XML Validator Preference page
+ public static final String XML_PREFWEBX_VALIDATOR_HELPID = PREFIX + "webx0064"; //$NON-NLS-1$
// XML Cleanup dialog
public static final String CLEANUP_XML_HELPID = PREFIX + "xmlm1200"; //$NON-NLS-1$
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/preferences/XMLFilesPreferencePage.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/preferences/XMLFilesPreferencePage.java
index 0f3cc0e..8a19fca 100644
--- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/preferences/XMLFilesPreferencePage.java
+++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/preferences/XMLFilesPreferencePage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
+ * Copyright (c) 2001, 2009 IBM Corporation 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
@@ -8,8 +8,6 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Jens Lukowski/Innoopract - initial renaming/restructuring
- * David Carver - STAR - [205989] - [validation] validate XML after XInclude resolution
- *
*******************************************************************************/
package org.eclipse.wst.xml.ui.internal.preferences;
@@ -22,11 +20,7 @@
import org.eclipse.core.runtime.Preferences;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
@@ -34,7 +28,6 @@
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.PlatformUI;
import org.eclipse.wst.sse.core.internal.encoding.CommonEncodingPreferenceNames;
-import org.eclipse.wst.sse.core.utils.StringUtils;
import org.eclipse.wst.sse.ui.internal.preferences.ui.AbstractPreferencePage;
import org.eclipse.wst.xml.core.internal.XMLCorePlugin;
import org.eclipse.wst.xml.core.internal.preferences.XMLCorePreferenceNames;
@@ -45,31 +38,13 @@
public class XMLFilesPreferencePage extends AbstractPreferencePage {
protected EncodingSettings fEncodingSettings = null;
- private Combo fDefaultSuffix = null;
- private List fValidExtensions = null;
- private Combo fIndicateNoGrammar = null;
- private Button fUseXinclude = null;
-
- /**
- * @param parent
- * @return
- */
- private Combo createCombo(Composite parent, String[] items) {
- Combo combo = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
- combo.setItems(items);
-
- //GridData
- GridData data = new GridData(SWT.FILL, SWT.CENTER, true, true);
- combo.setLayoutData(data);
-
- return combo;
- }
+ private Combo fDefaultSuffix;
+ private List fValidExtensions;
protected Control createContents(Composite parent) {
Composite composite = (Composite) super.createContents(parent);
PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.XML_PREFWEBX_FILES_HELPID);
createContentsForCreatingGroup(composite);
- createContentsForValidatingGroup(composite);
setSize(composite);
loadPreferences();
@@ -95,22 +70,6 @@
((GridData) fEncodingSettings.getLayoutData()).horizontalSpan = 2;
}
- protected void createContentsForValidatingGroup(Composite parent) {
- Group validatingGroup = createGroup(parent, 2);
- ((GridLayout) validatingGroup.getLayout()).makeColumnsEqualWidth = false;
- validatingGroup.setText(XMLUIMessages.Validating_files);
-
- if (fIndicateNoGrammar == null) {
- createLabel(validatingGroup, XMLUIMessages.Indicate_no_grammar_specified);
- fIndicateNoGrammar = createCombo(validatingGroup, StringUtils.unpack(XMLUIMessages.Indicate_no_grammar_specified_severities));
- }
- if (fUseXinclude == null) {
- fUseXinclude = createCheckBox(validatingGroup, XMLUIMessages.Use_XInclude);
- }
-
- new Label(validatingGroup, SWT.NONE).setLayoutData(new GridData());
- }
-
public void dispose() {
fDefaultSuffix.removeModifyListener(this);
super.dispose();
@@ -153,7 +112,6 @@
protected void initializeValues() {
initializeValuesForCreatingGroup();
- initializeValuesForValidatingGroup();
}
protected void initializeValuesForCreatingGroup() {
@@ -165,22 +123,8 @@
fEncodingSettings.setIANATag(encoding);
}
- protected void initializeValuesForValidatingGroup() {
- int indicateNoGrammarButtonSelected = getModelPreferences().getInt(XMLCorePreferenceNames.INDICATE_NO_GRAMMAR);
- boolean useXIncludeButtonSelected = getModelPreferences().getBoolean(XMLCorePreferenceNames.USE_XINCLUDE);
-
- if (fIndicateNoGrammar != null) {
- fIndicateNoGrammar.select(2 - indicateNoGrammarButtonSelected);
- fIndicateNoGrammar.setText(StringUtils.unpack(XMLUIMessages.Indicate_no_grammar_specified_severities)[2-indicateNoGrammarButtonSelected]);
- }
- if (fUseXinclude != null) {
- fUseXinclude.setSelection(useXIncludeButtonSelected);
- }
- }
-
protected void performDefaults() {
performDefaultsForCreatingGroup();
- performDefaultsForValidatingGroup();
super.performDefaults();
}
@@ -195,19 +139,6 @@
// fEncodingSettings.resetToDefaultEncoding();
}
- protected void performDefaultsForValidatingGroup() {
- int indicateNoGrammarButtonSelected = getModelPreferences().getDefaultInt(XMLCorePreferenceNames.INDICATE_NO_GRAMMAR);
- boolean useXIncludeButtonSelected = getModelPreferences().getDefaultBoolean(XMLCorePreferenceNames.USE_XINCLUDE);
-
- if (fIndicateNoGrammar != null) {
- fIndicateNoGrammar.setSelection(new Point(indicateNoGrammarButtonSelected, 2 - indicateNoGrammarButtonSelected));
- fIndicateNoGrammar.setText(StringUtils.unpack(XMLUIMessages.Indicate_no_grammar_specified_severities)[indicateNoGrammarButtonSelected]);
- }
- if (fUseXinclude != null) {
- fUseXinclude.setSelection(useXIncludeButtonSelected);
- }
- }
-
public boolean performOk() {
boolean result = super.performOk();
@@ -218,7 +149,6 @@
protected void storeValues() {
storeValuesForCreatingGroup();
- storeValuesForValidatingGroup();
}
protected void storeValuesForCreatingGroup() {
@@ -228,17 +158,6 @@
getModelPreferences().setValue(CommonEncodingPreferenceNames.OUTPUT_CODESET, fEncodingSettings.getIANATag());
}
- protected void storeValuesForValidatingGroup() {
- if (fIndicateNoGrammar != null) {
- int warnNoGrammarButtonSelected = 2 - fIndicateNoGrammar.getSelectionIndex();
- getModelPreferences().setValue(XMLCorePreferenceNames.INDICATE_NO_GRAMMAR, warnNoGrammarButtonSelected);
- }
- if (fUseXinclude != null) {
- boolean useXIncludeButtonSelected = fUseXinclude.getSelection();
- getModelPreferences().setValue(XMLCorePreferenceNames.USE_XINCLUDE, useXIncludeButtonSelected);
- }
- }
-
protected void validateValues() {
boolean isValid = false;
Iterator i = getValidExtensions().iterator();
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/preferences/XMLValidatorPreferencePage.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/preferences/XMLValidatorPreferencePage.java
new file mode 100644
index 0000000..7a2dccc
--- /dev/null
+++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/preferences/XMLValidatorPreferencePage.java
@@ -0,0 +1,171 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 2009 IBM Corporation 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 - [205989] - [validation] validate XML after XInclude resolution
+ *******************************************************************************/
+
+package org.eclipse.wst.xml.ui.internal.preferences;
+
+
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.wst.sse.core.utils.StringUtils;
+import org.eclipse.wst.sse.ui.internal.preferences.ui.AbstractPreferencePage;
+import org.eclipse.wst.xml.core.internal.XMLCorePlugin;
+import org.eclipse.wst.xml.core.internal.preferences.XMLCorePreferenceNames;
+import org.eclipse.wst.xml.ui.internal.XMLUIMessages;
+import org.eclipse.wst.xml.ui.internal.editor.IHelpContextIds;
+
+
+public class XMLValidatorPreferencePage extends AbstractPreferencePage {
+ private Combo fIndicateNoGrammar;
+
+ private Button fHonourAllSchemaLocations;
+
+ private Button fUseXinclude;
+
+ protected Control createContents(Composite parent) {
+ Composite composite = (Composite)super.createContents(parent);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.XML_PREFWEBX_VALIDATOR_HELPID);
+ createContentsForValidatingGroup(composite);
+
+ setSize(composite);
+ loadPreferences();
+
+ return composite;
+ }
+
+ protected void createContentsForValidatingGroup(Composite parent) {
+ Group validatingGroup = createGroup(parent, 2);
+ ((GridLayout)validatingGroup.getLayout()).makeColumnsEqualWidth = false;
+ validatingGroup.setText(XMLUIMessages.Validating_files);
+
+ if (fIndicateNoGrammar == null) {
+ createLabel(validatingGroup, XMLUIMessages.Indicate_no_grammar_specified);
+ fIndicateNoGrammar = createCombo(validatingGroup, StringUtils.unpack(XMLUIMessages.Indicate_no_grammar_specified_severities));
+ }
+ if (fUseXinclude == null) {
+ fUseXinclude = createCheckBox(validatingGroup, XMLUIMessages.Use_XInclude);
+ ((GridData)fUseXinclude.getLayoutData()).horizontalSpan = 2;
+ }
+ if (fHonourAllSchemaLocations == null) {
+ fHonourAllSchemaLocations = createCheckBox(validatingGroup, XMLUIMessages.Honour_all_schema_locations);
+ ((GridData)fHonourAllSchemaLocations.getLayoutData()).horizontalSpan = 2;
+ }
+ }
+
+ /**
+ * @param parent
+ * @return
+ */
+ private Combo createCombo(Composite parent, String[] items) {
+ Combo combo = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
+ combo.setItems(items);
+
+ //GridData
+ GridData data = new GridData(SWT.FILL, SWT.CENTER, true, true);
+ combo.setLayoutData(data);
+
+ return combo;
+ }
+
+ protected void initializeValues() {
+ initializeValuesForValidatingGroup();
+ }
+
+ protected void initializeValuesForValidatingGroup() {
+ Preferences modelPreferences = getModelPreferences();
+ int indicateNoGrammarButtonSelected = modelPreferences.getInt(XMLCorePreferenceNames.INDICATE_NO_GRAMMAR);
+ boolean useXIncludeButtonSelected = modelPreferences.getBoolean(XMLCorePreferenceNames.USE_XINCLUDE);
+
+ if (fIndicateNoGrammar != null) {
+ fIndicateNoGrammar.select(2 - indicateNoGrammarButtonSelected);
+ fIndicateNoGrammar.setText(StringUtils.unpack(XMLUIMessages.Indicate_no_grammar_specified_severities)[2 - indicateNoGrammarButtonSelected]);
+ }
+ if (fUseXinclude != null) {
+ fUseXinclude.setSelection(useXIncludeButtonSelected);
+ }
+
+ boolean honourAllSelected = modelPreferences.getBoolean(XMLCorePreferenceNames.HONOUR_ALL_SCHEMA_LOCATIONS);
+ if (fHonourAllSchemaLocations != null) {
+ fHonourAllSchemaLocations.setSelection(honourAllSelected);
+ }
+ }
+
+ protected void performDefaultsForValidatingGroup() {
+ Preferences modelPreferences = getModelPreferences();
+ int indicateNoGrammarButtonSelected = modelPreferences.getDefaultInt(XMLCorePreferenceNames.INDICATE_NO_GRAMMAR);
+ boolean useXIncludeButtonSelected = modelPreferences.getDefaultBoolean(XMLCorePreferenceNames.USE_XINCLUDE);
+
+ if (fIndicateNoGrammar != null) {
+ fIndicateNoGrammar.setSelection(new Point(indicateNoGrammarButtonSelected, 2 - indicateNoGrammarButtonSelected));
+ fIndicateNoGrammar.setText(StringUtils.unpack(XMLUIMessages.Indicate_no_grammar_specified_severities)[indicateNoGrammarButtonSelected]);
+ }
+ if (fUseXinclude != null) {
+ fUseXinclude.setSelection(useXIncludeButtonSelected);
+ }
+
+ boolean honourAllButtonSelected = modelPreferences.getDefaultBoolean(XMLCorePreferenceNames.HONOUR_ALL_SCHEMA_LOCATIONS);
+ if (fHonourAllSchemaLocations != null) {
+ fHonourAllSchemaLocations.setSelection(honourAllButtonSelected);
+ }
+ }
+
+ protected void storeValuesForValidatingGroup()
+ {
+ Preferences modelPreferences = getModelPreferences();
+ if (fIndicateNoGrammar != null) {
+ int warnNoGrammarButtonSelected = 2 - fIndicateNoGrammar.getSelectionIndex();
+ modelPreferences.setValue(XMLCorePreferenceNames.INDICATE_NO_GRAMMAR, warnNoGrammarButtonSelected);
+ }
+ if (fUseXinclude != null) {
+ boolean useXIncludeButtonSelected = fUseXinclude.getSelection();
+ modelPreferences.setValue(XMLCorePreferenceNames.USE_XINCLUDE, useXIncludeButtonSelected);
+ }
+ if (fHonourAllSchemaLocations != null) {
+ boolean honourAllButtonSelected = fHonourAllSchemaLocations.getSelection();
+ modelPreferences.setValue(XMLCorePreferenceNames.HONOUR_ALL_SCHEMA_LOCATIONS, honourAllButtonSelected);
+ }
+ }
+
+ protected void storeValues() {
+ storeValuesForValidatingGroup();
+ }
+
+ protected void performDefaults() {
+ performDefaultsForValidatingGroup();
+ super.performDefaults();
+ }
+
+ protected Preferences getModelPreferences() {
+ return XMLCorePlugin.getDefault().getPluginPreferences();
+ }
+
+ protected void doSavePreferenceStore() {
+ XMLCorePlugin.getDefault().savePluginPreferences(); // model
+ }
+
+ public boolean performOk() {
+ boolean result = super.performOk();
+
+ doSavePreferenceStore();
+
+ return result;
+ }
+}
diff --git a/bundles/org.eclipse.wst.xsd.core/META-INF/MANIFEST.MF b/bundles/org.eclipse.wst.xsd.core/META-INF/MANIFEST.MF
index de82c65..c06f026 100644
--- a/bundles/org.eclipse.wst.xsd.core/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.wst.xsd.core/META-INF/MANIFEST.MF
@@ -17,6 +17,6 @@
org.eclipse.xsd;bundle-version="[2.2.0,3.0.0)",
org.eclipse.wst.xml.core;bundle-version="[1.1.0,1.2.0)",
org.eclipse.wst.validation;bundle-version="[1.2.0,1.3.0)"
-Eclipse-LazyStart: true
+Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.4
diff --git a/bundles/org.eclipse.wst.xsd.core/src-validation/org/eclipse/wst/xsd/core/internal/validation/eclipse/Validator.java b/bundles/org.eclipse.wst.xsd.core/src-validation/org/eclipse/wst/xsd/core/internal/validation/eclipse/Validator.java
index 1189805..5da031b 100644
--- a/bundles/org.eclipse.wst.xsd.core/src-validation/org/eclipse/wst/xsd/core/internal/validation/eclipse/Validator.java
+++ b/bundles/org.eclipse.wst.xsd.core/src-validation/org/eclipse/wst/xsd/core/internal/validation/eclipse/Validator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
+ * Copyright (c) 2001, 2009 IBM Corporation 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
@@ -16,6 +16,8 @@
import java.util.HashMap;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.xml.core.internal.XMLCorePlugin;
+import org.eclipse.wst.xml.core.internal.preferences.XMLCorePreferenceNames;
import org.eclipse.wst.xml.core.internal.validation.core.AbstractNestedValidator;
import org.eclipse.wst.xml.core.internal.validation.core.NestedValidatorContext;
import org.eclipse.wst.xml.core.internal.validation.core.ValidationMessage;
@@ -34,7 +36,7 @@
protected void setupValidation(NestedValidatorContext context)
{
XSDValidationConfiguration configuration = new XSDValidationConfiguration();
- boolean honourAllSchemaLocations = XSDCorePlugin.getDefault().getPluginPreferences().getBoolean(XSDCorePreferenceNames.HONOUR_ALL_SCHEMA_LOCATIONS);
+ boolean honourAllSchemaLocations = XMLCorePlugin.getDefault().getPluginPreferences().getBoolean(XMLCorePreferenceNames.HONOUR_ALL_SCHEMA_LOCATIONS);
boolean fullSchemaConformance = XSDCorePlugin.getDefault().getPluginPreferences().getBoolean(XSDCorePreferenceNames.FULL_SCHEMA_CONFORMANCE);
try
{
diff --git a/bundles/org.eclipse.wst.xsd.core/src/org/eclipse/wst/xsd/core/internal/preferences/XSDCorePreferenceInitializer.java b/bundles/org.eclipse.wst.xsd.core/src/org/eclipse/wst/xsd/core/internal/preferences/XSDCorePreferenceInitializer.java
index 88db4e4..f81f24d 100644
--- a/bundles/org.eclipse.wst.xsd.core/src/org/eclipse/wst/xsd/core/internal/preferences/XSDCorePreferenceInitializer.java
+++ b/bundles/org.eclipse.wst.xsd.core/src/org/eclipse/wst/xsd/core/internal/preferences/XSDCorePreferenceInitializer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
+ * Copyright (c) 2006, 2009 IBM Corporation 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
@@ -28,9 +28,6 @@
public void initializeDefaultPreferences() {
IEclipsePreferences node = new DefaultScope().getNode(XSDCorePlugin.getDefault().getBundle().getSymbolicName());
- // Validation preferences.
- node.putBoolean(XSDCorePreferenceNames.HONOUR_ALL_SCHEMA_LOCATIONS, false);
-
// In order to provide the best compatibility and conformance to the XML Schema
// specification it is recommended that this be defaulted to true.
node.putBoolean(XSDCorePreferenceNames.FULL_SCHEMA_CONFORMANCE, true);
diff --git a/bundles/org.eclipse.wst.xsd.core/src/org/eclipse/wst/xsd/core/internal/preferences/XSDCorePreferenceNames.java b/bundles/org.eclipse.wst.xsd.core/src/org/eclipse/wst/xsd/core/internal/preferences/XSDCorePreferenceNames.java
index 4159cc1..06fc74e 100644
--- a/bundles/org.eclipse.wst.xsd.core/src/org/eclipse/wst/xsd/core/internal/preferences/XSDCorePreferenceNames.java
+++ b/bundles/org.eclipse.wst.xsd.core/src/org/eclipse/wst/xsd/core/internal/preferences/XSDCorePreferenceNames.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
+ * Copyright (c) 2006, 2009 IBM Corporation 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
@@ -25,7 +25,7 @@
* Value is of type <code>boolean</code>.<br />
* Possible values: {TRUE, FALSE}
* </p>
- *
+ * @deprecated
*/
public static final String HONOUR_ALL_SCHEMA_LOCATIONS = "honourAllSchemaLocations";//$NON-NLS-1$
public static final String FULL_SCHEMA_CONFORMANCE = "fullSchemaConformance";//$NON-NLS-1$
diff --git a/bundles/org.eclipse.wst.xsd.ui/plugin.properties b/bundles/org.eclipse.wst.xsd.ui/plugin.properties
index 961835e..1f9078f 100644
--- a/bundles/org.eclipse.wst.xsd.ui/plugin.properties
+++ b/bundles/org.eclipse.wst.xsd.ui/plugin.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2001, 2007 IBM Corporation and others.
+# Copyright (c) 2001, 2009 IBM Corporation 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
@@ -27,6 +27,8 @@
_UI_XML_TOOLS_PREFERENCE_PAGE = XML
_UI_XML_SCHEMA_PREFERENCE = XML Schema Files
+_UI_XML_SCHEMA_EDITOR_PREFERENCE = Editor
+_UI_XML_SCHEMA_VALIDATOR_PREFERENCE = Validation
_UI_WIZARD_NEW_XSD = XML Schema
_UI_CREATE_A_NEW_SCHEMA = Create a new XML schema file
diff --git a/bundles/org.eclipse.wst.xsd.ui/plugin.xml b/bundles/org.eclipse.wst.xsd.ui/plugin.xml
index df403d3..42d833b 100644
--- a/bundles/org.eclipse.wst.xsd.ui/plugin.xml
+++ b/bundles/org.eclipse.wst.xsd.ui/plugin.xml
@@ -51,6 +51,18 @@
class="org.eclipse.wst.xsd.ui.internal.preferences.XSDPreferencePage"
id="org.eclipse.wst.xsd.ui.internal.preferences.XSDPreferencePage">
</page>
+ <page
+ category="org.eclipse.wst.xsd.ui.internal.preferences.XSDPreferencePage"
+ class="org.eclipse.wst.xsd.ui.internal.preferences.XSDEditorPreferencePage"
+ id="org.eclipse.wst.xsd.ui.internal.preferences.XSDEditorPreferencePage"
+ name="%_UI_XML_SCHEMA_EDITOR_PREFERENCE">
+ </page>
+ <page
+ category="org.eclipse.wst.xsd.ui.internal.preferences.XSDPreferencePage"
+ class="org.eclipse.wst.xsd.ui.internal.preferences.XSDValidatorPreferencePage"
+ id="org.eclipse.wst.xsd.ui.internal.preferences.XSDValidatorPreferencePage"
+ name="%_UI_XML_SCHEMA_VALIDATOR_PREFERENCE">
+ </page>
</extension>
<extension point="org.eclipse.wst.sse.ui.editorConfiguration">
<provisionalDefinition
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/Messages.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/Messages.java
index 1d822f7..f7d1a8a 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/Messages.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/Messages.java
@@ -123,7 +123,8 @@
// TODO: TO REMOVE
public static String _UI_LABEL_ATTRIBUTEFORMDEFAULT;
public static String _UI_LABEL_CREATE_ANON_TYPE;
- public static String _UI_STRUCTURED_TEXT_EDITOR_PREFS_LINK;
+ public static String _UI_XML_TEXT_EDITOR_PREFS_LINK;
+ public static String _UI_XML_VALIDATOR_PREFS_LINK;
public static String _UI_TEXT_ENABLE_AUTO_IMPORT_CLEANUP;
public static String _UI_TEXT_ENABLE_AUTO_OPEN_SCHEMA_DIALOG;
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDEditorContextIds.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDEditorContextIds.java
index 088f706..2f1bc75 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDEditorContextIds.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/XSDEditorContextIds.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2006 IBM Corporation and others.
+ * Copyright (c) 2001, 2009 IBM Corporation 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
@@ -457,4 +457,8 @@
/* CONTEXT_ID xsdp0010 for XML Schema Preferences Page */
public static final String XSDP_PREFERENCE_PAGE = PLUGIN_NAME + ".xsdp0010";
+ /* CONTEXT_ID xsdp0020 for XML Schema Editor Preferences Page */
+ public static final String XSDP_EDITOR_PREFERENCE_PAGE = PLUGIN_NAME + ".xsdp0020";
+ /* CONTEXT_ID xsdp0030 for XML Schema Validator Preferences Page */
+ public static final String XSDP_VALIDATOR_PREFERENCE_PAGE = PLUGIN_NAME + ".xsdp0030";
}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/messages.properties b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/messages.properties
index a747afe..7dff3de 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/messages.properties
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/messages.properties
@@ -60,16 +60,17 @@
!
_UI_TEXT_INDENT_LABEL = Indentation
_UI_TEXT_INDENT_SPACES_LABEL = &Number of spaces:
-_UI_TEXT_XSD_NAMESPACE_PREFIX = XML schema language
-_UI_STRUCTURED_TEXT_EDITOR_PREFS_LINK = Note that some preferences may be set on the <a>{0}</a> preference page.
+_UI_TEXT_XSD_NAMESPACE_PREFIX = Creating files
+_UI_XML_TEXT_EDITOR_PREFS_LINK = XML Schema editing preferences. Note that some preferences may be set on the XML <a>{0}</a> preference page.
+_UI_XML_VALIDATOR_PREFS_LINK = Note that some preferences may be set on the XML <a>{0}</a> preference page.
_UI_TEXT_XSD_DEFAULT_PREFIX = XML schema language constructs &prefix:
_UI_QUALIFY_XSD = &Qualify XML schema language constructs
-_UI_TEXT_XSD_DEFAULT_TARGET_NAMESPACE = Default Target Namespace:
+_UI_TEXT_XSD_DEFAULT_TARGET_NAMESPACE = Default &target namespace:
_UI_VALIDATING_FILES = Validating files
_UI_TEXT_HONOUR_ALL_SCHEMA_LOCATIONS = Honour all schema locations
-_UI_FULL_CONFORMANCE = Check full XML Schema conformance
-_UI_TEXT_ENABLE_AUTO_IMPORT_CLEANUP = Automatically remove unused XSD imports and XML Namespace entries
-_UI_TEXT_ENABLE_AUTO_OPEN_SCHEMA_DIALOG = Automatically prompt for schema location when adding a directive
+_UI_FULL_CONFORMANCE = &Check full XML Schema conformance
+_UI_TEXT_ENABLE_AUTO_IMPORT_CLEANUP = &Automatically remove unused XSD imports and XML Namespace entries
+_UI_TEXT_ENABLE_AUTO_OPEN_SCHEMA_DIALOG = &Prompt for schema location when adding a directive
_ERROR_LABEL_INVALID_PREFIX = IWAX1004E Invalid prefix. A prefix must not be empty or contain any space.
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/preferences/XSDEditorPreferencePage.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/preferences/XSDEditorPreferencePage.java
new file mode 100644
index 0000000..e56ffe8
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/preferences/XSDEditorPreferencePage.java
@@ -0,0 +1,147 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2009 IBM Corporation 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
+ *******************************************************************************/
+
+package org.eclipse.wst.xsd.ui.internal.preferences;
+
+
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.PreferenceLinkArea;
+import org.eclipse.ui.help.IWorkbenchHelpSystem;
+import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
+import org.eclipse.wst.sse.ui.internal.preferences.ui.AbstractPreferencePage;
+import org.eclipse.wst.xsd.ui.internal.editor.Messages;
+import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorCSHelpIds;
+import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorContextIds;
+import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
+
+
+public class XSDEditorPreferencePage extends AbstractPreferencePage
+{
+ private static final String XML_EDITOR_PREFERENCE_PAGE_ID = "org.eclipse.wst.sse.ui.preferences.xml.source"; //$NON-NLS-1$
+
+ private Button removeUnusedImports;
+
+ private Button automaticallyOpenSchemaLocationDialog;
+
+ protected Control createContents(Composite parent)
+ {
+ final Composite composite = super.createComposite(parent, 1);
+ IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
+ helpSystem.setHelp(parent, XSDEditorContextIds.XSDP_EDITOR_PREFERENCE_PAGE);
+
+ new PreferenceLinkArea(composite, SWT.WRAP | SWT.MULTI, XML_EDITOR_PREFERENCE_PAGE_ID, Messages._UI_XML_TEXT_EDITOR_PREFS_LINK,
+ (IWorkbenchPreferenceContainer)getContainer(), null).getControl().setLayoutData(GridDataFactory.fillDefaults().hint(150, SWT.DEFAULT).create());
+ new Label(composite, SWT.NONE).setLayoutData(GridDataFactory.swtDefaults().create());
+
+ createContentsForImportCleanup(composite);
+
+ setSize(composite);
+ loadPreferences();
+
+ return composite;
+ }
+
+ private boolean getRemoveImportSetting()
+ {
+ return removeUnusedImports.getSelection();
+ }
+
+ private boolean getAutomaticallyOpenSchemaLocationDialogSetting()
+ {
+ return automaticallyOpenSchemaLocationDialog.getSelection();
+ }
+
+ protected void initializeValues()
+ {
+ IPreferenceStore store = getPreferenceStore();
+ removeUnusedImports.setSelection(store.getBoolean(XSDEditorPlugin.CONST_XSD_IMPORT_CLEANUP));
+ automaticallyOpenSchemaLocationDialog.setSelection(store.getBoolean(XSDEditorPlugin.CONST_XSD_AUTO_OPEN_SCHEMA_LOCATION_DIALOG));
+ }
+
+ protected void performDefaults()
+ {
+ IPreferenceStore preferenceStore = getPreferenceStore();
+ removeUnusedImports.setSelection(preferenceStore.getDefaultBoolean(XSDEditorPlugin.CONST_XSD_IMPORT_CLEANUP));
+ automaticallyOpenSchemaLocationDialog.setSelection(preferenceStore.getDefaultBoolean(XSDEditorPlugin.CONST_XSD_AUTO_OPEN_SCHEMA_LOCATION_DIALOG));
+ super.performDefaults();
+ }
+
+ protected void storeValues()
+ {
+ saveValuesForImportsCleanup();
+ }
+
+ /**
+ * Stores the values of the controls back to the preference store.
+ */
+ private void saveValuesForImportsCleanup()
+ {
+ IPreferenceStore store = getPreferenceStore();
+
+ store.setValue(XSDEditorPlugin.CONST_XSD_IMPORT_CLEANUP, getRemoveImportSetting());
+ store.setValue(XSDEditorPlugin.CONST_XSD_AUTO_OPEN_SCHEMA_LOCATION_DIALOG, getAutomaticallyOpenSchemaLocationDialogSetting());
+ }
+
+ /**
+ * The indent is stored in the preference store associated with the XML Schema Model
+ */
+ public IPreferenceStore getPreferenceStore()
+ {
+ return XSDEditorPlugin.getPlugin().getPreferenceStore();
+ }
+
+ private void createContentsForImportCleanup(Composite parent)
+ {
+ Group unusedImportGroup = createGroup(parent, 1);
+ unusedImportGroup.setText(Messages._UI_GRAPH_DIRECTIVES);
+
+ //GridData
+ GridData data = new GridData(SWT.FILL);
+ data.verticalAlignment = SWT.CENTER;
+ data.horizontalAlignment = SWT.FILL;
+
+ if (removeUnusedImports == null)
+ {
+ removeUnusedImports = new Button(unusedImportGroup, SWT.CHECK | SWT.LEFT);
+ removeUnusedImports.setText(Messages._UI_TEXT_ENABLE_AUTO_IMPORT_CLEANUP);
+ removeUnusedImports.setLayoutData(data);
+
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(removeUnusedImports, XSDEditorCSHelpIds.XMLSCHEMAFILES_PREFERENCES__IMPORT_CLEANUP);
+
+ automaticallyOpenSchemaLocationDialog = new Button(unusedImportGroup, SWT.CHECK | SWT.LEFT);
+ automaticallyOpenSchemaLocationDialog.setText(Messages._UI_TEXT_ENABLE_AUTO_OPEN_SCHEMA_DIALOG);
+ automaticallyOpenSchemaLocationDialog.setLayoutData(GridDataFactory.copyData(data));
+ }
+ }
+
+ protected void doSavePreferenceStore()
+ {
+ XSDEditorPlugin.getDefault().savePluginPreferences(); // model
+ }
+
+ public boolean performOk()
+ {
+ boolean result = super.performOk();
+
+ doSavePreferenceStore();
+
+ return result;
+ }
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/preferences/XSDPreferencePage.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/preferences/XSDPreferencePage.java
index 7560216..b378410 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/preferences/XSDPreferencePage.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/preferences/XSDPreferencePage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
+ * Copyright (c) 2001, 2009 IBM Corporation 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
@@ -11,7 +11,6 @@
*******************************************************************************/
package org.eclipse.wst.xsd.ui.internal.preferences;
-import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.swt.SWT;
@@ -30,11 +29,7 @@
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.PreferenceLinkArea;
import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
-import org.eclipse.wst.xsd.core.internal.XSDCorePlugin;
-import org.eclipse.wst.xsd.core.internal.preferences.XSDCorePreferenceNames;
import org.eclipse.wst.xsd.ui.internal.editor.Messages;
import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorCSHelpIds;
import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorContextIds;
@@ -48,10 +43,6 @@
Text schemaNsPrefixField;
Text defaultTargetNamespaceText;
Button qualifyXSDLanguage;
- private Button honourAllSchemaLocations = null;
- private Button fullSchemaConformance = null;
- private Button removeUnusedImports;
- private Button automaticallyOpenSchemaLocationDialog;
/**
* Creates preference page controls on demand.
@@ -61,10 +52,6 @@
{
WorkbenchHelp.setHelp(parent, XSDEditorContextIds.XSDP_PREFERENCE_PAGE);
- new PreferenceLinkArea(parent, SWT.WRAP | SWT.MULTI, "org.eclipse.wst.sse.ui.preferences.editor", Messages._UI_STRUCTURED_TEXT_EDITOR_PREFS_LINK,//$NON-NLS-1$
- (IWorkbenchPreferenceContainer) getContainer(), null).getControl().setLayoutData(GridDataFactory.fillDefaults().hint(150, SWT.DEFAULT).create());
- new Label(parent, SWT.NONE).setLayoutData(GridDataFactory.swtDefaults().create());
-
Group group = createGroup(parent, 2);
group.setText(Messages._UI_TEXT_XSD_NAMESPACE_PREFIX);
@@ -91,10 +78,6 @@
XSDEditorCSHelpIds.XMLSCHEMAFILES_PREFERENCES__DEFAULT_TARGETNAMESPACE);
- createContentsForValidatingGroup(parent);
-
- createContentsForImportCleanup(parent);
-
initializeValues();
applyDialogFont(parent);
@@ -144,60 +127,6 @@
return label;
}
- protected void createContentsForValidatingGroup(Composite parent)
- {
- Group validatingGroup = createGroup(parent, 1);
- validatingGroup.setText(Messages._UI_VALIDATING_FILES);
-
- //GridData
- GridData data = new GridData(SWT.FILL);
- data.verticalAlignment = SWT.CENTER;
- data.horizontalAlignment = SWT.FILL;
-
- if (honourAllSchemaLocations == null)
- {
- honourAllSchemaLocations = new Button(validatingGroup, SWT.CHECK | SWT.LEFT);
- honourAllSchemaLocations.setText(Messages._UI_TEXT_HONOUR_ALL_SCHEMA_LOCATIONS);
- honourAllSchemaLocations.setLayoutData(data);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(honourAllSchemaLocations,
- XSDEditorCSHelpIds.XMLSCHEMAFILES_PREFERENCES__HONOUR_ALL_SCHEMA_LOCATIONS);
-
- }
- if (fullSchemaConformance == null)
- {
- fullSchemaConformance = new Button(validatingGroup, SWT.CHECK | SWT.LEFT);
- fullSchemaConformance.setLayoutData(GridDataFactory.copyData(data));
- fullSchemaConformance.setText(Messages._UI_FULL_CONFORMANCE);
- }
-
- }
-
- private void createContentsForImportCleanup(Composite parent)
- {
- Group unusedImportGroup = createGroup(parent, 1);
- unusedImportGroup.setText(Messages._UI_GRAPH_DIRECTIVES);
-
- //GridData
- GridData data = new GridData(SWT.FILL);
- data.verticalAlignment = SWT.CENTER;
- data.horizontalAlignment = SWT.FILL;
-
- if (removeUnusedImports == null)
- {
- removeUnusedImports = new Button(unusedImportGroup, SWT.CHECK | SWT.LEFT);
- removeUnusedImports.setText(Messages._UI_TEXT_ENABLE_AUTO_IMPORT_CLEANUP);
- removeUnusedImports.setLayoutData(data);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(removeUnusedImports,
- XSDEditorCSHelpIds.XMLSCHEMAFILES_PREFERENCES__IMPORT_CLEANUP);
-
- automaticallyOpenSchemaLocationDialog = new Button(unusedImportGroup, SWT.CHECK | SWT.LEFT);
- automaticallyOpenSchemaLocationDialog.setText(Messages._UI_TEXT_ENABLE_AUTO_OPEN_SCHEMA_DIALOG);
- automaticallyOpenSchemaLocationDialog.setLayoutData(GridDataFactory.copyData(data));
- }
- }
-
/**
* Does anything necessary because the default button has been pressed.
*/
@@ -262,10 +191,6 @@
schemaNsPrefixField.setText(getPreferenceStore().getDefaultString(XSDEditorPlugin.CONST_XSD_DEFAULT_PREFIX_TEXT));
qualifyXSDLanguage.setSelection(getPreferenceStore().getDefaultBoolean(XSDEditorPlugin.CONST_XSD_LANGUAGE_QUALIFY));
defaultTargetNamespaceText.setText(getPreferenceStore().getString(XSDEditorPlugin.CONST_DEFAULT_TARGET_NAMESPACE));
- honourAllSchemaLocations.setSelection(XSDCorePlugin.getDefault().getPluginPreferences().getDefaultBoolean(XSDCorePreferenceNames.HONOUR_ALL_SCHEMA_LOCATIONS));
- fullSchemaConformance.setSelection(XSDCorePlugin.getDefault().getPluginPreferences().getDefaultBoolean(XSDCorePreferenceNames.FULL_SCHEMA_CONFORMANCE));
- removeUnusedImports.setSelection(getPreferenceStore().getDefaultBoolean(XSDEditorPlugin.CONST_XSD_IMPORT_CLEANUP));
- automaticallyOpenSchemaLocationDialog.setSelection(getPreferenceStore().getDefaultBoolean(XSDEditorPlugin.CONST_XSD_AUTO_OPEN_SCHEMA_LOCATION_DIALOG));
}
/**
@@ -277,10 +202,6 @@
schemaNsPrefixField.setText(store.getString(XSDEditorPlugin.CONST_XSD_DEFAULT_PREFIX_TEXT));
qualifyXSDLanguage.setSelection(store.getBoolean(XSDEditorPlugin.CONST_XSD_LANGUAGE_QUALIFY));
defaultTargetNamespaceText.setText(store.getString(XSDEditorPlugin.CONST_DEFAULT_TARGET_NAMESPACE));
- honourAllSchemaLocations.setSelection(XSDCorePlugin.getDefault().getPluginPreferences().getBoolean(XSDCorePreferenceNames.HONOUR_ALL_SCHEMA_LOCATIONS));
- fullSchemaConformance.setSelection(XSDCorePlugin.getDefault().getPluginPreferences().getBoolean(XSDCorePreferenceNames.FULL_SCHEMA_CONFORMANCE));
- removeUnusedImports.setSelection(store.getBoolean(XSDEditorPlugin.CONST_XSD_IMPORT_CLEANUP));
- automaticallyOpenSchemaLocationDialog.setSelection(store.getBoolean(XSDEditorPlugin.CONST_XSD_AUTO_OPEN_SCHEMA_LOCATION_DIALOG));
}
/**
@@ -293,15 +214,8 @@
store.setValue(XSDEditorPlugin.CONST_XSD_DEFAULT_PREFIX_TEXT, getXMLSchemaPrefix());
store.setValue(XSDEditorPlugin.CONST_XSD_LANGUAGE_QUALIFY, getQualify());
store.setValue(XSDEditorPlugin.CONST_DEFAULT_TARGET_NAMESPACE, getXMLSchemaTargetNamespace());
- store.setValue(XSDEditorPlugin.CONST_XSD_IMPORT_CLEANUP, getRemoveImportSetting());
- store.setValue(XSDEditorPlugin.CONST_XSD_AUTO_OPEN_SCHEMA_LOCATION_DIALOG, getAutomaticallyOpenSchemaLocationDialogSetting());
XSDEditorPlugin.getPlugin().savePluginPreferences();
-
- XSDCorePlugin.getDefault().getPluginPreferences().setValue(XSDCorePreferenceNames.HONOUR_ALL_SCHEMA_LOCATIONS, honourAllSchemaLocations.getSelection());
- XSDCorePlugin.getDefault().getPluginPreferences().setValue(XSDCorePreferenceNames.FULL_SCHEMA_CONFORMANCE, fullSchemaConformance.getSelection());
-
- XSDCorePlugin.getDefault().savePluginPreferences();
}
public String getXMLSchemaPrefix()
@@ -319,16 +233,6 @@
return qualifyXSDLanguage.getSelection();
}
- public boolean getRemoveImportSetting()
- {
- return removeUnusedImports.getSelection();
- }
-
- public boolean getAutomaticallyOpenSchemaLocationDialogSetting()
- {
- return automaticallyOpenSchemaLocationDialog.getSelection();
- }
-
/**
* Get the xml schema default target namespace
*/
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/preferences/XSDValidatorPreferencePage.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/preferences/XSDValidatorPreferencePage.java
new file mode 100644
index 0000000..957ae11
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/preferences/XSDValidatorPreferencePage.java
@@ -0,0 +1,126 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2009 IBM Corporation 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
+ *******************************************************************************/
+
+package org.eclipse.wst.xsd.ui.internal.preferences;
+
+
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.PreferenceLinkArea;
+import org.eclipse.ui.help.IWorkbenchHelpSystem;
+import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
+import org.eclipse.wst.sse.ui.internal.preferences.ui.AbstractPreferencePage;
+import org.eclipse.wst.xsd.core.internal.XSDCorePlugin;
+import org.eclipse.wst.xsd.core.internal.preferences.XSDCorePreferenceNames;
+import org.eclipse.wst.xsd.ui.internal.editor.Messages;
+import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorContextIds;
+
+
+public class XSDValidatorPreferencePage extends AbstractPreferencePage
+{
+ private static final String XML_VALIDATOR_PREFERENCE_PAGE_ID = "org.eclipse.wst.sse.ui.preferences.xml.validation"; //$NON-NLS-1$
+
+ private Button fullSchemaConformance = null;
+
+ protected Control createContents(Composite parent)
+ {
+ final Composite composite = super.createComposite(parent, 1);
+ IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
+
+ helpSystem.setHelp(parent, XSDEditorContextIds.XSDP_VALIDATOR_PREFERENCE_PAGE);
+
+ new PreferenceLinkArea(composite, SWT.WRAP | SWT.MULTI, XML_VALIDATOR_PREFERENCE_PAGE_ID, Messages._UI_XML_VALIDATOR_PREFS_LINK,
+ (IWorkbenchPreferenceContainer)getContainer(), null).getControl().setLayoutData(GridDataFactory.fillDefaults().hint(150, SWT.DEFAULT).create());
+ new Label(composite, SWT.NONE).setLayoutData(GridDataFactory.swtDefaults().create());
+
+ createContentsForValidatingGroup(composite);
+
+ setSize(composite);
+ loadPreferences();
+
+ return composite;
+ }
+
+ private void createContentsForValidatingGroup(Composite parent)
+ {
+ Group validatingGroup = createGroup(parent, 1);
+ validatingGroup.setText(Messages._UI_VALIDATING_FILES);
+
+ GridData data = new GridData(SWT.FILL);
+ data.verticalAlignment = SWT.CENTER;
+ data.horizontalAlignment = SWT.FILL;
+
+ if (fullSchemaConformance == null)
+ {
+ fullSchemaConformance = new Button(validatingGroup, SWT.CHECK | SWT.LEFT);
+ fullSchemaConformance.setLayoutData(GridDataFactory.copyData(data));
+ fullSchemaConformance.setText(Messages._UI_FULL_CONFORMANCE);
+ }
+ }
+
+ protected void performDefaults()
+ {
+ fullSchemaConformance.setSelection(getModelPreferences().getDefaultBoolean(XSDCorePreferenceNames.FULL_SCHEMA_CONFORMANCE));
+ super.performDefaults();
+ }
+
+ protected void initializeValues()
+ {
+ initializeValuesForValidatingGroup();
+ super.initializeValues();
+ }
+
+ protected void initializeValuesForValidatingGroup()
+ {
+ fullSchemaConformance.setSelection(getModelPreferences().getBoolean(XSDCorePreferenceNames.FULL_SCHEMA_CONFORMANCE));
+ }
+
+ protected Preferences getModelPreferences()
+ {
+ return XSDCorePlugin.getDefault().getPluginPreferences();
+ }
+
+ protected void storeValuesForValidatingGroup()
+ {
+ if (fullSchemaConformance != null)
+ {
+ boolean fullSchemaConformanceSelected = fullSchemaConformance.getSelection();
+ getModelPreferences().setValue(XSDCorePreferenceNames.FULL_SCHEMA_CONFORMANCE, fullSchemaConformanceSelected);
+ }
+ }
+
+ protected void storeValues()
+ {
+ storeValuesForValidatingGroup();
+ }
+
+ protected void doSavePreferenceStore()
+ {
+ XSDCorePlugin.getDefault().savePluginPreferences(); // model
+ }
+
+ public boolean performOk()
+ {
+ boolean result = super.performOk();
+
+ doSavePreferenceStore();
+
+ return result;
+ }
+}