*** empty log message ***
diff --git a/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/ValidationPreferences.java b/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/ValidationPreferences.java
new file mode 100644
index 0000000..264dee9
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/ValidationPreferences.java
@@ -0,0 +1,11 @@
+package org.eclipse.wst.xsl.core.internal;
+
+
+public class ValidationPreferences
+{
+ public static final String MAX_ERRORS = "MAX_ERRORS";
+ public static final String MISSING_PARAM = "MISSING_PARAM";
+ public static final String XPATHS = "CHECK_XPATHS";
+ public static final String TEMPLATES = "CHECK_TEMPLATES";
+ public static final String CALL_TEMPLATES = "CHECK_CALL_TEMPLATES";
+}
diff --git a/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/validation/XSLValidationMessage.java b/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/validation/XSLValidationMessage.java
index dd808ea..c6f0f76 100644
--- a/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/validation/XSLValidationMessage.java
+++ b/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/validation/XSLValidationMessage.java
@@ -31,4 +31,9 @@
{
return node;
}
+
+ public String toString()
+ {
+ return node.toString();
+ }
}
diff --git a/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/validation/XSLValidationReport.java b/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/validation/XSLValidationReport.java
index 35016b2..97adaa8 100644
--- a/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/validation/XSLValidationReport.java
+++ b/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/validation/XSLValidationReport.java
@@ -26,16 +26,27 @@
public class XSLValidationReport implements ValidationReport
{
private boolean valid = true;
- private Stylesheet stylesheet;
- private List<ValidationMessage> messages = new ArrayList<ValidationMessage>();
+ private String uri;
+ private List<XSLValidationMessage> errors = new ArrayList<XSLValidationMessage>();
+ private List<XSLValidationMessage> warnings = new ArrayList<XSLValidationMessage>();
/**
* TODO: Add Javadoc
* @param stylesheet
*/
- public XSLValidationReport(Stylesheet stylesheet)
+ public XSLValidationReport(String uri)
{
- this.stylesheet = stylesheet;
+ this.uri = uri;
+ }
+
+ public List<XSLValidationMessage> getErrors()
+ {
+ return errors;
+ }
+
+ public List<XSLValidationMessage> getWarnings()
+ {
+ return warnings;
}
/**
@@ -49,7 +60,8 @@
valid = false;
XSLValidationMessage msg = new XSLValidationMessage(message,node.getLineNumber()+1,node.getColumnNumber()+1,getFileURI());
msg.setSeverity(ValidationMessage.SEV_HIGH);
- addMessage(node,msg);
+ msg.setNode(node);
+ errors.add(msg);
return msg;
}
@@ -63,22 +75,17 @@
{
XSLValidationMessage msg = new XSLValidationMessage(message,node.getLineNumber()+1,node.getColumnNumber()+1,getFileURI());
msg.setSeverity(ValidationMessage.SEV_LOW);
- addMessage(node,msg);
+ msg.setNode(node);
+ warnings.add(msg);
return msg;
}
- private void addMessage(XSLNode node, XSLValidationMessage message)
- {
- message.setNode(node);
- messages.add(message);
- }
-
/**
* TODO: Add Java Doc
*/
public String getFileURI()
{
- return stylesheet.getFile().getLocationURI().toString();
+ return uri;
}
/**
@@ -95,6 +102,8 @@
*/
public ValidationMessage[] getValidationMessages()
{
+ List<ValidationMessage> messages = new ArrayList<ValidationMessage>(errors);
+ messages.addAll(warnings);
return messages.toArray(new ValidationMessage[0]);
}
diff --git a/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/validation/XSLValidator.java b/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/validation/XSLValidator.java
index ddd65df..c594237 100644
--- a/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/validation/XSLValidator.java
+++ b/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/validation/XSLValidator.java
@@ -49,19 +49,21 @@
{
}
- public ValidationReport validate(String uri, IFile xslFile) throws CoreException
+ public ValidationReport validate(IFile xslFile) throws CoreException
{
- long start = System.currentTimeMillis();
+ XSLValidationReport report = new XSLValidationReport(xslFile.getLocationURI().toString());
+ validate(xslFile, report);
+ return report;
+ }
+
+ public void validate(IFile xslFile, XSLValidationReport report) throws CoreException
+ {
StylesheetModel stylesheet = XSLCore.getInstance().buildStylesheet(xslFile);
- XSLValidationReport report = null;
+ long start = System.currentTimeMillis();
if (stylesheet!=null)
- {
- report = new XSLValidationReport(stylesheet.getStylesheet());
calculateProblems(stylesheet, report);
- }
long end = System.currentTimeMillis();
System.out.println("VALIDATE "+xslFile+" in "+(end-start)+"ms");
- return report;
}
private void calculateProblems(StylesheetModel stylesheetComposed, XSLValidationReport report) throws CoreException
diff --git a/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/validation/eclipse/Validator.java b/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/validation/eclipse/Validator.java
index 5e49903..88813fd 100644
--- a/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/validation/eclipse/Validator.java
+++ b/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/validation/eclipse/Validator.java
@@ -60,24 +60,28 @@
{
ValidationReport valreport = new ValidationReport(){
+ @Override
public String getFileURI()
{
// TODO Auto-generated method stub
return uri;
}
+ @Override
public HashMap getNestedMessages()
{
// TODO Auto-generated method stub
return new HashMap();
}
+ @Override
public ValidationMessage[] getValidationMessages()
{
// TODO Auto-generated method stub
return new ValidationMessage[0];
}
+ @Override
public boolean isValid()
{
// TODO Auto-generated method stub
@@ -92,7 +96,7 @@
IFile xslFile = files[0];
// FIXME this guard should be unnecessary!!
if (XSLCore.isXSLFile(xslFile))
- valreport = XSLValidator.getInstance().validate(uri, xslFile);
+ valreport = XSLValidator.getInstance().validate(xslFile);
}
}
catch (URISyntaxException e)
diff --git a/bundles/org.eclipse.wst.xsl.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.wst.xsl.ui/META-INF/MANIFEST.MF
index 69d33cd..9c194b2 100644
--- a/bundles/org.eclipse.wst.xsl.ui/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.wst.xsl.ui/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.wst.xsl.ui;singleton:=true
Bundle-Version: 0.5.0.qualifier
-Bundle-Activator: org.eclipse.wst.xsl.ui.internal.XSLTUIPlugin
+Bundle-Activator: org.eclipse.wst.xsl.ui.internal.XSLUIPlugin
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui;bundle-version="[3.4.0,4.0.0)",
org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
@@ -14,7 +14,6 @@
org.eclipse.debug.ui;bundle-version="[3.3.100,4.0.0)",
org.eclipse.search;bundle-version="[3.4.0,4.0.0)",
org.eclipse.ui.navigator.resources;bundle-version="[3.3.0,4.0.0)",
- org.eclipse.wst.xml.xpath.ui;bundle-version="[0.5.0,1.0.0)",
org.eclipse.wst.sse.ui;bundle-version="[1.1.0,2.0.0)",
org.apache.xalan;bundle-version="[2.7.1,2.8.0)",
org.eclipse.jface.text;bundle-version="[3.4.0,4.0.0)",
diff --git a/bundles/org.eclipse.wst.xsl.ui/plugin.xml b/bundles/org.eclipse.wst.xsl.ui/plugin.xml
index 3694789..7fb4114 100644
--- a/bundles/org.eclipse.wst.xsl.ui/plugin.xml
+++ b/bundles/org.eclipse.wst.xsl.ui/plugin.xml
@@ -59,6 +59,12 @@
id="org.eclipse.wst.xsl.ui.templates">
</keywordReference>
</page>
+ <page
+ category="org.eclipse.wst.xsl.ui.preferences.BasePreferencePage"
+ class="org.eclipse.wst.xsl.ui.internal.preferences.ValidationPreferencePage"
+ id="org.eclipse.wst.xsl.ui.preferences.Validation"
+ name="Validation">
+ </page>
</extension>
<extension
point="org.eclipse.ui.perspectives">
@@ -143,14 +149,14 @@
</editor>
</extension>
<!-- Editor actionsets -->
- <extension point="org.eclipse.ui.actionSetPartAssociations">
- <actionSetPartAssociation
- targetID="org.eclipse.ui.edit.text.actionSet.annotationNavigation">
- <part id="org.eclipse.wst.xsl.ui.XSLEditor"/>
- </actionSetPartAssociation>
- <actionSetPartAssociation
- targetID="org.eclipse.ui.NavigateActionSet">
- <part id="org.eclipse.wst.xsl.ui.XSLEditor"/>
- </actionSetPartAssociation>
- </extension>
+ <extension point="org.eclipse.ui.actionSetPartAssociations">
+ <actionSetPartAssociation
+ targetID="org.eclipse.ui.edit.text.actionSet.annotationNavigation">
+ <part id="org.eclipse.wst.xsl.ui.XSLEditor"/>
+ </actionSetPartAssociation>
+ <actionSetPartAssociation
+ targetID="org.eclipse.ui.NavigateActionSet">
+ <part id="org.eclipse.wst.xsl.ui.XSLEditor"/>
+ </actionSetPartAssociation>
+ </extension>
</plugin>
diff --git a/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/XSLTUIPlugin.java b/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/XSLTUIPlugin.java
deleted file mode 100644
index 80f9ea5..0000000
--- a/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/XSLTUIPlugin.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005-2007 Orangevolt (www.orangevolt.com)
- * 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:
- * Lars Gersmann (www.orangevolt.com)
- * David Carver - STAR - renaming package to follow wst naming.
- *******************************************************************************/
-
-package org.eclipse.wst.xsl.ui.internal;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class XSLTUIPlugin extends AbstractUIPlugin {
-
- /**
- * The Plugin ID
- */
- public static final String PLUGIN_ID = "org.eclipse.wst.xsl.ui"; //$NON-NLS-1$
-
- // The shared instance
- private static XSLTUIPlugin plugin;
-
- /**
- * The constructor
- */
- public XSLTUIPlugin() {
- }
-
- /**
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /**
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static XSLTUIPlugin getDefault() {
- return plugin;
- }
-
-}
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
new file mode 100644
index 0000000..9454746
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/preferences/ValidationPreferencePage.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Chase Technology Ltd - http://www.chasetechnology.co.uk
+ * 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:
+ * Doug Satchwell (Chase Technology Ltd) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.xsl.ui.internal.preferences;
+
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.wst.xsl.core.internal.ValidationPreferences;
+import org.eclipse.wst.xsl.core.internal.XSLCorePlugin;
+
+public class ValidationPreferencePage extends PreferencePage implements IWorkbenchPreferencePage
+{
+ private Text maxErrorsText;
+
+ public ValidationPreferencePage()
+ {
+ super();
+ // only used when page is shown programatically
+ setTitle("XSL Validation");
+ setDescription("Configure validation preferences");
+ }
+
+ @Override
+ protected Control createContents(Composite parent)
+ {
+ parent = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(2, false);
+ parent.setLayout(layout);
+
+ Label label = new Label(parent, SWT.NULL);
+ GridData gd = new GridData(SWT.NONE, SWT.CENTER, false, false);
+ label.setText("Maximum number of errors reported per stylesheet:"); //$NON-NLS-1$
+ label.setLayoutData(gd);
+
+ maxErrorsText = new Text(parent, SWT.BORDER);
+ gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ maxErrorsText.setLayoutData(gd);
+
+ setInput();
+
+ return parent;
+ }
+
+ private void setInput()
+ {
+ int missingParamPref = getInt(ValidationPreferences.MAX_ERRORS);
+ maxErrorsText.setText(String.valueOf(missingParamPref));
+ }
+
+ public void init(IWorkbench workbench)
+ {
+ }
+
+ @Override
+ protected void performDefaults()
+ {
+ super.performDefaults();
+ }
+
+ private int getInt(String pref)
+ {
+ return XSLCorePlugin.getDefault().getPluginPreferences().getInt(pref);
+ }
+
+ private void setValue(String pref, int val)
+ {
+ XSLCorePlugin.getDefault().getPluginPreferences().setValue(pref, val);
+ }
+
+ @Override
+ public boolean performOk()
+ {
+ String maxErrorsString = maxErrorsText.getText();
+ int maxErrors;
+ try
+ {
+ maxErrors = Integer.parseInt(maxErrorsString);
+ }
+ catch (NumberFormatException e)
+ {
+ maxErrors = getInt(ValidationPreferences.MAX_ERRORS);
+ }
+ setValue(ValidationPreferences.MAX_ERRORS, maxErrors);
+
+ XSLCorePlugin.getDefault().savePluginPreferences();
+ return true;
+ }
+}
diff --git a/bundles/org.eclipse.wst.xsl.xalan/META-INF/MANIFEST.MF b/bundles/org.eclipse.wst.xsl.xalan/META-INF/MANIFEST.MF
index dc6e725..8e1e415 100644
--- a/bundles/org.eclipse.wst.xsl.xalan/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.wst.xsl.xalan/META-INF/MANIFEST.MF
@@ -10,7 +10,7 @@
Require-Bundle: org.apache.xml.serializer;bundle-version="2.7.1",
org.apache.xml.resolver;bundle-version="[1.2.0,1.3.0)",
org.apache.xerces;bundle-version="[2.9.0,3.0.0)",
- org.apache.commons.logging;bundle-version="1.1.1",
+ org.apache.commons.logging;bundle-version="1.0.4",
org.apache.xalan;bundle-version="[2.7.0,2.8.0)",
org.eclipse.wst.xsl.debug;bundle-version="[0.5.0,1.0.0)"
Bundle-ClassPath: xalan-debugger.jar