Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-ui-dev] Adding "visibleWhen" Expression to every UI Element

Hello,
for enhancement https://bugs.eclipse.org/bugs/show_bug.cgi?id=201052, I want to add the expression "visibleWhen", with a property tester, to every "basic" UI element ("basic" should stand for Views, Editors, and similar things).
An example XML code:
  <visibleWhen>
     <test
          property="org.eclipse.rcpauth.expressions.rightsProperty"
          args="read"/>
  </visibleWhen>
I know there were already similar thoughts about this earlier, but they weren't realized. I had the impression it was a "nice to have feature" which hasn't enough people which needed it, so it was never done.

Now, I want to implement it, for the enhancement I mentioned above.

But I have a question: while it's quite easy to implement it, once you learned how the code in "org.eclipse.ui.internal.registry", "org.eclipse.ui.internal", "org.eclipse.ui", etc. works together, I have too much possibilities where I can implement my solution. The commands (ext.-point "org.eclipse.ui.commands"), have already the ability to process Expressions, i.e. to process them in all XML declarations which use their command declarations (via "commmandId"). Menus do this, for example. But views, editors and such things are another case: they are not commands, neither in their actual implementation nor in their abstract logic. So I implemented the logic to read and bind the visibleWhen Expression to a View, in the "org.eclipse.ui.internal.registry.ViewRegistryReader#readElement", and store the Expression in the "ViewDescriptor". While the logic to read and store the Expressions for _commands_ is handled in "org.eclipse.ui.workbench.HandlerPersistence#read" (and stored in a global list). Although my solution works very good, I'm not sure what fits better to Eclipses (original?) Expressions concept: Should the basic Expressions handling all be done in HandlerPersistence, or locale, in the Registry-Readers of the UI elements itself?

Or should there be a new standalone class and registry for all Expressions?


Thanks for any answers,
Jan Diederich

--
BREDEX GmbH
Mauernstr. 33
38100 Braunschweig

Tel.: +49-531-24330-0
Fax:  +49-531-24330-99
http: www.bredex.de

Geschäftsführer: Hans-J. Brede, Achim Lörke, Ulrich Obst
Amtsgericht Braunschweig HRB 2450


Back to the top