Problem with image selection

SWT Designer allows you to create the views, editors, perspectives, pref pages, composites, etc. that comprise Eclipse SWT & RCP applications and plug-ins.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

Problem with image selection

Postby M.Stier » Wed Nov 03, 2004 12:27 am

Hi there,

I'm currently evaluating SWT-Designer on Eclipse 3.1 M2.
My test project is an RCP application plugin. I'm designing an editor as descendent from editorpart.

Besides some other controls I've added a Clabel.

I tried to add an image to the CLabel. The select images dialog shows my icons relative to plugin even with preview.
The problem:
When I select the image, the corresponding property remains empty, no image is displayed.
When I select an image relative to source folder it works as expected.

regards
M. Stier
M.Stier
 
Posts: 11
Joined: Mon Oct 25, 2004 6:43 am

Re: Problem with image selection

Postby Eric Clayberg » Wed Nov 03, 2004 6:12 am

M.Stier wrote:Besides some other controls I've added a Clabel. I tried to add an image to the CLabel. The select images dialog shows my icons relative to plugin even with preview.
The problem:
When I select the image, the corresponding property remains empty, no image is displayed.
When I select an image relative to source folder it works as expected.

When selecting your plugin-relative image, did you also select your plugin class (the second step)?

Was any setImage() code generated? You should see something like this...

Code: Select all
label.setImage(ResourceManager.getPluginImage(SamplePlugin.getDefault(), "icons/sample.gif"));

Does you Eclipse Problems view show any errors for the project? When a plugin-relative image does not show up, it usually means that there is something wrong with the project or plugin definition.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Re: Problem with image selection

Postby M.Stier » Wed Nov 03, 2004 7:28 am

Was any setImage() code generated? You should see something like this...

Code: Select all
label.setImage(ResourceManager.getPluginImage(SamplePlugin.getDefault(), "icons/sample.gif"));

Does you Eclipse Problems view show any errors for the project? When a plugin-relative image does not show up, it usually means that there is something wrong with the project or plugin definition.


As far as I can see, my plugin definition is correct.
setImage() code is generated.

I could track it down to the following routine in your ResourceManager class: getPluginImageURL(). You try to get an IPluginDescriptor by invoking the method getDesciptor() of the plugin class. getDescriptor is deprecated and works only, if you add org.eclipse.core.runtime.compatibility to your plugin configuration.

We don't want to use org.eclipse.core.runtime.compatibility in our configuration. Maybe you can update the ResourceManager class to use the recommended OSGI bundle framework.

Even if we enable the compatibility plugin, I can't see the icons at design time. They are visible at runtime.

regards
M. Stier
M.Stier
 
Posts: 11
Joined: Mon Oct 25, 2004 6:43 am

Re: Problem with image selection

Postby Eric Clayberg » Wed Nov 03, 2004 1:36 pm

M.Stier wrote:We don't want to use org.eclipse.core.runtime.compatibility in our configuration. Maybe you can update the ResourceManager class to use the recommended OSGI bundle framework.

That's really not an option as the OSGi stuff is not potable across all Eclipse versions. A large percentage of our customers are using Eclipse 2.1-based IDEs (like WSAD) that don't contain the OSGi stuff at all. The API we are using - while deprecated in later versions of Eclipse - does have the benefit of working in any version of Eclipse.

M.Stier wrote:Even if we enable the compatibility plugin, I can't see the icons at design time. They are visible at runtime.

In that case, I don't think the problem you are having has anything to do with the compatibility plugin. We are also using Eclipse 3.1 and it works fine at design time. Are you using JDK 1.4 or JDK 1.5? Apparently, there are some JDK-level changes in 1.5 that might account for this (in the Class.getMethod() method). We are investigating a work around.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA


Return to SWT Designer

Who is online

Users browsing this forum: No registered users and 1 guest