[367856] [validation] Track javascript dependencies for validation in HTML
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/validate/HTMLAttributeValidator.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/validate/HTMLAttributeValidator.java
index 347db0d..c8863cb 100644
--- a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/validate/HTMLAttributeValidator.java
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/validate/HTMLAttributeValidator.java
@@ -217,7 +217,7 @@
// roundabout start tag check
if (start != null && start.getFirstRegion().getTextLength() == 1) {
// only check when we have a way to set dependencies
- Collection dependencies = (Collection) ((IDOMNode) node).getOwnerDocument().getUserData(HTMLValidationAdapterFactory.DEPENDENCIES);
+ Collection dependencies = (Collection) ((IDOMNode) ((IDOMNode) node).getOwnerDocument()).getUserData(HTMLValidationAdapterFactory.DEPENDENCIES);
if (dependencies != null) {
IPath basePath = new Path(((IDOMNode) node).getModel().getBaseLocation());
if (basePath.segmentCount() > 1) {
diff --git a/bundles/org.eclipse.wst.html.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.wst.html.ui/META-INF/MANIFEST.MF
index 2a5754d..111184a 100644
--- a/bundles/org.eclipse.wst.html.ui/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.wst.html.ui/META-INF/MANIFEST.MF
@@ -31,8 +31,7 @@
org.eclipse.wst.html.ui.views.contentoutline
Import-Package: com.ibm.icu.util; version="3.8",
com.ibm.icu.text; version="3.8"
-Require-Bundle: org.apache.xerces;bundle-version="[2.9.0,3.0.0)",
- org.eclipse.ui.ide;bundle-version="[3.5.0,4.0.0)",
+Require-Bundle: org.eclipse.ui.ide;bundle-version="[3.5.0,4.0.0)",
org.eclipse.jface.text;bundle-version="[3.5.0,4.0.0)",
org.eclipse.ui.workbench.texteditor;bundle-version="[3.5.0,4.0.0)",
org.eclipse.ui.forms;bundle-version="[3.4.0,4.0.0)",
diff --git a/bundles/org.eclipse.wst.html.ui/src-html-validation/org/eclipse/wst/html/internal/validation/HTMLValidator.java b/bundles/org.eclipse.wst.html.ui/src-html-validation/org/eclipse/wst/html/internal/validation/HTMLValidator.java
index e203e40..0c2643f 100644
--- a/bundles/org.eclipse.wst.html.ui/src-html-validation/org/eclipse/wst/html/internal/validation/HTMLValidator.java
+++ b/bundles/org.eclipse.wst.html.ui/src-html-validation/org/eclipse/wst/html/internal/validation/HTMLValidator.java
@@ -68,6 +68,7 @@
import org.eclipse.wst.validation.internal.provisional.core.IValidationContext;
import org.eclipse.wst.validation.internal.provisional.core.IValidatorJob;
import org.eclipse.wst.xml.core.internal.document.DocumentTypeAdapter;
+import org.eclipse.wst.xml.core.internal.document.NodeImpl;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
import org.w3c.dom.Text;
@@ -497,13 +498,17 @@
try {
Collection dependencies = null;
+ NodeImpl document = null;
+ if (model.getDocument() instanceof NodeImpl) {
+ document = (NodeImpl) model.getDocument();
+ }
if (result != null) {
dependencies = new HashSet();
- model.getDocument().setUserData(HTMLValidationAdapterFactory.DEPENDENCIES, dependencies, null);
+ document.setUserData(HTMLValidationAdapterFactory.DEPENDENCIES, dependencies, null);
}
validate(reporter, file, model);
if (result != null) {
- model.getDocument().setUserData(HTMLValidationAdapterFactory.DEPENDENCIES, null, null);
+ document.setUserData(HTMLValidationAdapterFactory.DEPENDENCIES, null, null);
result.setDependsOn((IResource[]) dependencies.toArray(new IResource[dependencies.size()]));
}
}