Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 226988

Summary: [KeyBindings] regex content assist tooltip has wrong key format for Mac OSX
Product: [Eclipse Project] Platform Reporter: Sanjay Patel <sanjay3000>
Component: UIAssignee: Markus Keller <markus.kell.r>
Status: VERIFIED FIXED QA Contact: Paul Webster <pwebster>
Severity: normal    
Priority: P3 CC: markus.kell.r
Version: 3.4   
Target Milestone: 3.6 M7   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Bug Depends on: 274690    
Bug Blocks:    
Attachments:
Description Flags
Fix attempt (needs bug 274690) none

Description Sanjay Patel CLA 2008-04-14 14:40:23 EDT
Build ID: M20071023-1652

Steps To Reproduce:
1. Go to "Edit" menu and then open the "Find/Replace" dialog.
2. Select the "Regular expressions" checkbox.
3. After the Content Assistance light-bulb icon appears to the left of the text input widget, hover over it.
4. A tooltip appears that says: "Content Assist Available (^.)"

The key combination is wrong - it should be "Ctrl-Space" as shown on Windows and Linux.

A little debugging shows that org.eclipse.jface.bindings.keys.formatting.NativeKeyFormatter has a special case for Carbon:

	public final String format(final int key) {
		final IKeyLookup lookup = KeyLookupFactory.getDefault();
		final String name = lookup.formalNameLookup(key);

		// TODO consider platform-specific resource bundles
		if ("carbon".equals(SWT.getPlatform())) { //$NON-NLS-1$    	
			String formattedName = (String) CARBON_KEY_LOOK_UP.get(name);
			if (formattedName != null) {
				return formattedName;
			}
		}

		return super.format(key);
	}
 

The CARBON_KEY_LOOKUP is returning the bogus string.

More information:
Comment 1 Eric Moffatt CLA 2008-04-15 13:23:14 EDT
Kim, I'll pass this to you, re-direct if necessary.
Comment 2 Markus Keller CLA 2009-05-01 14:33:23 EDT
The custom space character is debatable.

If you go to 'System Preferences > Keyboard & Mouse > Keyboard Shortcuts'
and add a shortcut for 'About Finder' with keys Command+Shift+Space, then the table renders the space as 'Space' but the menu in the Finder renders it with the ugly underscore.

The Apple Human Interface Guidelines also use 'Space' in their shortcuts lists, and even iTunes overrides the default rendering: 'Controls > Play/Pause' uses 'space'.

Since the ugly underscore only causes confusion, we should just use the default rendering from AbstractKeyFormatter.properties ('Space'). 
Comment 3 Markus Keller CLA 2009-05-01 15:50:00 EDT
I tried to fix this, but the fix didn't work on Cocoa, probably due to bug 274690.
Comment 4 Markus Keller CLA 2009-05-01 15:53:29 EDT
Created attachment 134110 [details]
Fix attempt (needs bug 274690)
Comment 5 Paul Webster CLA 2009-05-04 09:03:16 EDT
Should we look at getting this into RC1?

PW
Comment 6 Markus Keller CLA 2009-05-04 12:21:01 EDT
> Should we look at getting this into RC1?

No, unless bug 274690 gets fixed and my patch turns out to work fine then. We've had the current rendering style since the beginning, and it's not fundamentally wrong.

I was hoping for a quick fix, but since it didn't work, I wouldn't invest too much for 3.5.
Comment 7 Markus Keller CLA 2010-04-23 16:28:56 EDT
Fixed in HEAD.
Comment 8 Markus Keller CLA 2010-04-30 10:30:40 EDT
Verified in I20100429-1549 Cocoa and Carbon.