You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When creating a message bundle using the "Externalize strings wizard", the java class is initialized with a BUNDLE_NAME variable which contains the fully-qualified name of the message properties file, like:
private static final String BUNDLE_NAME = NlsDemoMsg.class.getPackageName() + ".nlsdemomsg"; //$NON-NLS-1$
In this case, it would resolve to com.example.jdt.nls.msg.nlsdemomsg which indeed resolves to a file called nlsdemomsg.properties in the com.example.jdt.nls.msg package.
Problem
When using any messages from a class created in this way, hovering over the message does not show the contents, and you are not able to quickly goto it in the properties file:
I am assuming this is PDE's version of the wizard since it uses org.eclipse.osgi.util.NLS instead of ResourceBundle, but the plain-old Java version does the same thing, using Messages.getString("key") instead. The hover and goto only work if the BUNDLE_NAME is a constant string.
Workaround
If the BUNDLE_NAME is changed to be just the string itself, like
private static final String BUNDLE_NAME = "com.example.jdt.nls.msg.nlsdemomsg"; //$NON-NLS-1$
then those things work:
Expected
Ideally these features would work in all cases, especially as the wizard that makes this file does it the first way by calling getPackageName().
The text was updated successfully, but these errors were encountered:
Introduction
When creating a message bundle using the "Externalize strings wizard", the java class is initialized with a
BUNDLE_NAME
variable which contains the fully-qualified name of the message properties file, like:private static final String BUNDLE_NAME = NlsDemoMsg.class.getPackageName() + ".nlsdemomsg"; //$NON-NLS-1$
In this case, it would resolve to
com.example.jdt.nls.msg.nlsdemomsg
which indeed resolves to a file callednlsdemomsg.properties
in thecom.example.jdt.nls.msg
package.Problem
When using any messages from a class created in this way, hovering over the message does not show the contents, and you are not able to quickly goto it in the properties file:
I am assuming this is PDE's version of the wizard since it uses
org.eclipse.osgi.util.NLS
instead ofResourceBundle
, but the plain-old Java version does the same thing, usingMessages.getString("key")
instead. The hover and goto only work if theBUNDLE_NAME
is a constant string.Workaround
If the
BUNDLE_NAME
is changed to be just the string itself, likeprivate static final String BUNDLE_NAME = "com.example.jdt.nls.msg.nlsdemomsg"; //$NON-NLS-1$
then those things work:
Expected
Ideally these features would work in all cases, especially as the wizard that makes this file does it the first way by calling
getPackageName()
.The text was updated successfully, but these errors were encountered: