[137422] validation in standalone JS editor stopped working in M6
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/validator/ReconcileStepForValidator.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/validator/ReconcileStepForValidator.java
index 15c16a8..27486ff 100644
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/validator/ReconcileStepForValidator.java
+++ b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/validator/ReconcileStepForValidator.java
@@ -207,7 +207,7 @@
private IncrementalHelper getHelper(IProject project) {
if (fHelper == null)
- fHelper = new IncrementalHelper(getStructuredDocument(), project);
+ fHelper = new IncrementalHelper(getDocument(), project);
return fHelper;
}
@@ -266,24 +266,23 @@
IFile file = getFile();
- if (file != null && file.exists()) {
- try {
- IProject project = file.getProject();
- IncrementalHelper helper = getHelper(project);
- IncrementalReporter reporter = getReporter();
+ try {
+ IncrementalHelper helper = getHelper(file != null ? file.getProject() : null);
+ IncrementalReporter reporter = getReporter();
+ if (file != null && file.exists()) {
helper.setURI(file.getFullPath().toString());
-
- fValidator.validate(helper, reporter);
-
- //results = createAnnotations(reporter.getMessages());
- results = createAnnotations(reporter.getAnnotationInfo());
- reporter.removeAllMessages(fValidator);
-
}
- catch (Exception e) {
- Logger.logException(e);
- }
+
+ fValidator.validate(helper, reporter);
+
+ // results = createAnnotations(reporter.getMessages());
+ results = createAnnotations(reporter.getAnnotationInfo());
+ reporter.removeAllMessages(fValidator);
+
+ }
+ catch (Exception e) {
+ Logger.logException(e);
}
return results;
}
@@ -313,28 +312,32 @@
}
protected IReconcileResult[] validate(DirtyRegion dirtyRegion, IRegion subRegion) {
- IReconcileResult[] results = EMPTY_RECONCILE_RESULT_SET;
-
- IFile file = getFile();
-
- if(file != null && file.exists()) {
- try {
- IProject project = file.getProject();
- IncrementalHelper helper = getHelper(project);
+ IReconcileResult[] results = EMPTY_RECONCILE_RESULT_SET;
+
+ IFile file = getFile();
+
+ try {
+ IncrementalHelper helper = getHelper(file != null ? file.getProject() : null);
+ /*
+ * Setting the URI isn't necessary for all source validators, we
+ * can still continue without it
+ */
+ if (file != null && file.exists()) {
helper.setURI(file.getFullPath().toString());
-
- if(fValidator instanceof ISourceValidator) {
- IncrementalReporter reporter = getReporter();
- ((ISourceValidator)fValidator).validate(dirtyRegion, helper, reporter);
- //results = createAnnotations(reporter.getMessages());
- results = createAnnotations(reporter.getAnnotationInfo());
- reporter.removeAllMessages(fValidator);
- }
-
- } catch (Exception e) {
- Logger.logException(e);
- }
- }
- return results;
- }
+ }
+
+ if (fValidator instanceof ISourceValidator) {
+ IncrementalReporter reporter = getReporter();
+ ((ISourceValidator) fValidator).validate(dirtyRegion, helper, reporter);
+ // results = createAnnotations(reporter.getMessages());
+ results = createAnnotations(reporter.getAnnotationInfo());
+ reporter.removeAllMessages(fValidator);
+ }
+
+ }
+ catch (Exception e) {
+ Logger.logException(e);
+ }
+ return results;
+ }
}
\ No newline at end of file