[249322] Add facet version to the filter rules
diff --git a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ExtensionConstants.java b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ExtensionConstants.java
index 9073cdb..1b34fed 100644
--- a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ExtensionConstants.java
+++ b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ExtensionConstants.java
@@ -130,6 +130,9 @@
* </ul>
*/
String fileType = "type"; //$NON-NLS-1$
+
+ /** version - facet version expression. See the facet framework for the exact syntax of this expression. */
+ String version = "version"; //$NON-NLS-1$
}
interface FileType {
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 0097cd5..a12b51a 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
@@ -404,9 +404,12 @@
public static class Facet extends FilterRule {
+ private String _versionExpression;
+
public FilterRule copy() {
Facet rule = new Facet();
rule._pattern = _pattern;
+ rule._versionExpression = _versionExpression;
return rule;
}
@@ -420,12 +423,14 @@
public void setData(IConfigurationElement rule) {
_pattern = rule.getAttribute(ExtensionConstants.RuleAttrib.id);
+ _versionExpression = rule.getAttribute(ExtensionConstants.RuleAttrib.version);
}
@Override
public Boolean matchesProject(IProject project) {
try {
- return FacetedProjectFramework.hasProjectFacet(project, _pattern);
+ if (_versionExpression == null)return FacetedProjectFramework.hasProjectFacet(project, _pattern);
+ return FacetedProjectFramework.hasProjectFacet(project, _pattern, _versionExpression);
}
catch (CoreException e){
if (Tracing.isLogging())ValidationPlugin.getPlugin().handleException(e);
@@ -433,6 +438,21 @@
return Boolean.FALSE;
}
+ @Override
+ public String toString() {
+ StringBuffer b = new StringBuffer(200);
+ b.append(getDisplayableType());
+ b.append(": "); //$NON-NLS-1$
+ b.append(_pattern);
+
+ if (_versionExpression != null){
+ b.append(" ("); //$NON-NLS-1$
+ b.append(_versionExpression);
+ b.append(")"); //$NON-NLS-1$
+ }
+ return b.toString();
+ }
+
}
public static class ContentType extends FilterRule {
diff --git a/plugins/org.eclipse.wst.validation/xsds/validator.exsd b/plugins/org.eclipse.wst.validation/xsds/validator.exsd
index 7699671..fedb630 100644
--- a/plugins/org.eclipse.wst.validation/xsds/validator.exsd
+++ b/plugins/org.eclipse.wst.validation/xsds/validator.exsd
@@ -238,6 +238,13 @@
</documentation>
</annotation>
</attribute>
+ <attribute name="version" type="string">
+ <annotation>
+ <documentation>
+ A version expression that can be used to futher qualify the match. If not specifed, then versions are not used as a criteria for selecting the facet. The syntax of this expression, is the same syntax that is used by the facet framework.
+ </documentation>
+ </annotation>
+ </attribute>
</complexType>
</element>
@@ -331,6 +338,15 @@
<annotation>
<appinfo>
+ <meta.section type="apiInfo"/>
+ </appinfo>
+ <documentation>
+ Provisional API.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
<meta.section type="since"/>
</appinfo>
<documentation>
@@ -361,15 +377,6 @@
</documentation>
</annotation>
- <annotation>
- <appinfo>
- <meta.section type="apiInfo"/>
- </appinfo>
- <documentation>
- Provisional API.
- </documentation>
- </annotation>
-
<annotation>
<appinfo>