|Multiple ImageProviders in separate plug-ins [message #757169]
||Wed, 16 November 2011 21:42
| Brian Fitzpatrick
Registered: July 2009
There are multiple threads about registering multiple ImageProviders from different plug-ins for a particular DiagramType. But I haven't seen an example and haven't been able to get it to work yet.
We have a use case where we're trying to add items to the palette. Each item has an icon that is provided by a URL or project-relative path. So we don't know about these items ahead of time and can't register them in an ImageProvider class up front. To work around that, before we open the editor, I process the project looking for these files that have icon references in them and try to add them to an ImageProvider class at that point.
Unfortunately, even if I get the ImageProvider registered in an extension point in one plug-in and reference it in the other with the diagram provider, when the feature tries to get the image all I get is the little red "missing image" box.
I'm open to ideas here. I've debugged into this thing three ways from Sunday but I still haven't figured out where it's actually loading the image for the palette or for the diagram element on the canvas. So I don't know if it's just that you can't register images after the fact with Graphiti or what's going on.
Perhaps there's a way to use an Eclipse UI Image instead of a Graphiti Image that I'm not seeing? But there seem to be too many levels of indirection when doing stuff like this:
IGaService service = Graphiti.getGaService();
Image img = service.createImage(rect, [image ID registered in the ImageProvider] );
service.setLocationAndSize(img, 2, 2, GraphicsUtil.TASK_IMAGE_SIZE,
And though I can grab the ImageDescriptor and create an Image that way, there doesn't seem to be a way to shoehorn it in even if I do my own image management.
Any and all ideas are welcome - even crazy ones.
Powered by FUDForum
. Page generated in 0.04504 seconds