Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 14:31 Go to next message
Cristiano Gavião is currently offline Cristiano GaviãoFriend
Messages: 279
Registered: July 2009
Senior Member
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 17:42 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13529
Registered: July 2009
Senior Member
Hi,

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

Regards
Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to reference images setup by IEObjectLabelProvider inside MyDslEObjectHoverProvider ? [message #900909 is a reply to message #900852] Wed, 08 August 2012 23:53 Go to previous message
Cristiano Gavião is currently offline Cristiano GaviãoFriend
Messages: 279
Registered: July 2009
Senior Member
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: Fri Aug 14 09:56:01 GMT 2020

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

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

Back to the top