Community
Participate
Working Groups
Running on OS 10.4 .. not sure if it's a problem on other platforms. Steps to reproduce: 1) Create a new Change Set with an ampersand in the name .. i.e. Gags & Games 2) Right click on another file, select "Add To", the change set shows up as "Gags Games"
Seems to be Mac specific. Not for 3.1.
No, same on GTK.
Created attachment 66027 [details] Fix by escaping "&", "@", and tab properly This happens because the change set title is used directly as the action text for the menu item, and "&" in action text is interpreted specially as a mnemonic. The "&" needs to be escaped so it appears literally. Same with "@" and tab characters for accelerators. The attached patch fixes the bug by escaping the characters properly for use in action text.
I got a StringIndexOutOfBoundsException when I tried the patch with a change set name "New & Set". It happens because the "indexOf('&') at the end of the loop doesn't take into consideration the last index of &. Also, the code to handle accelerators doesn't make any sense to me (i.e. \t and @).
Created attachment 66230 [details] Fix by escaping "&", "@", and tab properly; SIOOBE fixed (In reply to comment #4) > I got a StringIndexOutOfBoundsException when I tried the patch with a change > set name "New & Set". It happens because the "indexOf('&') at the end of the > loop doesn't take into consideration the last index of &. Oops. The new attachment fixes that. > Also, the code to > handle accelerators doesn't make any sense to me (i.e. \t and @). I was following the remarks about accelerators in the javadoc for org.eclipse.jface.action.Action#setText . However, in my testing with HEAD, Eclipse doesn't seem to work as documented: everything after the *first* tab appears right-aligned in the menu as if it's the accelerator. I don't have time to investigate this now.
Since the bug only mentioned @ and I'm not convinced that the tab and @ handling is correct, I have removed the tab and @ code and restricted the patch to address &. We can reevaluate later if tab or @ handling is required. Patch reviewed and released.
org.eclipse.team.internal.ui.synchronize.actions.ChangeSetActionGroup.AddToChangeSetAction appears to be a copy-and-paste duplicate of ChangeSetActionProvider.AddToChangeSetAction . I don't know if it's used for anything, but if so, it might need the same fix.
I entered bug 187393 for the analogous problem with "@" and tab.
I meant bug 187939; sorry for the thinko.
Verified in I20070522-0010