No icons after exporting [message #1111724] |
Wed, 18 September 2013 16:38 |
romain ognier Messages: 21 Registered: September 2013 |
Junior Member |
|
|
Hi !
I am facing a problem :
After exporting my project, I don't have any icons on my treeView anymore.
Here is my code :
public class TodoLabelProvider extends LabelProvider {
private static final Image FOLDER = getImage("folder.png");
private static final Image FILE = getImage("file.png");
@Override
public Image getImage(Object element) {
if (element instanceof Message) {
return FOLDER;
} else if (element instanceof Word) {
return FILE;
}
return null;
}
private static Image getImage(String file) {
Bundle bundle = FrameworkUtil.getBundle(TodoLabelProvider.class);
URL url = FileLocator.find(bundle, new Path("icons/" + file), null);
ImageDescriptor image = ImageDescriptor.createFromURL(url);
return image.createImage();
}
}
Here is my build.properties :
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml,\
Application.e4xmi,\
css/default.css,\
template/,\
xslt/,\
icons/
source.. = src/
I don't understand why it does not work.
Do I have to add something in the plugin.xml ?
Thank you for your help !
ps : it works just fine when i launch the application from eclipse.
|
|
|
Re: No icons after exporting [message #1112834 is a reply to message #1111724] |
Fri, 20 September 2013 08:33 |
Jonas Helming Messages: 699 Registered: July 2009 |
Senior Member |
|
|
Hi,
can you check the deployed version of your bundle, whether the icons are
in it? Do you deploy the bundle as a jar or as a folder?
Regards
Jonas
Am 18.09.2013 18:38, schrieb romain ognier:
> Hi !
> I am facing a problem :
> After exporting my project, I don't have any icons on my treeView anymore.
>
> Here is my code :
> public class TodoLabelProvider extends LabelProvider {
>
> private static final Image FOLDER = getImage("folder.png");
> private static final Image FILE = getImage("file.png");
>
>
> @Override
> public Image getImage(Object element) {
> if (element instanceof Message) {
> return FOLDER;
> } else if (element instanceof Word) {
> return FILE;
> }
> return null;
> }
>
> private static Image getImage(String file) {
> Bundle bundle = FrameworkUtil.getBundle(TodoLabelProvider.class);
> URL url = FileLocator.find(bundle, new Path("icons/" + file),
> null);
> ImageDescriptor image = ImageDescriptor.createFromURL(url);
> return image.createImage();
> } } Here is my build.properties :
> output.. = bin/
> bin.includes = META-INF/,\
> .,\
> plugin.xml,\
> Application.e4xmi,\
> css/default.css,\
> template/,\
> xslt/,\
> icons/
> source.. = src/
>
> I don't understand why it does not work.
> Do I have to add something in the plugin.xml ?
> Thank you for your help !
>
> ps : it works just fine when i launch the application from eclipse.
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: No icons after exporting [message #1115745 is a reply to message #1115732] |
Tue, 24 September 2013 14:17 |
romain ognier Messages: 21 Registered: September 2013 |
Junior Member |
|
|
Yes, I am.
I am pretty sure that this is :
ImageDescriptor image = ImageDescriptor.createFromURL(url);
which does not work.
Cause i use
TodoLabelProvider.class.getClassLoader().getResource(file)
somewhere else in my code on xml file and it works perfectly fine. I put my icons in the same directory of my xml file but it still does not find them !
Edit :
Ok, I may have find something usefull, I don't know why, but :
URL url = TodoLabelProvider.class.getClassLoader().getResource(file);
clearly does not work. url is null.
Does this have anything to do with the fact that my method is static ?
[Updated on: Tue, 24 September 2013 14:35] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05703 seconds