Java 类org.eclipse.xtext.ui.editor.hyperlinking.IHyperlinkHelper 实例源码

项目:n4js    文件:N4JSHyperlinkDetector.java   
/**
 * 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);
}
项目:dsl-devkit    文件:AbstractHyperlinkHelperTest.java   
/**
 * 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>();
}
项目:dsl-devkit    文件:CheckUiModule.java   
/** Used to disable hyperlinking in read-only check editors. {@inheritDoc} */
@Override
public Class<? extends IHyperlinkHelper> bindIHyperlinkHelper() {
  return CheckHyperlinkHelper.class;
}
项目:statecharts    文件:STextUiModule.java   
public Class<? extends IHyperlinkHelper> bindIHyperlinkHelper() {
    return PackageImportHyperlinkHelper.class;
}
项目:Gauge-Eclipse    文件:SpecUiModule.java   
public Class<? extends IHyperlinkHelper> bindIHyperlinkHelper() {
    return SpecHyperlinkHelper.class;
}
项目:sadlos2    文件:SadlUiModule.java   
public Class<? extends IHyperlinkHelper> bindIHyperlinkHelper() {
    return SadlHyperlinkHelper.class;
}
项目:dsl-devkit    文件:FormatUiModule.java   
/**
 * Bind hyperlink helper to provide hyperlinking from "override" keyword to extended rule.
 *
 * @return FormatHyperlinkHelper.class
 */
@Override
public Class<? extends IHyperlinkHelper> bindIHyperlinkHelper() {
  return FormatHyperlinkHelper.class;
}
项目:EASyProducer    文件:RtVilUiModule.java   
/**
 * 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;
}
项目:EASyProducer    文件:TemplateLangUiModule.java   
/**
 * 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;
}
项目:EASyProducer    文件:VilBuildLanguageUiModule.java   
/**
 * 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;
}
项目:EASyProducer    文件:IvmlUiModule.java   
/**
 * 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;
}