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

Bug 248370

Summary: [nls tooling] Bug in NLS in finding the appropriate bundle
Product: [Eclipse Project] JDT Reporter: Rob Stryker <stryker>
Component: TextAssignee: JDT-Text-Inbox <jdt-text-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P5 CC: daniel_megert, sflaniga
Version: 3.4Keywords: helpwanted
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: stalebug

Description Rob Stryker CLA 2008-09-23 23:22:51 EDT
Deep in NLSHintHelper:

private String getBundleName(Expression initializer) {
	if (initializer instanceof StringLiteral)
		return ((StringLiteral)initializer).getLiteralValue();
	if (initializer instanceof MethodInvocation) {
		MethodInvocation methInvocation= (MethodInvocation)initializer;
		Expression exp= methInvocation.getExpression();
		if ((exp != null) && (exp instanceof TypeLiteral)) {
			SimpleType simple= (SimpleType)((TypeLiteral) exp).getType();
			ITypeBinding typeBinding= simple.resolveBinding();
			if (typeBinding != null)
				return typeBinding.getQualifiedName();
		}
	}
	return null;	
}

This method has only two if statements,  if it's a StringLiteral or a MethodInvocation. This method does *not* take into account if it is an "InfixExpression". 

Specifically, my NLS method looks as follows:

	static {
	    NLS.initializeMessages(JMXUIActivator.PLUGIN_ID + ".Messages", //$NON-NLS-1$
	                    Messages.class);
	}

Clearly this SHOULD work, as it should just resolve to a string... but the method makes no account for it.
Comment 1 Rob Stryker CLA 2008-09-23 23:38:46 EDT
Specifically, the action 'find broken externalized strings' is whats failing here. 
Comment 2 Jerome Lanneluc CLA 2008-09-24 04:05:43 EDT
Moving to JDT/UI
Comment 3 Dani Megert CLA 2008-09-29 12:28:03 EDT
To support infix expressions many changes are needed:
- externalize wizard
- find broken strings operation
- nls hover
- nls hyperlink

This is not something we will do without help.
Comment 4 Eclipse Genie CLA 2020-04-07 14:35:51 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.