Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » bundle.getEntry() always returns null(Trivial code to get imageDescriptor doesn't work.)
bundle.getEntry() always returns null [message #676250] Fri, 03 June 2011 11:55 Go to next message
Erwin  is currently offline Erwin Friend
Messages: 10
Registered: June 2011
Junior Member
Hi,

I am struggling with something that seems a trivial task for a day now, and I am completely lost! For some reason bundle.getEntry() just won't return the url of my resource. getResource() however DOES work.

I have checked, double checked an triple checked that the PLUGIN_ID is correct, that the filename is correct, desperately moved the resource around, added '/', and '.' to the image path, but to no avail.

Code and build.properties below.

Any help is highly appreciated.

Kind Regards,

Erwin

		...
image = getImageDescriptor("icons/myImage.jpg").createImage();
...


	private ImageDescriptor getImageDescriptor(String id){
//		URL url = Platform.getBundle(Activator.PLUGIN_ID).getResource(id); // Valid URL
//		URL url = Platform.getBundle(Activator.PLUGIN_ID).getEntry(id); // null
//		return ImageDescriptor.createFromURL(url);
		ImageDescriptor imd = AbstractUIPlugin.imageDescriptorFromPlugin(Activator.PLUGIN_ID, id); // null
		return imd;
	}


Build.properties:
source.. = src/
output.. = bin/
bin.includes = plugin.xml,\
               META-INF/,\
               .,\
               icons/
src.includes = META-INF/,\
               icons/,\
               plugin.xml


Re: bundle.getEntry() always returns null - RESOLVED [message #676285 is a reply to message #676250] Fri, 03 June 2011 14:22 Go to previous message
Erwin  is currently offline Erwin Friend
Messages: 10
Registered: June 2011
Junior Member
So the file name was correct, and the plugin ID was correct, but for some reason, when I copied the file in Eclipse from one folder to another, it had not copied the file in the file system as well. After refreshing the project the file still showed up in Eclipse even though it wasn't there. Manually copied the file over, and that resolved the mystery.

Thanks for your attention.

Erwin
Previous Topic:Prevent opening of the Java Stack Trace Console
Next Topic:Does anyone have a recommendation on Eclipse RCP training?
Goto Forum:
  


Current Time: Tue Apr 23 17:51:25 GMT 2024

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

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

Back to the top