Skip to main content



      Home
Home » Eclipse Projects » Remote Application Platform (RAP) » register image. problem
register image. problem [message #108071] Mon, 06 October 2008 01:35 Go to next message
Eclipse UserFriend
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 #108196 is a reply to message #108071] Mon, 06 October 2008 12:19 Go to previous messageGo to next message
Eclipse UserFriend
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 #108232 is a reply to message #108196] Mon, 06 October 2008 13:34 Go to previous messageGo to next message
Eclipse UserFriend
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 #108244 is a reply to message #108232] Mon, 06 October 2008 13:44 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

is the path "icons/myImage..gif" with two dots intentionally?

Greets
Benny

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 #108269 is a reply to message #108232] Mon, 06 October 2008 13:55 Go to previous messageGo to next message
Eclipse UserFriend
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 #108293 is a reply to message #108244] Mon, 06 October 2008 14:52 Go to previous messageGo to next message
Eclipse UserFriend
Sorry wrote the wrong message. You should have written "icons/myImage.gif"
Any idea where to find the problem.
Re: register image. problem [message #108307 is a reply to message #108269] Mon, 06 October 2008 14:53 Go to previous messageGo to next message
Eclipse UserFriend
Sorry wrote the wrong message. You should have written "icons/myImage.gif"
Any idea where to find the problem.
Re: register image. problem [message #108367 is a reply to message #108307] Tue, 07 October 2008 02:42 Go to previous messageGo to next message
Eclipse UserFriend
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 06:34 Go to previous messageGo to next message
Eclipse UserFriend
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.
>
Re: register image. problem [message #108612 is a reply to message #108545] Tue, 07 October 2008 11:45 Go to previous message
Eclipse UserFriend
That means that not possible, sharing images between sessions.??
Previous Topic:Button Background Image
Next Topic:Hide Table column if it has no data
Goto Forum:
  


Current Time: Wed Jun 18 09:26:44 EDT 2025

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

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

Back to the top