[385221] Validation rule for target runtime is not working on EJB
Validator
diff --git a/plugins/org.eclipse.wst.validation/META-INF/MANIFEST.MF b/plugins/org.eclipse.wst.validation/META-INF/MANIFEST.MF
index 12202b1..7455b86 100644
--- a/plugins/org.eclipse.wst.validation/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.wst.validation/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: %Bundle-Name.0
 Bundle-SymbolicName: org.eclipse.wst.validation; singleton:=true
-Bundle-Version: 1.2.250.qualifier
+Bundle-Version: 1.2.251.qualifier
 Bundle-Activator: org.eclipse.wst.validation.internal.plugin.ValidationPlugin
 Bundle-Vendor: %Bundle-Vendor.0
 Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/model/FilterRule.java b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/model/FilterRule.java
index 12c8d0c..253892b 100644
--- a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/model/FilterRule.java
+++ b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/model/FilterRule.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2007, 2011 IBM Corporation and others.
+ * Copyright (c) 2007, 2012 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
@@ -569,6 +569,16 @@
 			return ValMessages.RuleTargetRuntime;
 		}
 		
+		public Boolean matchesProject(IProject project){
+			try {
+				return ValidatorHelper.getTargetRuntime(project).getName().equals(_pattern);
+			} catch (CoreException e) {
+				//do nothing
+			}
+			
+			return false;
+		}
+		
 		@Override
 		public String toString() {
 			if(patternLabel == null){
diff --git a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/model/ValidatorHelper.java b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/model/ValidatorHelper.java
index 06f03ad..21cbc32 100644
--- a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/model/ValidatorHelper.java
+++ b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/model/ValidatorHelper.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2005, 2009 IBM Corporation and others.
+ * Copyright (c) 2005, 2012 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
@@ -13,7 +13,10 @@
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
-
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
 import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
 import org.eclipse.wst.common.project.facet.core.runtime.RuntimeManager;
 import org.eclipse.wst.validation.internal.ValidatorMutable;
@@ -97,4 +100,19 @@
 		
 		return runtime.getLocalizedName();
 	}
+	
+	/**
+	 * Return the target runtime of the given IProject
+	 * @param project
+	 * @return
+	 */
+	@SuppressWarnings("deprecation")
+	public static IRuntime getTargetRuntime(IProject project) throws CoreException {
+		IFacetedProject facetedProject = ProjectFacetsManager.create(project);
+		
+		if(facetedProject != null)
+			return facetedProject.getRuntime();
+		
+		return null;
+	}
 }