/** * Method copied from super class with only a minor change: call to "readOnly" changed to "tryReadOnly". */ @Override public IHyperlink[] detectHyperlinks(final ITextViewer textViewer, final IRegion region, final boolean canShowMultipleHyperlinks) { final IDocument xtextDocument = textViewer.getDocument(); if (!(xtextDocument instanceof N4JSDocument)) { return super.detectHyperlinks(textViewer, region, canShowMultipleHyperlinks); } final IHyperlinkHelper helper = getHelper(); return ((N4JSDocument) xtextDocument).tryReadOnly(new IUnitOfWork<IHyperlink[], XtextResource>() { @Override public IHyperlink[] exec(XtextResource resource) throws Exception { if (resource == null) { return null; } if (helper instanceof ISourceViewerAware && textViewer instanceof ISourceViewer) { ((ISourceViewerAware) helper).setSourceViewer((ISourceViewer) textViewer); } return helper.createHyperlinksByOffset(resource, region.getOffset(), canShowMultipleHyperlinks); } }, null); }
/** * Retrieves the hyperlinks found in a given source at a given offset. * * @param resource * the resource in which to look for hyperlinks, must not be {@code null} * @param offset * the position at which to look for hyperlinks * @return a list of hyperlinks, never {@code null} */ protected List<IHyperlink> getOffsetHyperlinks(final XtextResource resource, final int offset) { IHyperlink[] hyperlinks = UIThreadRunnable.syncExec(new Result<IHyperlink[]>() { @Override public IHyperlink[] run() { return getTestUtil().get(IHyperlinkHelper.class).createHyperlinksByOffset(resource, offset, true); } }); return hyperlinks != null ? Arrays.asList(hyperlinks) : new ArrayList<IHyperlink>(); }
/** Used to disable hyperlinking in read-only check editors. {@inheritDoc} */ @Override public Class<? extends IHyperlinkHelper> bindIHyperlinkHelper() { return CheckHyperlinkHelper.class; }
public Class<? extends IHyperlinkHelper> bindIHyperlinkHelper() { return PackageImportHyperlinkHelper.class; }
public Class<? extends IHyperlinkHelper> bindIHyperlinkHelper() { return SpecHyperlinkHelper.class; }
public Class<? extends IHyperlinkHelper> bindIHyperlinkHelper() { return SadlHyperlinkHelper.class; }
/** * Bind hyperlink helper to provide hyperlinking from "override" keyword to extended rule. * * @return FormatHyperlinkHelper.class */ @Override public Class<? extends IHyperlinkHelper> bindIHyperlinkHelper() { return FormatHyperlinkHelper.class; }
/** * Binds the custom VIL hyperlink helper for the creation of the * <code>com.google.inject.Bindery</code>. * * This enables the creation of hyperlinks for VIL-elements in an VIL-file * and the custom reaction on selecting these Hyperlinks (or pressing F3), * e.g. showing the element's declaration. */ public Class<? extends IHyperlinkHelper> bindIHyperlinkHelper() { return RtVilHyperlinkHelper.class; }
/** * Binds the custom VTL hyperlink helper for the creation of the <code>com.google.inject.Bindery</code>. * * This enables the creation of hyperlinks for VTL-elements in an VTL-file and the custom * reaction on selecting these Hyperlinks (or pressing F3), e.g. showing the element's declaration. */ public Class<? extends IHyperlinkHelper> bindIHyperlinkHelper() { return VtlHyperlinkHelper.class; }
/** * Binds the custom VIL hyperlink helper for the creation of the <code>com.google.inject.Bindery</code>. * * This enables the creation of hyperlinks for VIL-elements in an VIL-file and the custom * reaction on selecting these Hyperlinks (or pressing F3), e.g. showing the element's declaration. */ public Class<? extends IHyperlinkHelper> bindIHyperlinkHelper() { return VilHyperlinkHelper.class; }
/** * Binds the custom <code>IvmlHyperlinkHelper</code> for the creation of the <code>com.google.inject.Bindery</code>. * * This enables the creation of <code>IvmlHyperlinks</code> for IVML-elements in an IVML-file and the custom * reaction on selecting these Hyperlinks (or pressing F3), e.g. showing the element's declaration. */ public Class<? extends IHyperlinkHelper> bindIHyperlinkHelper() { return IvmlHyperlinkHelper.class; }