Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 315328 - HandledMenuItems should respond to enabled state
Summary: HandledMenuItems should respond to enabled state
Status: RESOLVED FIXED
Alias: None
Product: e4
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 1.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 1.0 RC0   Edit
Assignee: Paul Webster CLA
QA Contact: Paul Webster CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-01 20:45 EDT by Paul Webster CLA
Modified: 2010-06-21 13:32 EDT (History)
3 users (show)

See Also:


Attachments
Enabled Menu Items v02 (2.25 KB, patch)
2010-06-01 20:45 EDT, Paul Webster CLA
no flags Details | Diff
Enabled Menu Items v03 (3.70 KB, patch)
2010-06-01 21:06 EDT, Paul Webster CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Webster CLA 2010-06-01 20:45:43 EDT
Created attachment 170728 [details]
Enabled Menu Items v02

My HandledMenuItem should query the command to see if it is disabled or enabled.

The attachment only works on createGui(*), it won't respond to changes.

PW
Comment 1 Paul Webster CLA 2010-06-01 21:06:10 EDT
Created attachment 170731 [details]
Enabled Menu Items v03

This creates a run and track that keeps the widget up to date.

PW
Comment 2 Paul Webster CLA 2010-06-01 21:08:18 EDT
(In reply to comment #1)
> Created an attachment (id=170731) [details]
> Enabled Menu Items v03


Released to HEAD >20100601

The alternate to this would be if MenuItems were managed more in conjunction with their SWT Menu parent and SWT.Show and SWT.Hide.

no one is looking at this AFAIK.

PW
Comment 3 Paul Webster CLA 2010-06-02 08:05:57 EDT
Oleg, I've created a RunAndTrack that has code that looks like:

public boolean changed(IEclipseContext context) {
EHandlerService service = lclContext
		.get(EHandlerService.class);
ParameterizedCommand cmd = item.getWbCommand();
if (cmd == null) {
	cmd = generateParameterizedCommand(item, lclContext);
}
if (cmd == null) {
	return false;
}
item.setEnabled(service.canExecute(cmd));
}

The service.canExecute(*) will use lclContext to find the appropriate handler.  With the changes you made will this be updated when a context activeChild changes and a new handler is selected?

PW
Comment 4 Eric Moffatt CLA 2010-06-02 09:09:57 EDT
Committed in >20100602. Allied a clone of the patch to the ToolItemRenderer.
Comment 5 Paul Webster CLA 2010-06-21 13:32:02 EDT
Released to RC0