Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-core-dev] Question about initializing the new message catalogs

Makes sense, thanks.




Thomas Watson <tjwatson@xxxxxxxxxx> 
Sent by: platform-core-dev-admin@xxxxxxxxxxx
02/23/2005 10:05 AM
Please respond to
platform-core-dev


To
platform-core-dev@xxxxxxxxxxx
cc

Subject
Re: [platform-core-dev] Question about initializing the new message 
catalogs








> In the snippets given for initializing the Messages class, it calls a 
> class in the OSGi layer, passing the message bundle name and the 
Messages 
> class object, where these are in some higher-level plug-in.
> 
> import org.eclipse.osgi.util.NLS;
> ...
> private static final String BUNDLE_NAME = 
> "org.eclipse.core.utils.messages"; //$NON-NLS-1$
> static {
>    NLS.initializeMessages(BUNDLE_NAME, Messages.class);
> }
> 
> 
> How does the NLS class resolve the message bundle?  In traditional 
eclipse 
> plug-in visibility rules, lower-level plug-ins can't see classes or 
> resources from higher-level plug-ins.
> Is this using the 'Import-Package: *' capability of OSGi?  I didn't see 
> this in org.ecillpse.osgi's manifests.
> 
> Just curious as to how this works,
> Nick
> 

We use the classloader of the class object which is passed into 
initializeMessages 
to find the resource properties files.  This allows us to load the 
resources 
of higher-level plug-ins. 

FYI, the system bundle (org.eclipse.osgi) cannot import any packages 
because 
it provides the delegation model for all the other bundles.  The 
classloader 
of the framework is a "normal" classloader that has no knowledge of the 
OSGi 
classloader delegation model.  This means it cannot load any classes from 
an imported package or from a required bundle. 

Tom 



Back to the top