|
Re: register image. problem [message #108196 is a reply to message #108071] |
Mon, 06 October 2008 16:19 |
Eclipse User |
|
|
|
Originally posted by: rherrmann.innoopract.com
could you be more specific about what exactly doesn't work?
Eugenio Abello wrote:
> I register image in RCP, of this form
>
> public class Activator extends AbstractUIPlugin {
> public static final String ID = "rcp.eclipse";
> public static final String MY_IMAGE_ID =
> "image.myimage";
>
> @Override
> protected void initializeImageRegistry(ImageRegistry registry) {
> super.initializeImageRegistry(registry);
> Bundle bundle = Platform.getBundle(ID);
>
> ImageDescriptor myImage = ImageDescriptor.createFromURL(
> FileLocator.find(bundle,
> new Path("icons/myImage..gif"),
> null));
> registry.put(MY_IMAGE_ID, myImage);
> }
> }
>
>
> follow this recommendation
> http://richclientplatform.blogspot.com/2007/05/plugin-your-i mages.html
>
> work OK in RCP, but RAP no .............???
>
|
|
|
|
|
Re: register image. problem [message #108269 is a reply to message #108232] |
Mon, 06 October 2008 17:55 |
Eclipse User |
|
|
|
Originally posted by: rherrmann.innoopract.com
I built a demo along your code fragments and it works.
Are you sure the "icons/myImage..gif" exist (two dots?!?!)
Eugenio Abello wrote:
>
> When I try to use, the image does not return.
>
> Image myImage =Activator.getImage(ClientPlugin.MY_IMAGE_ID);
>
> public class Activator extends AbstractUIPlugin {
> public static final String ID = "rcp.eclipse";
> public static final String MY_IMAGE_ID
> = "image.myimage";
>
> @Override
> protected void initializeImageRegistry(ImageRegistry registry) {
> super.initializeImageRegistry(registry);
> Bundle bundle = Platform.getBundle(ID);
>
> ImageDescriptor myImage = ImageDescriptor.createFromURL(
> FileLocator.find(bundle,
> new Path("icons/myImage..gif"),
> null));
> registry.put(MY_IMAGE_ID, myImage);
> }
>
> public static Image getImage(String a_KeyImage ) {
> AbstractUIPlugin plugin = getDefault();
> ImageRegistry imageRegistry = plugin.getImageRegistry();
> Image myImage = imageRegistry.get(a_KeyImage);
> return myImage;
> }
>
> }
>
|
|
|
|
|
Re: register image. problem [message #108367 is a reply to message #108307] |
Tue, 07 October 2008 06:42 |
Eclipse User |
|
|
|
Originally posted by: rherrmann.innoopract.com
as said in the previous post, the plug-in ImageRegistry itself
works. The problem seems to be with your code.
Are you sure that you deal with the right bundle?
Bundle bundle = Platform.getBundle(ID);
Did you try
Bundle bundle = this.getBundle();
Eugenio Abello wrote:
> Sorry wrote the wrong message. You should have written "icons/myImage.gif"
> Any idea where to find the problem.
>
|
|
|
Re: register image. problem [message #108545 is a reply to message #108367] |
Tue, 07 October 2008 10:34 |
Eclipse User |
|
|
|
Originally posted by: fappel.innoopract.com
Hi,
as always a stacktrace can help us to understand better what you are
trying to do. A common mistake regarding image loading is that people do
this at the bundle startup, which is common in RCP but doesn't work with
RAP as this only can be done in a valid session context. There are
several posts available in this newsgroup about that kind of problem.
Ciao
Frank
-----Ursprüngliche Nachricht-----
Von: Rüdiger Herrmann [mailto:rherrmann@innoopract.com]
Bereitgestellt: Dienstag, 7. Oktober 2008 08:43
Bereitgestellt in: eclipse.technology.rap
Unterhaltung: register image. problem
Betreff: Re: register image. problem
as said in the previous post, the plug-in ImageRegistry itself
works. The problem seems to be with your code.
Are you sure that you deal with the right bundle?
Bundle bundle = Platform.getBundle(ID);
Did you try
Bundle bundle = this.getBundle();
Eugenio Abello wrote:
> Sorry wrote the wrong message. You should have written
"icons/myImage.gif"
> Any idea where to find the problem.
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.04293 seconds