Bug 508832 - CanExecute not evaluated for rendering of MDirectMenuItems
Summary: CanExecute not evaluated for rendering of MDirectMenuItems
Status: REOPENED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.7   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: bugday
Depends on:
Blocks:
 
Reported: 2016-12-07 09:30 EST by Lars Vogel CLA
Modified: 2020-11-16 11:10 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lars Vogel CLA 2016-12-07 09:30:38 EST
For direct menu items in a handler:

@CanExecute
	public boolean test(@Optional @Named("EXIT_CONDITIION") String s) {
		if (s == null) {
			return false;
		}
		return true;
	}


In a part:

	button.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				ctx.set("EXIT_CONDITIION", "true");
				todoService.getTodos(viewer::setInput);
			}
		});

Setting the value in the context does not trigger CanExecute evaluation.

See also Bug 465893, Bug 377884 and Bug 428793.
Comment 1 Eclipse Genie CLA 2020-01-28 06:46:42 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 2 Lars Vogel CLA 2020-11-12 05:51:58 EST
I still don't see that working
Comment 3 Lars Vogel CLA 2020-11-12 05:52:57 EST
Rolf, I have the vague memory that you fixed that. But I see it again in 4.18.
Comment 4 Rolf Theunissen CLA 2020-11-15 09:37:04 EST
I have worked on enable checks, but that was related to (parameterized) opaque items.

Also according to Bug 377884 this should be evaluated, no testcases available. There most be some regression or corner case, the method to look at is: MenuManagerRendererFilter#updateElementVisibility

Note that the @CanExecute for menu items is only evaluated on showing of the menu, not when the context is set. Do you see the problem for a pop-up menu or for (a child of) the main menu?
Comment 5 Lars Vogel CLA 2020-11-16 11:10:35 EST
(In reply to Rolf Theunissen from comment #4)

> Also according to Bug 377884 this should be evaluated, no testcases
> available. There most be some regression or corner case, the method to look
> at is: MenuManagerRendererFilter#updateElementVisibility
> 
> Note that the @CanExecute for menu items is only evaluated on showing of the
> menu, not when the context is set. Do you see the problem for a pop-up menu
> or for (a child of) the main menu?

Thanks for the answer. It was for a "normal" direct menu item contributed to the IDE. I try to recreate and add as attachment to the bug.