Java Code Examples for org.eclipse.xtext.ui.editor.hyperlinking.XtextHyperlink#setHyperlinkRegion()
The following examples show how to use
org.eclipse.xtext.ui.editor.hyperlinking.XtextHyperlink#setHyperlinkRegion() .
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: PackageJsonHyperlinkHelperExtension.java From n4js with Eclipse Public License 1.0 | 6 votes |
@Override public IHyperlink[] getHyperlinks(XtextResource resource, int offset) { EObject eObject = eObjectAtOffsetHelper.resolveElementAt(resource, offset); Pair<SafeURI<?>, Region> linkedProjectWithRegion = getUriRegionPair(eObject); if (linkedProjectWithRegion != null) { URI uri = linkedProjectWithRegion.getFirst().toURI(); IRegion region = linkedProjectWithRegion.getSecond(); IN4JSProject uriProject = model.findProject(uri).orNull(); String lnkName = uriProject == null ? ProjectDescriptionUtils.deriveN4JSProjectNameFromURI(uri) : uriProject.getProjectName().getRawName(); XtextHyperlink hyperlink = hyperlinkProvider.get(); hyperlink.setHyperlinkRegion(region); hyperlink.setURI(uri); hyperlink.setHyperlinkText(lnkName); return new IHyperlink[] { hyperlink }; } return null; }
Example 2
Source File: SolidityHyperlinkHelper.java From solidity-ide with Eclipse Public License 1.0 | 6 votes |
protected void createImportedNamespacesHyperlinksByOffset(XtextResource resource, int offset, IHyperlinkAcceptor acceptor) { INode node = NodeModelUtils.findLeafNodeAtOffset(resource.getParseResult().getRootNode(), offset); if (node != null) { List<INode> importNodes = NodeModelUtils.findNodesForFeature(node.getSemanticElement(), SolidityPackage.Literals.IMPORT_DIRECTIVE__IMPORTED_NAMESPACE); if (importNodes != null && !importNodes.isEmpty()) { for (INode importNode : importNodes) { ImportDirective importElement = (ImportDirective) importNode.getSemanticElement(); URI targetURI = getFileURIOfImport(importElement); XtextHyperlink result = getHyperlinkProvider().get(); result.setURI(targetURI); Region region = new Region(importNode.getOffset(), importNode.getLength()); result.setHyperlinkRegion(region); result.setHyperlinkText(targetURI.toString()); acceptor.accept(result); } } } }
Example 3
Source File: N4JSHyperlinkHelper.java From n4js with Eclipse Public License 1.0 | 5 votes |
private void superCreateHyperlinksTo(IRegion region, EObject target, IHyperlinkAcceptor acceptor, URI normalized) { String hyperlinkText = labelProvider.getText(target); XtextHyperlink result = hyperlinkProvider.get(); result.setHyperlinkRegion(region); result.setURI(normalized); result.setHyperlinkText(hyperlinkText); acceptor.accept(result); }
Example 4
Source File: PackageImportHyperlinkHelper.java From statecharts with Eclipse Public License 1.0 | 5 votes |
protected IHyperlink createHyperlink(INode node, final PackageImport pkgImport) { XtextHyperlink result = getHyperlinkProvider().get(); result.setURI(pkgImport.getFileURI()); Region region = new Region(node.getOffset(), node.getLength()); result.setHyperlinkRegion(region); result.setHyperlinkText(pkgImport.getUri().toString()); return result; }
Example 5
Source File: XtextHyperlinkHelper.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
@Deprecated private void deprecatedSetRegion(XtextHyperlink link, Region region) { link.setHyperlinkRegion(region); }