Important upcoming change in toolitem-enablement check [message #1387984] |
Wed, 25 June 2014 17:49  |
Eclipse User |
|
|
|
Hi,
I'm currently working on a revised enablement check story for ToolItems
- until today there was a Thread running with 400ms pulse who was call
@CanExecute all time - it worked the same way it did in Kepler upstream.
This behavior changed in Kepler and the system only does the check in
very certain situations e.g. when the active part changes, ... - but it
does not track other context variables.
Developers have to call
eventBroker.send(
UIEvents.REQUEST_ENABLEMENT_UPDATE_TOPIC,
UIEvents.ALL_ELEMENT_ID);
I think this is a bit cumbersome but anyways that's the situation if you
write SWT-e4 applications.
I'm currently evaluating different stories on how to improve the
situation in e4+JavaFX:
a) if you publish information into the context using
- @ContextValue
- ScopedObjectFactory
we will reevaluate all ToolItems
=> Disadvantage: If someone publishes information through the
IEclipseContext directly (something i always said is a bad idea!)
we miss them!
=> active context / active selection will always lead to a
reevaluation!
b) an alternate way would be to hook the IEclipseContext to track what
values are accessed when an @CanExecute is called
(IEclipseContext-RAT unfortunately does not do that!)
c) one specifies which context keys should be tracked using RAT
If you still want to have the loop enable check we'll provide you a
possibility to turn that on in addition to one of the above solutions by
starting with a special product-extension-property switch.
Tom
|
|
|
|
|
|
|
|
Re: Important upcoming change in toolitem-enablement check [message #1400901 is a reply to message #1400712] |
Mon, 14 July 2014 18:05   |
Eclipse User |
|
|
|
Hi,
The enable/disable stuff is not implemented by the *ItemRenderer but in
the container like ToolBarRenderer, MenuRenderer, ... .
As you noted we are currently don't reapply enablement once a Menu is
shown which sounds like a over simplification - because of performance
gains - but I think we can / need to fix this in the default
implementation so I filed
https://bugs.eclipse.org/bugs/show_bug.cgi?id=439572 and as a first step
extracted the generic part from the ToolBarRenderer.
Tom
On 14.07.14 18:03, Uwe San wrote:
> Hi Tom,
>
> in my use case, clicking a ToolItem will open a popup menu with two menu
> items. Unlike in the default case, the menu stays visible when an item
> was clicked. This requires an enablement check for all menu items after
> every click on an item, not only once after the menu is shown. Is there
> a way to achieve this in a custom MenuItemRenderer class? I could not
> find a straightforward way to change the default action callbacks.
>
> Thanks,
> Uwe
|
|
|
|
Powered by
FUDForum. Page generated in 0.07182 seconds