Bug 55382 - setAccelerator(-1) on MenuItem shows error on Linux
Summary: setAccelerator(-1) on MenuItem shows error on Linux
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.0   Edit
Hardware: PC Linux-GTK
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Steve Northover CLA
QA Contact:
URL:
Whiteboard:
Keywords: api
Depends on:
Blocks:
 
Reported: 2004-03-19 11:03 EST by Benjamin Pasero CLA
Modified: 2005-04-25 10:26 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 Benjamin Pasero CLA 2004-03-19 11:03:49 EST
Hi,

I am adding and removing Accelerators to MenuItems. To remove an
accelerator
I call "menuItem.setAccelerator(-1)". This works on Windows, but on Linux
I am getting GTK Errors telling me that an error has occured while setting
the accelerators.

Here is the error message that appears in the console on my Suse Linux 9.0:
(<unknown>:1968): Gtk-CRITICAL **: file gtkaccelgroup.c: line 497
(gtk_accel_group_connect): assertion `accel_key > 0' failed

Ben
Comment 1 Benjamin Pasero CLA 2004-03-19 12:04:07 EST
Forgott to tell: I am using Suse Linux 9 with SWT 3.0 M7.
Comment 2 Benjamin Pasero CLA 2004-03-19 12:30:37 EST
It would be very usefull if MenuItem had a method "removeAccelerator" 
or "destroyAccelerator" or a notice how to remove the accelerator in the 
JavaDoc comment of "setAccelerator".
Comment 3 Grant Gayed CLA 2004-03-22 14:28:06 EST
Moving to SN because I don't see a documented way to remove an accelerator.  
This needs either new api or additional documentation on setAccelerator (and 
implementation on at least gtk of course).
Comment 4 Silenio Quarti CLA 2004-05-22 02:27:07 EDT
To remove accelerator call setAccelarator(0). We should document this and may 
throw exception if value is negative.
Comment 5 Steve Northover CLA 2004-05-25 10:41:32 EDT
SSQ, don't throw an exception.  Just fail silently (no accelerator will be 
fired because -1 does not match any accelerator patter).  I believe that this 
is what we do on the other platforms.  GTK treats the value as signed but the 
others do not.  Make sure that we are consistent across platforms.  Thanks.
Comment 6 Benjamin Pasero CLA 2005-03-25 08:30:55 EST
MenuItem#setAccelerator() not yet mentioning in JavaDoc how to remove an
accelerator.

Ben
Comment 7 Benjamin Pasero CLA 2005-04-23 18:05:40 EDT
Still an issue in latest Integration Build. Easy to fix with updating JavaDoc
though :)
Comment 8 Silenio Quarti CLA 2005-04-25 10:26:43 EDT
Fixed > 20050425.

JavaDoc was changed to mention that zero is the default value (and indicates 
that the menu item does not have an accelarator). GTK warnings have been fixed 
as well.