Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Re: Reuse of 3rd part plugins
Re: Reuse of 3rd part plugins [message #455764] Thu, 05 October 2006 13:33 Go to next message
Eclipse UserFriend
Well, I've done a litte step forward, but it still doesn't work...
I' ve understand where to put the plugins that I want to use (in the plugins directory of the <b>target eclipse</b>), but it seems it can't still find log4j, as you can see from a snapshot of the message shown by the view that should contain the log viewer:

java.lang.NoClassDefFoundError: org/apache/log4j/Logger
at org.nightlabs.log4j.LogView.<init>(LogView.java:44)
...

Where should I put this damned <i>log4j-1.2.13.jar</i> to make it work fine???

Please, be kind and patient with a newbie, I feel I'm close to the solution of my troubles, but I'm going slightly mad if you don't help me now...

I look forward to your reply.

Thank you all

Yours faithfully,
Andrea
Re: Reuse of 3rd part plugins [message #455766 is a reply to message #455764] Thu, 05 October 2006 14:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mbayly.telus.net

Hi Andrea

Have you read these usage instructions from the NightLabs site?

Usage
To install the plugin, simply copy the release file into the plugins directory of your Eclipse installation or RCP application. Note, that the Log4J Plugin needs access to the Log4J classes in its classpath. To provide this classes it has an optional dependency to org.apache.log4j. This means it will be resolved but not functional if this plugin is not installed. Alternatively to the org.apache.log4j plugin you can provide the Log4J classes by making an other bundle buddy of org.nightlabs.log4j that exports these classes. To do this add the following line to your MANIFEST.MF:

Eclipse-RegisterBuddy: org.nightlabs.log4j


If you're pretty new (like me) to Eclipse RCP, that might not mean a whole lot. I'm still trying to get my head around bundles and Eclipse class loading.

But I think it's essentially saying that the nightlabs bundle has a declared dependency on a bundle with name org.apache.log4j, so you need to provide a bundle(plug-in) with that name that contains the log4j classes. It's not enough to just have the log4j jar file. The classes in the log4j jar need to be deployed as a plugin.

I don't know if there is an existing org.apache.log4j plugin which bundles the log4j classes. If there isn't it's relatively easy to create one yourself. The PDE supports a number of ways of doing this (see the PDE new Project wizard - 'Plug-in from existing JAR archives').

An alternative to providing a plugin called org.apache.log4j is to just include the log4j jar files in another plug-in i.e. your.domain.plugin. Make sure your plugin exports the log4j packages in the Runtime > Exported Packages section of its manifest editor and also add the above Eclipse-RegisterBuddy declaration to the end of the MANIFEST.MF for your plugin.

Apparently, its not as efficient to include jars within plug-ins that are themselves deployed as jars but it should still work.

Either of these approaches should enable the NightLabs code to find the log4j code. In the spirit of pluggability the first one is probably the preferred method if you can work out how to wrap the jar as a plugin.

If you don't already have it, I highly recommend getting the Eclpse RCP book (McAffer/Lemieux). It has a whole chapter on these kinds of issues.

Let me know if you don't follow any of this. As I say, I'm still learning it myself, so might have made mistakes.
Martin
Re: Reuse of 3rd part plugins [message #455767 is a reply to message #455766] Thu, 05 October 2006 14:20 Go to previous messageGo to next message
Eclipse UserFriend
You can also read http://www.eclipsezone.com/articles/Eclipse2VM/, which uses Log4J as an example of buddy classloading.

Alex.
Re: Reuse of 3rd part plugins [message #455768 is a reply to message #455767] Thu, 05 October 2006 15:01 Go to previous messageGo to next message
Eclipse UserFriend
Thank you both Martin and Alex!
Martin: I had tried to export the package from my rcp, but it didn't worked... I've also tried to add that line to my manifest, but the problem remain...

It's unbeliveable, I've also added a plugin (the directory plugin <i>org.apache.jakarta_log4j_1.2.8v200607172048</i>) to my target platform's plugins directory, updated the classpath, exported the org.apache.log4j and I get still the same message...

Now I will try to follow also your hit, Alex (sooner or later I must exactly understand what it happens inside, after all!), hoping to find some answers...

If I'm really desperate, I'll post you my manifest.mf, buid.properties and plugin.xml, otherwise I will inform you about my mistake (there must be a mistake, of course...).

By now, thank you both very much for your precious help and hints!
Andrea
Re: Reuse of 3rd part plugins [message #455770 is a reply to message #455768] Thu, 05 October 2006 15:09 Go to previous messageGo to next message
Eclipse UserFriend
(...really interesting your article Alex...)

...

(when I've finished to read it I guess I'will solve my problems - in that case I owe you a good Italian pizza and beer... :) - let me finish to read...)
RCP application localization - HELP !! [message #455775 is a reply to message #455764] Thu, 05 October 2006 21:59 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: arshadm.pripetsoft.com.nospam

Hi,

I am sure this question has been asked many times but I could find no
definitive answer on Google so I am asking here in the hope that somebody
may be able to help.

The problem is simple enough I have an RCP application that I want to
support multiple languages. I know that what I need to create is a "fragment
plugin" that contains all localized content. But how is this plugin to be
structured.

There are two issues here, one is at my application level. Here I can
structure as I want because I am writing the classes that access the
resources (via java resource bundles).

How does this integrate with all the content in the plugin.xml though ? I
have many labels and names (for actions/menus, etc) in plugin.xml, which
property file is Eclipse going to use to resolve these. Is it internally
using the "nl/...." directory structure that things like the splash.bmp use.

In short I am trying to understand how the platform is going to pickup the
externalized strings in plugin.xml so that I can use the same mechanism for
all my external strings.

There are tutorials on Google, but they seem to start from the ground up by
using the base ResourceBundle functionality and the "Externalize Strings..."
support in Eclipse. The properties files and accessor classes this generates
don't seem to have anything to do with how the platform itself seems to do
things though !!!

Any help would be much appreciated?

Regards.
Re: RCP application localization - HELP !! [message #455790 is a reply to message #455775] Fri, 06 October 2006 07:09 Go to previous messageGo to next message
Eclipse UserFriend
Download the language packs and see e.g. the .properties files in the UI toolkits to see how it's done.

http://download.eclipse.org/eclipse/downloads/drops/L-3.2_La nguage_Packs-200607121700/index.php

I believe that they have fragments with files like 'plugin_de.properties' which then take precedence over the files in 'plugin.properties'.

Values defined in the plugin.properties file are used by e.g. the extension points e.g. <view class="my.view" name="%view.name">[/xml]. You'd then have 'view.name=My View' in plugin.properties (assuming a default of english) and 'view.name=Mijn View' for plugin_nl.properties (for NL=Dutch). Similary for plugin_de.properties etc.

If you want, you can have a fragment per language. Or, like Eclipse, you can dump all other languages into a single fragment (or a few fragments). Or, if you want, you can ship it with the main plugin.

Alex.
Re: RCP application localization - HELP !! [message #455800 is a reply to message #455790] Fri, 06 October 2006 09:57 Go to previous messageGo to next message
Eclipse UserFriend
YESSSSSSSSSS!!!!

I HAVE DONE IT (Italian does it better, you know...)

Jokes apart, thanks to Alex's article I've understand much more about eclipse plugins.
I've simply created a new plugin from the org.apache.log4j jar and set up the buddy...

Really really thank you all for your quick replies and your help.

I hope to be able to return the kindness one day, maybe when I'll be more experienced in RCP... :)

By now, sincerely thank you all folks!

Andrea
Re: RCP application localization - HELP !! [message #455814 is a reply to message #455790] Sat, 07 October 2006 02:02 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: arshadm.pripetsoft.com.nospam

Hi,

Thanks for that.

Just in case anyone else is interested in the same issues here is a summary
of what I understand so far.

1. The directory structure for the localized content should be probably be
something like the following:-

plugin.properties
plugin_fr.properties

nl/about.properties
nl/en/about.properties
nl/en/docs/index.html

nl/fr/about.properties
nl/fr/docs/index.html

The plugin.properties file though needs to use the old naming scheme
(i.e. plugin_fr.properties, etc) and that file need needs to sit at the root
level.

The plugin.xml external strings go in the plugin.properties files, all
other application external strings should go under the "nl/..." structure
(this is not required but lowers the initial memory footprint).

2. Now we have the structure how do we access it.
i. Our activator class is given the BundleContext when the plugin is
started. We can get access to the actual running "Bundle" from here.

ii. We can then use the FileLocator.find(Bundle,IPath,Map) function
to get access to one of these files. The IPath parameter should be something
like "$nl$/about.properties", etc.

Question:
Does anyone know how to set the application locale on installation? I
assume it currently picks that info up from the Java runtime. It would be
nice to let the user change it from within the application.

Regards.


"Alex Blewitt" <alex_blewitt@yahoo.com> wrote in message
news:31144732.1160133008612.JavaMail.root@cp1.javalobby.org...
> Download the language packs and see e.g. the .properties files in the UI
> toolkits to see how it's done.
>
> http://download.eclipse.org/eclipse/downloads/drops/L-3.2_La nguage_Packs-200607121700/index.php
>
> I believe that they have fragments with files like 'plugin_de.properties'
> which then take precedence over the files in 'plugin.properties'.
>
> Values defined in the plugin.properties file are used by e.g. the
> extension points e.g. <view class="my.view" name="%view.name">[/xml].
> You'd then have 'view.name=My View' in plugin.properties (assuming a
> default of english) and 'view.name=Mijn View' for plugin_nl.properties
> (for NL=Dutch). Similary for plugin_de.properties etc.
>
> If you want, you can have a fragment per language. Or, like Eclipse, you
> can dump all other languages into a single fragment (or a few fragments).
> Or, if you want, you can ship it with the main plugin.
>
> Alex.
Re: RCP application localization - HELP !! [message #455817 is a reply to message #455814] Sat, 07 October 2006 07:05 Go to previous messageGo to next message
Eclipse UserFriend
According to the help pages, on the eclipse runtime options, -nl will do what you need if you don't want to have the currently defined user default (i.e. Locale.getDefault())

-nl <locale> (OSGi)
equivalent to setting osgi.nl to <locale>

osgi.nl {-nl}
the name of the locale on which Eclipse platform will run. NL values should follow the standard Java locale naming conventions.

http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse. platform.doc.isv/reference/misc/runtime-options.html

So, you'd run it as eclipse -nl de if you wanted to launch Eclipse in German. You could do the same thing by putting the entries in the eclipse.ini file, too.

Alex.
Re: RCP application localization - HELP !! [message #458111 is a reply to message #455817] Tue, 14 November 2006 05:14 Go to previous messageGo to next message
Eclipse UserFriend
Hi Alex,

Is there any way to change the laguage dyanamically..like through some menu entry.


Regards
rohit
Re: RCP application localization - HELP !! [message #458114 is a reply to message #458111] Tue, 14 November 2006 06:22 Go to previous message
Eclipse UserFriend
Not as far as I know, no. You are probably better off bouncing the application. If you really need the end user to decide, then pop up a dialog during the startup phase asking what language to use, and then restart the platform with the new language setting.

Alex.
Previous Topic:Switching between perspectives in RCP
Next Topic:Wrong locale when using an embedded JRE
Goto Forum:
  


Current Time: Wed Jul 23 17:35:21 EDT 2025

Powered by FUDForum. Page generated in 0.06733 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top