org.eclipse.xtext.ui.editor.hyperlinking.IHyperlinkHelper Java Examples
The following examples show how to use
org.eclipse.xtext.ui.editor.hyperlinking.IHyperlinkHelper.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: N4JSHyperlinkDetector.java From n4js with Eclipse Public License 1.0 | 6 votes |
/** * 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 { resource = tryConvertToFileResource(resource); if (resource == null) { return null; } if (helper instanceof ISourceViewerAware && textViewer instanceof ISourceViewer) { ((ISourceViewerAware) helper).setSourceViewer((ISourceViewer) textViewer); } return helper.createHyperlinksByOffset(resource, region.getOffset(), canShowMultipleHyperlinks); } }, (IHyperlink[]) null); }
Example #2
Source File: AbstractHyperlinkHelperTest.java From dsl-devkit with Eclipse Public License 1.0 | 5 votes |
/** * 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>(); }
Example #3
Source File: XtextUiModule.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
public Class<? extends IHyperlinkHelper> bindIHyperlinkHelper() { return XtextHyperlinkHelper.class; }
Example #4
Source File: DomainmodelUiModule.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
@Override public Class<? extends IHyperlinkHelper> bindIHyperlinkHelper() { return DomainmodelHyperlinkHelper.class; }
Example #5
Source File: DefaultXbaseUiModule.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
@Override public Class<? extends IHyperlinkHelper> bindIHyperlinkHelper() { return XbaseHyperLinkHelper.class; }
Example #6
Source File: DefaultCommonTypesUiModule.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
public Class<? extends IHyperlinkHelper> bindIHyperlinkHelper() { return TypeAwareHyperlinkHelper.class; }
Example #7
Source File: DotUiModule.java From gef with Eclipse Public License 2.0 | 4 votes |
public Class<? extends IHyperlinkHelper> bindIHyperlinkHelper() { return DotHyperlinkHelper.class; }
Example #8
Source File: XtendUiModule.java From xtext-xtend with Eclipse Public License 2.0 | 4 votes |
@Override public Class<? extends IHyperlinkHelper> bindIHyperlinkHelper() { return XtendHyperlinkHelper.class; }
Example #9
Source File: CheckUiModule.java From dsl-devkit with Eclipse Public License 1.0 | 4 votes |
/** Used to disable hyperlinking in read-only check editors. {@inheritDoc} */ @Override public Class<? extends IHyperlinkHelper> bindIHyperlinkHelper() { return CheckHyperlinkHelper.class; }
Example #10
Source File: AbstractSARLUiModule.java From sarl with Apache License 2.0 | 4 votes |
public Class<? extends IHyperlinkHelper> bindIHyperlinkHelper() { return XtendHyperlinkHelper.class; }
Example #11
Source File: FormatUiModule.java From dsl-devkit with Eclipse Public License 1.0 | 2 votes |
/** * Bind hyperlink helper to provide hyperlinking from "override" keyword to extended rule. * * @return FormatHyperlinkHelper.class */ @Override public Class<? extends IHyperlinkHelper> bindIHyperlinkHelper() { return FormatHyperlinkHelper.class; }