[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform.rcp] Loading Image Resources (Linux)
|
Hi all,
i stumbled upon a rather curious problem trying to persuade our
RCP-application (eclipse 3.3.2 based) to run under Linux. All in all the
application works rather well, but we have a lot of images (mostly icons,
but also some background images for views) which have to be available inside
the application. We use a ImageRegistry to store ImageDescriptors for keys.
The key=value pairs (where a value is the path [fileName] of an image
resource relative to a general image path [iconFolder]) are stored in a
propertie file. As the application starts, the properties are stored and we
are filling the image registry using the stored key/value pairs as follows:
Bundle bundle = plugin.getBundle();
Path path = new Path(this.iconFolder + fileName);
URL url = FileLocator.find(bundle, path, Collections.EMPTY_MAP);
if (url != null) {
ImageDescriptor desc = ImageDescriptor.createFromURL(url);
this.registry.put(key, desc);
}
This works perfectly well under Windows and also for about 60% of the images
under Linux. However for about 40% the URL returned by FileLocator.find(...)
is null. The affected vs. unaffected files of this problem do not display
any obvious differences (although there are several directories, there are
files in every directory that can or cannot be opened this way). I have
checked all the obvious possibilities (permissions, special filenames, etc.)
without success. It gets even weirder:
In the original properties file i considered two entries:
key1=pathToIcon1 //works
key2=pathToIcon2 //does NOT work
I changed that to:
key1=pathToIcon1 //works
key2=pathToIcon1 //works too
So i thought the problem might be with the image file Icon2, but then i
checked:
key1=pathToIcon2 //works (!)
key2=pathToIcon1 //works too
At last the combination
key1=pathToIcon2 //works
key2=pathToIcon2 //does NOT work
So i am out of ideas. I debugged the find(...) method of RCP to find out
why it returned a "null" URL and got up to the JDK method File.exists()
which uses the current FileSystem (UnixFileSystem or so) to check if a File
is hidden or nonexistent and returns false for the affected files (although
they DO exist as i showed with the example above).
Oh by the way i run Ubuntu 7.10 (ext3 fs) in a VirtualBox environment under
Windows Vista, but this not the problem, as my old trusty not-virtualized
Suse 9.3 (reiserfs) on my Notebook with a much older version of our software
(same icon-filenames but different icons) and eclipse 3.2 displays the same
behaviour (at least where those images are concerned).
Any ideas out there?
Regards
Markus