use of org.jkiss.dbeaver.ui.editors.entity.EntityHyperlink in project dbeaver by serge-rider.
the class SQLHyperlinkDetector method detectHyperlinks.
@Nullable
@Override
public synchronized IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks) {
this.contextInformer.searchInformation(region);
if (!this.contextInformer.hasObjects()) {
// Long task - just return no links for now
return null;
} else {
// Create hyperlinks based on references
final SQLIdentifierDetector.WordRegion wordRegion = this.contextInformer.getWordRegion();
final IRegion hlRegion = new Region(wordRegion.identStart, wordRegion.identEnd - wordRegion.identStart);
final List<DBSObjectReference> references = this.contextInformer.getObjectReferences();
IHyperlink[] links = new IHyperlink[references.size()];
for (int i = 0, objectsSize = references.size(); i < objectsSize; i++) {
links[i] = new EntityHyperlink(contextInformer.getEditor().getSite(), references.get(i), hlRegion);
}
return links;
}
}
Aggregations