Community
Participate
Working Groups
R3.3 and I20070529-0010. Links.setText(String) claims it allows mnemonics. I added one into the normal text and I also tried to put one into the link text (i.e. between <a> and </a>) but they are only rendered in the UI but not usable i.e. neither is the link opened nor the widget is getting focus. Another issue is that the underscore (_) of the mnemonic is always rendered and not just when being activated via 'Alt' key. Test Case: 1. go to Package Explorer 2. view menu > Top Level Elements > Working Sets 3. select a folder 4. context menu > Assign Working Sets...
*** Bug 276621 has been marked as a duplicate of this bug. ***
Created attachment 147129 [details] Fix If you add a TraverseListener to the Link control, the 'doit' field also doesn't get set to true if the key matches the mnemonic character. Here's a simple fix (first method copied from Label).
IMO, the code in Label doesn't make sense for Link. A link is in the format: (atext link)* ptext? for example: "&some text <a>a link</a> some text at the end" In this case: atext = &some text link = a link ptext = some text at the end (atext link)* can repeat zero or more ptext? can repeat zero or one mnemonics in link and ptext are ignored. when the mnemonic in the ith atext is hit, the ith link should receive focus.
Created attachment 147377 [details] patch
Hi Markus, I released the patch in comment 4 which implements the behaviour described in comment 3. Let me know if that is useful to you. Fixed in HEAD > 20090921
> Hi Markus, I released the patch in comment 4 which implements the behaviour > described in comment 3. Let me know if that is useful to you. That's also fine for me, thx.
Verified in I20091027-0100: mnemonics inside the link are now ignored. I would still like to see the Javadoc of Link.setText(String) be more clear about this. Of course one can infer that a link does not have a mnemonic but a small additional comment would clarify this.
Adding this: * <p> * Mnemonics are indicated by an '&' that causes the next * character to be the mnemonic. The receiver can have a * mnemonic in the text preceding each link. When the user presses a * key sequence that matches the mnemonic, focus is assigned * to the link that follows the text. Mnemonics in links and in * the trailing text are ignored. On most platforms, * the mnemonic appears underlined but may be emphasised in a * platform specific manner. The mnemonic indicator character * '&' can be escaped by doubling it in the string, causing * a single '&' to be displayed. * </p>
Perfect! :-)