Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Platform - User Assistance (UA) » How can I provide variables for property tests to create dynamic help content
How can I provide variables for property tests to create dynamic help content [message #730001] Tue, 27 September 2011 12:58 Go to next message
Riccardo Missing name is currently offline Riccardo Missing nameFriend
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 #730670 is a reply to message #730001] Wed, 28 September 2011 20:26 Go to previous messageGo to next message
Chris Goldthorpe is currently offline Chris GoldthorpeFriend
Messages: 815
Registered: July 2009
Senior Member
The help system does indeed use org.eclipse.core.expressions to evaluate the filter expressions, and the extension point org.eclipse.core.expressions.propertyTesters can be used to add more kinds of tests. I'm not familiar with where the variables platform and workbench come from - they are not defined by the help system but I can't tell exactly where they are defined.
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 11:54 Go to previous messageGo to next message
Riccardo Missing name is currently offline Riccardo Missing nameFriend
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 12:02]

Report message to a moderator

Re: How can I provide variables for property tests to create dynamic help content [message #733428 is a reply to message #730858] Tue, 04 October 2011 17:47 Go to previous messageGo to next message
Chris Goldthorpe is currently offline Chris GoldthorpeFriend
Messages: 815
Registered: July 2009
Senior Member
Adding an extension point to allow the addition of more variables sounds like an interesting idea but it is unlikely that we could implement that for Eclipse 3.8 given our current priorities and staffing levels.

In your case since you have control over the isEnabled() method the best solution might be to check the EvaluationContext ( so that the standard filters will work ) and in addition add your own test for enablement. Your isEnabled() methods do not need to use only tests based the IEvaluationContext parameter - they can contain whatever logic you want.
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 10:56 Go to previous message
Riccardo Missing name is currently offline Riccardo Missing nameFriend
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.
Previous Topic:Old welcome.page is displayed when using ActionFactory.INTRO.create(window)
Next Topic:Usage of AbstractContentExtensionProvider and IHelpContentProducer together
Goto Forum:
  


Current Time: Tue Mar 19 02:03:38 GMT 2024

Powered by FUDForum. Page generated in 0.04003 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top