| How can I provide variables for property tests to create dynamic help content [message #730001] |
Tue, 27 September 2011 08:58  |
Riccardo Missing name Messages: 9 Registered: September 2011 |
Junior Member |
|
|
First of all, sorry for the duplicated post, but it seems that I should ask my question here instead of the Eclipse Platform forum.
User assistance provides two variables (platform and workbench) which can be used for property tests to determine the enablement of an element in the documentation. Furthermore you can define a property tester via the extension point org.eclipse.core.expressions.propertyTesters.
My question is how i can provide a new variable (eg. myVariable) which i want to use in my property tester, so that i can enable/disable an element in my XHTML-file?
<p>
<enablement>
<with variable="myVariable">
<test property="my.namespace.propertyName" value="expectedValue"/>
</with>
</enablement>
This paragraph should only be displayed when my provided varibale passes the test.
</p>
|
|
|
|
| Re: How can I provide variables for property tests to create dynamic help content [message #730858 is a reply to message #730670] |
Thu, 29 September 2011 07:54   |
Riccardo Missing name Messages: 9 Registered: September 2011 |
Junior Member |
|
|
The evaluation context seems to be created in org.eclipse.help.UAContentFilter whereby the platform variable is added via context.addVariable(VARIABLE_PLATFORM, Platform.class). It would be nice to have an extension point which allows to add additional variables to that context.
Since I implement my own providers for tocs and content extensions as well as content producers (see my other post "message #730008"), I have to implement most of the other interfaces (eg. IToc, ITopic, ...) to. This interfaces extend IUAElement which defines the method isEnabled(IEvaluationContext context). In my case it would be better if these method would be defined without the context as a paramter. In this way the implementing class could determine the enabled state by here own rules. In the case of the class org.eclipse.help.internal.UAElement you can use an IEvaluationContext, which is provide by the internals of the org.eclipse.help bundle.
What do you think about that proposal Chris? Would it lead to a better design? At least in my case the context is useless, because I can not define tests for my dynamic created elements in the plugin.xml and the enabled state is determined by other properties.
[Updated on: Thu, 29 September 2011 08:02] Report message to a moderator
|
|
|
|
| Re: How can I provide variables for property tests to create dynamic help content [message #735604 is a reply to message #730001] |
Wed, 12 October 2011 06:56  |
Riccardo Missing name Messages: 9 Registered: September 2011 |
Junior Member |
|
|
Hallo Chris,
I am not able to check the EvaluationContext since a expression is needed and the context only provides variables.
For this reason it would be better to define the isEnabled method in IUAElement without the parameter of the type IEvaluationContext in my opinion. Implementations of IUAElement of the eclipse.help bundles should than resolve the context internal by a call to helper method or something like that.
I know that this would be an API change which is not backward compatible, but for me it looks like a better approach with a cleaner interface.
|
|
|
Powered by
FUDForum. Page generated in 0.01807 seconds