I want to write an eclipse plugin to show the actual value of the message code. The values are to be loaded from the given resource bundle. Only classes of the resource bundle will be available. So I require to load the resource bundle class which is declared in the current file. These class files will be in the classes folder or in a jar file in the lib folder. Is there any way to load the classes dynamically from the eclipse plugin? Thanks in advance
Hi,
Have a look at the Bundle class. There is the following method:
public Class loadClass(String name) throws ClassNotFoundException;
To get the bundle from your plugin:
Activator.getDefault().getBundle()
Hope this help
Manu
An Example how to get a externalized string from a message.properties file
private static final String BUNDLE_NAME = "de.stackoverflow.package.messages"; //$NON-NLS-1$
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
RESOURCE_BUNDLE.getString(key);
Every plugin does have a bundle object where you can load the files of a plugin. The Bundle object should contain every information you want to use.
HI Markus, Thank you for answering my question. I will explain my question further. I have a java project which contains ListResourceBundle objects. The source code is not available.
We used to take the value of a key with the following command. ListResourceBundle ResourceBundle stats = ResourceBundle.getBundle("com.org.MessageBundle");
stats.getString("name");// This is how we take the values
I want to show the actual value of the key, 'name' as a tool tip, on hovering the mouse pointer over it. I a trying to develop an eclipse plugin for that.
The main problem I faces now is, I cannot load the class files of a user project from the eclipse plugin.
Is there any way to do that?
Thanks in advance.