Search in sources :

Example 1 with XtextHyperlink

use of org.eclipse.xtext.ui.editor.hyperlinking.XtextHyperlink in project ow by vtst.

the class LessHyperlinkHelper method createHyperlinksTo.

/**
   * Create an hyper-link to the resource designated by an URI.
   * @param from  The source resource.
   * @param uri  The target URI.
   * @param acceptor  An acceptor for the hyper-link.
   */
public void createHyperlinksTo(XtextResource from, URI uri, IHyperlinkAcceptor acceptor) {
    final URIConverter uriConverter = from.getResourceSet().getURIConverter();
    final String hyperlinkText = uri.toString();
    final URI normalized = uriConverter.normalize(uri).resolve(from.getURI());
    XtextHyperlink result = getHyperlinkProvider().get();
    result.setHyperlinkRegion(new Region(1, 1));
    result.setURI(normalized);
    result.setHyperlinkText(hyperlinkText);
    acceptor.accept(result);
}
Also used : XtextHyperlink(org.eclipse.xtext.ui.editor.hyperlinking.XtextHyperlink) Region(org.eclipse.jface.text.Region) URIConverter(org.eclipse.emf.ecore.resource.URIConverter) URI(org.eclipse.emf.common.util.URI)

Aggregations

URI (org.eclipse.emf.common.util.URI)1 URIConverter (org.eclipse.emf.ecore.resource.URIConverter)1 Region (org.eclipse.jface.text.Region)1 XtextHyperlink (org.eclipse.xtext.ui.editor.hyperlinking.XtextHyperlink)1