Hi all,
currently widget classes have image loading such as:
public AngleSlider(final Composite parent, final int style) {
super(parent, style | SWT.DOUBLE_BUFFERED);
this.backgroundImage = new Image(getDisplay(), getClass().getClassLoader().getResourceAsStream("images/angleBackground.png"));
this.buttonFocus = new Image(getDisplay(), getClass().getClassLoader().getResourceAsStream("images/angleButtonFocus.png"));
this.buttonNoFocus = new Image(getDisplay(), getClass().getClassLoader().getResourceAsStream("images/angleButtonFocusLost.png"));
addListeners();
this.selection = 0;
this.selectionListeners = new ArrayList<SelectionListener>();
}
This way of loading resources appeared to be working fine until we had the opal
jar (version 0.9.x) in our Eclipse plugin.
This because in the "Manifest Editor > Runtime > Classpath" section it was
added among the libraries constituting the plug-in classpath.
However recently we refactored the target platform of our RCP product and
decided to use also Opal among the plugins.
Since the latest version 1.0.1 Opal is provided as OSGI bundle.
However the code above is no more good, especially when you decide to create
for example an inner class extending the original AngleSlider.
Changing to something like this works fine:
org.mihalis.opal.angles.AngleSlider.class.getClassLoader().getResourceAsStream("
/images/angleBackground.png")
Personally for image caching I use Windows Builder classes like
org.eclipse.wb.swt.ResourceManager and org.eclipse.wb.swt.SWTResourceManager.
For now we "quick fixed" putting all the image resources of the Opal widgets
inside our plugin.
Regards,
Massimo.
Original issue reported on code.google.com by massimo....@gmail.com on 11 Feb 2015 at 2:51
Original issue reported on code.google.com by
massimo....@gmail.com
on 11 Feb 2015 at 2:51