|Re: library providers enablement expressions [message #572463 is a reply to message #572445]
||Thu, 01 April 2010 20:32
| Konstantin Komissarchik
Registered: July 2009
The library providers extension point supports arbitrary enablement expressions, but using the enablement expression language takes a little getting used to. The way property testers work is particularly tricky.|
<test property="org.eclipse.wst.common.project.facet.core.projectFacet " value="jst.jaxrs:1.0" forcePluginActivation="true" />
<test property="org.eclipse.wst.common.project.facet.core.projectFacet " value="jst.jsf:" forcePluginActivation="true" />
You can write it simpler by pulling up with operator higher, but this should work too. Perhaps the property tester is getting confused by the trailing colon in "jst.jsf:". Try it just as "jst.jsf".
Regarding your question about using a custom property tester, could you show how you are defining the property tester? You must define the property tester for specific types for the expression evaluator to know about them. Based on how you wrote that enablement expression, your context variable is going to be IProjectFacetVersion. Judging by the exception you are getting, your property tester is not defined for this type.
It doesn't sound like IProjectFacetVersion is enough for what you are trying to test, anyway, so you have to pick a different variable to use. Here is the list of the available variables:
context - EvaluationContext (if your custom property tester needs access to variety of things)
requestingProjectFacet - IProjectFacetVersion (same as default variable)
projectFacets - Collection<IProjectFacetVersion>
targetedRuntimes - Collection<IRuntime>
provider - ILibraryProvider
Based on what you've said so far, try using "context" variable, which of type org.eclipse.jst.common.project.facet.core.libprov.Enablement ExpressionContext. This will give your property tester access to pretty much everything available. Remember that you have to register your property tester to work with EnablementExpressionContext type.
Hope this helps. Post further questions, if necessary.
Powered by FUDForum
. Page generated in 0.02282 seconds