Bug 20412 - TVT2: Mnemonic characters displayed in error message
Summary: TVT2: Mnemonic characters displayed in error message
Status: RESOLVED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.0.1   Edit
Assignee: Wassim Melhem CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-06-15 13:58 EDT by Richard Bone CLA
Modified: 2002-08-09 09:57 EDT (History)
3 users (show)

See Also:


Attachments
Mnemonic in error message (46.70 KB, image/jpeg)
2002-06-15 13:59 EDT, Richard Bone CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Bone CLA 2002-06-15 13:58:43 EDT
Description: 
From the main Workbench panel, open or switch to the Resource perspective. In 
the Navigator view, expand a project and select plugin.xml. Double click the 
plugin.xml resource to open the manifest editor. On the lower tabs, click on 
Extensions, then click on the Add... button. Select Extension Templates in the 
left pane and New File Wizard in the right pane. Then click on Next. 'New 
Wizard Options' page opens.
Delete an item from any field, then error message is displayed 
on top. This error message picks up an item name as a variable,
but it is also used for the field label, which has mnemonic characters
for DBCS languages.
Please refer the image attached.
Comment 1 Richard Bone CLA 2002-06-15 13:59:19 EDT
Created attachment 1430 [details]
Mnemonic in error message
Comment 2 Richard Bone CLA 2002-06-15 14:01:04 EDT
This bug was opened in response to TPRS ID=105
Comment 3 Dejan Glozic CLA 2002-08-07 16:50:15 EDT
PDE reuses the option label for inclusion in the error messages by stripping 
the mnemonic character as follows:

	public String getMessageLabel() {
		String label = getLabel();
		StringBuffer buf = new StringBuffer();
		for (int i = 0; i < label.length(); i++) {
			char c = label.charAt(i);
			if (c != '&' && c != ':')
				buf.append(c);
		}
		return buf.toString();
	}

Richard, do you know why this does not work for DBCS languages?
Comment 4 Richard Bone CLA 2002-08-08 09:12:54 EDT
Dejan,

I don't see anything in that code that should be incompatible with DBCS 
characters.  I thought there could have been a problem with the charAt 
function, but it appears that it should work for DBCS languages.  
Comment 5 Richard Bone CLA 2002-08-08 16:53:58 EDT
I've verified it on the 730 integration build on a japanese machine.  Do you 
think getMessageLabel is even being called?  I see a japanese string followed 
by (&N) over here...
Comment 6 Richard Bone CLA 2002-08-08 17:35:15 EDT
please disregard my last comment...  i was relying on my expert knowledge of 
japanese to guide me through replicating the bug again. :-)  problem is, i 
wound up finding an unrelated (although similar looking) problem...

Comment 7 Dejan Glozic CLA 2002-08-08 19:47:51 EDT
The problem is caused by the way mnemonics are specified on DBCS locales. On 
SBCS locales, mnemonics are specified by simply placing '&' in front of the 
mnemonic character in the label:

Some &Label:

The code above works well with this (result is "Some Label").

On DBCS locales, labels use DBCS characters that are not suitable for 
mnemonics. For that reason, translated labels follow the following convention:

Some Label in DBCS (&L):

The result when applying the code above is "Some Label in DBCS (L)"

The fix that works well is to also look for DBCS mnemonic sequence "(&" and 
truncate the label at that point. Using that extra check, the result is
"Some Label in DBCS ". Tested and verified on Japanese locale.
Comment 8 Wassim Melhem CLA 2002-08-09 09:57:16 EDT
The fix is in HEAD.