[258000] Provide dependency info
diff --git a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/AbstractValidator.java b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/AbstractValidator.java
index 3d884d9..bda42a5 100644
--- a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/AbstractValidator.java
+++ b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/AbstractValidator.java
@@ -32,8 +32,10 @@
 	
 	/**
 	 * Validate the resource. The validator is called from a WorkspaceJob, so
-	 * the validator itself does not need to establish it's own
-	 * IWorkspaceRunnable.
+	 * the validator itself does not need to establish it's own IWorkspaceRunnable.
+	 * <p>
+	 * If you override this method then you should not override the other validate method.
+	 * </p>
 	 * 
 	 * @param resource
 	 * 		The resource to be validated.
@@ -56,7 +58,43 @@
 	 * 
 	 * @return the result of the validation. This may be, but usually isn't, null.
 	 */
-	public abstract ValidationResult validate(IResource resource, int kind, ValidationState state, IProgressMonitor monitor);
+	public ValidationResult validate(IResource resource, int kind, ValidationState state, IProgressMonitor monitor){
+		return null;
+	}
+	
+	/**
+	 * Validate the resource. The validator is called from a WorkspaceJob, so
+	 * the validator itself does not need to establish it's own
+	 * IWorkspaceRunnable.
+	 * <p>
+	 * If you override this method then you should not override the other
+	 * validate method.
+	 * </p>
+	 * 
+	 * @param event
+	 *            An object that describes the resource to be validated and why
+	 *            it should be validated.
+	 * 
+	 * @param state
+	 *            A way to pass arbitrary, validator specific, data from one
+	 *            invocation of a validator to the next, during the validation
+	 *            phase. At the end of the validation phase, this object will be
+	 *            cleared, thereby allowing any of this state information to be
+	 *            garbaged collected.
+	 * 
+	 * @param monitor
+	 *            A monitor that you can use to report your progress. To be a
+	 *            well behaved validator you need to check the isCancelled()
+	 *            method at appropriate times.
+	 * 
+	 * @return the result of the validation. Null should never be returned. If
+	 *         null is returned then the other validate method will be called as
+	 *         well.
+	 */
+	public ValidationResult validate(ValidationEvent event, ValidationState state, IProgressMonitor monitor){
+		return null;
+	}
+	
 	
 	/**
 	 * A call back method that lets the validator know that the project is being
diff --git a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/ValidationEvent.java b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/ValidationEvent.java
new file mode 100644
index 0000000..528e58e
--- /dev/null
+++ b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/ValidationEvent.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.validation;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceDelta;
+
+/**
+ * An object that describes which object should be validated and what triggered its validation.
+ * <p>
+ * <b>Provisional API:</b> This class/interface is part of an interim API that is still under development and expected to 
+ * change significantly before reaching stability. It is being made available at this early stage to solicit feedback 
+ * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken 
+ * (repeatedly) as the API evolves.
+ * </p>
+ * @author karasiuk
+ *
+ */
+
+public final class ValidationEvent {
+	
+	private IResource 		_resource;
+	private int				_kind;
+	private IResourceDelta 	_dependsOn;
+	
+	/**
+	 * Create an object that describes what should be validated.
+	 * 
+	 * @param resource
+	 *            The resource to be validated.
+	 * @param kind
+	 *            The way the resource changed. It uses the same values as the
+	 *            kind parameter in IResourceDelta.
+	 * @param dependsOn
+	 *            If the resource is being validated because one of it's
+	 *            dependencies has changed, that change is described here. This
+	 *            can be null.
+	 */
+	public ValidationEvent(IResource resource, int kind, IResourceDelta dependsOn){
+		_resource = resource;
+		_kind = kind;
+		_dependsOn = dependsOn;
+	}
+
+	/**
+	 * The resource to be validated.
+	 */
+	public IResource getResource() {
+		return _resource;
+	}
+
+	/**
+	 * The way the resource changed. It uses the same values as the kind
+	 * parameter in IResourceDelta.
+	 */
+	public int getKind() {
+		return _kind;
+	}
+
+	/**
+	 * If the resource is being validated because one of it's dependencies has changed, that change is described here.
+	 * This method will return null when the trigger is not because of a dependency change.
+	 */
+	public IResourceDelta getDependsOn() {
+		return _dependsOn;
+	}
+}
diff --git a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/ValidationState.java b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/ValidationState.java
index bee84c4..a114670 100644
--- a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/ValidationState.java
+++ b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/ValidationState.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2007, 2008 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
@@ -45,6 +45,8 @@
 	 * resource that actually changed, is placed into the ValidationState using
 	 * this id.
 	 * </p>
+	 * @deprecated This approach is not thread safe, the longer form of the AbstractValidator validate method should be used instead.
+	 * @see AbstractValidator#validate(org.eclipse.core.resources.IResource, int, ValidationState, org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.resources.IResource, int)
 	 */
 	public static final String TriggerResource = ValidationPlugin.PLUGIN_ID + ".Trigger"; //$NON-NLS-1$
 
diff --git a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/Validator.java b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/Validator.java
index ce9cc31..f79cc6d 100644
--- a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/Validator.java
+++ b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/Validator.java
@@ -339,17 +339,49 @@
 		}
 		return result;
 	}
+	
 	/**
 	 * Validate the resource.
 	 * 
-	 * @param resource the resource to be validated
-	 * @param kind the kind of resource change, see IResourceDelta for values.
-	 * @param operation the operation that this validation is running under. This can be null.
-	 * @param monitor a way to report progress. This can be null.
+	 * @param resource
+	 *            The resource to be validated.
+	 * @param kind
+	 *            The kind of resource change, see IResourceDelta for values.
+	 * @param operation
+	 *            The operation that this validation is running under. This can
+	 *            be null.
+	 * @param monitor
+	 *            A way to report progress. This can be null.
 	 * 
-	 * @return the result of doing the validation, it can be, but usually isn't null.
+	 * @return the result of doing the validation, it can be, but usually isn't
+	 *         null.
 	 */
-	public abstract ValidationResult validate(IResource resource, int kind, ValOperation operation, IProgressMonitor monitor);	
+	public abstract ValidationResult validate(IResource resource, int kind, ValOperation operation, IProgressMonitor monitor);
+	
+	/**
+	 * Validate the resource.
+	 * 
+	 * @param resource
+	 *            The resource to be validated.
+	 * @param kind
+	 *            The kind of resource change, see IResourceDelta for values.
+	 * @param operation
+	 *            The operation that this validation is running under. This can
+	 *            be null.
+	 * @param monitor
+	 *            A way to report progress. This can be null.
+	 * @param event
+	 *            An event that describes in more detail what should be
+	 *            validated and why it should be validated. This can be null.
+	 * 
+	 * @return the result of doing the validation, it can be, but usually isn't
+	 *         null.
+	 */
+	public ValidationResult validate(IResource resource, int kind, ValOperation operation, IProgressMonitor monitor, ValidationEvent event){
+		// The reason that the resource and kind are still specified, is that I didn't want to remove a public method in the service
+		// stream. 
+		return validate(resource, kind, operation, monitor);		
+	}
 
 	/**
 	 * This method will be called before any validation takes place. It allows validators to perform any
@@ -1025,12 +1057,19 @@
 	}
 	
 	@Override
-	public ValidationResult validate(IResource resource, int kind, ValOperation operation, IProgressMonitor monitor) {
+	public ValidationResult validate(IResource resource, int kind, ValOperation operation, IProgressMonitor monitor){
+		return validate(resource, kind, operation, monitor, null);
+	}
+	
+	@Override
+	public ValidationResult validate(IResource resource, int kind, ValOperation operation, IProgressMonitor monitor, ValidationEvent event) {
 		ValidationResult vr = null;
 		if (operation == null)operation = new ValOperation();
 		if (monitor == null)monitor = new NullProgressMonitor();
 		try {
-			vr = getDelegatedValidator().validate(resource, kind, operation.getState(), monitor);
+			if (event == null)event = new ValidationEvent(resource, kind, null);
+			vr = getDelegatedValidator().validate(event, operation.getState(), monitor);
+			if (vr == null)vr = getDelegatedValidator().validate(resource, kind, operation.getState(), monitor);
 		}
 		catch (Exception e){
 			try {
diff --git a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValBuilderJob.java b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValBuilderJob.java
index 59c6c63..5d3ab2b 100644
--- a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValBuilderJob.java
+++ b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValBuilderJob.java
@@ -30,6 +30,7 @@
 import org.eclipse.wst.validation.DependentResource;
 import org.eclipse.wst.validation.Friend;
 import org.eclipse.wst.validation.IDependencyIndex;
+import org.eclipse.wst.validation.ValidationEvent;
 import org.eclipse.wst.validation.ValidationFramework;
 import org.eclipse.wst.validation.ValidationState;
 import org.eclipse.wst.validation.Validator;
@@ -210,8 +211,9 @@
 				if (Friend.shouldValidate(dr.getValidator(), dr.getResource(), ValType.Build, new ContentTypeWrapper())){
 					mm.clearMarker(dr.getResource(), dr.getValidator()); 
 					_request.getOperation().getState().put(ValidationState.TriggerResource, resource);
+					ValidationEvent event = new ValidationEvent(dr.getResource(), IResourceDelta.NO_CHANGE, delta);
 					ValManager.getDefault().validate(dr.getValidator(), _request.getOperation(), dr.getResource(), 
-						IResourceDelta.NO_CHANGE, _monitor);
+						IResourceDelta.NO_CHANGE, _monitor, event);
 				}
 			}
 		}
diff --git a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValManager.java b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValManager.java
index 8ecd1ac..95462ed 100644
--- a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValManager.java
+++ b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValManager.java
@@ -44,6 +44,7 @@
 import org.eclipse.wst.validation.IPerformanceMonitor;
 import org.eclipse.wst.validation.IValidatorGroupListener;
 import org.eclipse.wst.validation.PerformanceCounters;
+import org.eclipse.wst.validation.ValidationEvent;
 import org.eclipse.wst.validation.ValidationFramework;
 import org.eclipse.wst.validation.ValidationResult;
 import org.eclipse.wst.validation.ValidationState;
@@ -606,7 +607,7 @@
 				SubMonitor subMonitor = SubMonitor.convert(monitor);
 				String task = NLS.bind(ValMessages.LogValStart, validator.getName(), resource.getName());
 				subMonitor.beginTask(task, 1);
-				validate(validator, operation, resource, kind, subMonitor.newChild(1));
+				validate(validator, operation, resource, kind, subMonitor.newChild(1), null);
 			}			
 		};
 		SubMonitor sm = SubMonitor.convert(monitor, getValidators(project).length);
@@ -627,7 +628,7 @@
 	 * @param monitor
 	 */
 	public void validate(Validator validator, ValOperation operation, IResource resource, int kind, 
-			IProgressMonitor monitor){
+			IProgressMonitor monitor, ValidationEvent event){
 		if (operation.isValidated(validator.getId(), resource))return;
 		long time = 0;
 		long cpuTime = -1;
@@ -642,7 +643,7 @@
 		if (Tracing.matchesExtraDetail(validator.getId())){
 			Tracing.log("ValManager-03: validating ", resource); //$NON-NLS-1$
 		}
-		ValidationResult vr = validator.validate(resource, kind, operation, monitor);
+		ValidationResult vr = validator.validate(resource, kind, operation, monitor, event);
 		if (pm.isCollecting()){
 			if (cpuTime != -1){
 				cpuTime = Misc.getCPUTime() - cpuTime;