Skip to main content



      Home
Home » Modeling » TMF (Xtext) » How to reference images setup by IEObjectLabelProvider inside MyDslEObjectHoverProvider ?
How to reference images setup by IEObjectLabelProvider inside MyDslEObjectHoverProvider ? [message #900808] Wed, 08 August 2012 10:31 Go to next message
Eclipse UserFriend
Hi,

I've customized the text and images of the rules of my DSL using IEObjectLabelProvider. It is working great in the overview.

I've customized the first line and documentation of the rules hover and it is working great too.

Now I would like to put the image that I've set up to labels in the beginning of the first line of hover.

How can I reference the icons that I've setup with IEObjectLabelProvider inside MyDslEObjectHoverProvider ?

thanks for any tip.

Cristiano
Re: How to reference images setup by IEObjectLabelProvider inside MyDslEObjectHoverProvider ? [message #900852 is a reply to message #900808] Wed, 08 August 2012 13:42 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

you may have a look what xtext does with XbaseHoverProvider/XbaseDeclarativeHoverSignatureProvider

Regards
Christian
Re: How to reference images setup by IEObjectLabelProvider inside MyDslEObjectHoverProvider ? [message #900909 is a reply to message #900852] Wed, 08 August 2012 19:53 Go to previous message
Eclipse UserFriend
Hi Christian,

Xbase is a bit complicated but I could found what I was needing.

Thanks a lot again.

For people that want to get the URL of the label icons to use them in a HTML hover text, these are the methods that do the job:

	public String getImageTag(final EObject object) {
		final String[] result = new String[1];
		Display.getDefault().syncExec(new Runnable() {
			
			public void run() {
				Image image = labelProvider.getImage(object);
				result[0] = getImageTagLink(ImageDescriptor.createFromImage(image));
			}
		});
		return result[0];
	}

	protected String getImageTagLink(ImageDescriptor imageDescriptor) {
		URL url = getURL(imageDescriptor);
		if (url != null)
			return "<image src='" + url.toExternalForm() + "'/>";
		return "";
	}

	protected URL getURL(ImageDescriptor descriptor) {
		return JavaPlugin.getDefault().getImagesOnFSRegistry().getImageURL(descriptor);
	}
Previous Topic:Problems with Java 7 in validation package
Next Topic:How to create a new DSL that can reference objects defined in a different dsl
Goto Forum:
  


Current Time: Sun Jul 06 23:14:32 EDT 2025

Powered by FUDForum. Page generated in 0.04216 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top