confused how to add package resource bundles?

This topic has been viewed 4085 times and has 4 replies
Thread status: Active
Questions about extending features and developing plug-ins [img]http://www.sweethome3d.com/images/flags/en_small.gif[/img]
Post Reply New Topic
Alex42
Posts: 7
Joined: Thu Dec 22, 2011 10:27 am

how to add package resource bundles?

Post by Alex42 »

Hi,

what's the correct way to add a package resource (package.properties) bundle from inside a plugin to the UserPreferences in a way that a panel (defined inside the plugin) can access the bundle?

As far as I've seen the plugin's classloader is not registered and therefore not returned from UserPreferences#getResourceClassLoaders(). But adding it to this list does not solve the issue as the used class is FileUserPreferences and this owns a list of classloaders by its own which is initialized only inside updateSupportedLanguages() which is private and not called after all the plugins were loaded. :-(

If there's no way to register a plugin's classloader to resolve resources correctly the attached patch would solve the issue. (Hope that I'm able to attach a file as I do not see any way right now [:-/])

Regards,
Alex
Alex42
Posts: 7
Joined: Thu Dec 22, 2011 10:27 am

Re: how to add package resource bundles?

Post by Alex42 »

Sorry but haven't found a way to attach a file to my post.
Alex
User avatar
Puybaret
Posts: 9440
Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:

Re: how to add package resource bundles?

Post by Puybaret »

What about using the getPluginClassLoader method?
Emmanuel Puybaret, Sweet Home 3D creator
Alex42
Posts: 7
Joined: Thu Dec 22, 2011 10:27 am

Re: how to add package resource bundles?

Post by Alex42 »

I've seen it but then I can't use SwingTools#getLocalizedLabelText(). If you're aware of this it's ok for me but I would prefer to handle resources in the same way all over the application.

Regards,
Alex
User avatar
Puybaret
Posts: 9440
Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:

Re: how to add package resource bundles?

Post by Puybaret »

That wouldn't work in the current implementation.
Plug-in class loaders and language libraries class loaders are different and not handled at the same place.
Emmanuel Puybaret, Sweet Home 3D creator
Post Reply New Topic

Who is online

Users browsing this forum: No registered users and 1 guest