| Summary: | PluginImageHelper does not allow to use images from Referenced Plugins | ||
|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Christian Dietrich <christian.dietrich.opensource> |
| Component: | Xtext | Assignee: | Project Inbox <tmf.xtext-inbox> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | christian.dietrich.opensource, miklossy, sebastian.zarnekow |
| Version: | 2.4.0 | Keywords: | helpwanted |
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | v2.14 | ||
|
Description
Christian Dietrich
Reminds me of bug 313072 which I still would like to have. A patch is most welcome. I cannot provide a patch but we have following code as Workaround
public class ClasspathAwareImageHelper extends PluginImageHelper {
@Override
public Image getImage(String imageName) {
String imgname = imageName == null ? getDefaultImage() : imageName;
if (imgname != null) {
Image result = null;
String name = getPathSuffix() + imgname;
URL imgUrl = getPlugin().getBundle().getResource(name); // use class loader (in Helios SR1 the class loader
// is not used)
if (imgUrl != null) {
ImageDescriptor id = null;
result = getPlugin().getImageRegistry().get(imgUrl.toExternalForm());
if (result == null) {
id = ImageDescriptor.createFromURL(imgUrl);
if (id != null) {
result = id.createImage();
getPlugin().getImageRegistry().put(imgUrl.toExternalForm(), result);
}
}
return result;
}
String notFound = getNotFound();
if (!imgname.equals(notFound)) {
return getImage(notFound);
}
}
return null;
}
}
I have just analyzed the PluginImageHelper class and noticed that it has been extended to be able to load images from other plugins. See also PR https://github.com/eclipse/xtext-eclipse/commit/d8b6369587cc05f2b15fae3fce258a1d34073f48 @Christian Dietrich: Have this change solved the problem described here? i dont know since i have no longer access to the codebase the problem was reported to Yes, the changed addressed the issue |