Bug 52552 - [Contributions] IAction - accelerator does not toggle checked state
Summary: [Contributions] IAction - accelerator does not toggle checked state
Status: RESOLVED WORKSFORME
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P5 major (vote)
Target Milestone: ---   Edit
Assignee: Paul Webster CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2004-02-19 17:10 EST by Steven Walton CLA
Modified: 2008-07-17 13:01 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Steven Walton CLA 2004-02-19 17:10:25 EST
An IAction with style AS_CHECK_BOX does not toggle the checked state when the
accelerator keycode is entered.

Tried working around this by keeping track of the checked state myself but the
accelerator does not appear to call the run() or run(IAction) methods.  How does
the accelerator fire the action?
Comment 1 Chris McLaren CLA 2005-12-12 16:57:37 EST
Reassigning to Platform-UI-Inbox (I left IBM 18 months ago..)
Comment 2 Michael Van Meekeren CLA 2006-04-21 13:56:24 EDT
Moving Dougs bugs
Comment 3 Paul Webster CLA 2007-04-05 19:02:52 EDT
Assigning to component owner
PW
Comment 4 Remy Suen CLA 2008-07-16 15:19:04 EDT
Do you have some sample code to reproduce this? I'm having some trouble constructing a proper snippet myself.
Comment 5 Paul Webster CLA 2008-07-17 13:01:08 EDT
This code works either including the accelerator in the label or setting it on the action:

MenuManager file = new MenuManager("&File", "file");
manager.add(file);

Action a = new Action("&Hello\tCTRL+H", IAction.AS_CHECK_BOX) {
	public void runWithEvent(Event event) {
		System.out.println("runWithEvent: " + getText());
	}
};
// a.setAccelerator(SWT.CONTROL|'H');
file.add(a);

CTRL+H both calls the run method and updates the checked state.

PW