use of org.jkiss.dbeaver.ui.editors.sql.syntax.SQLHyperlinkDetector in project dbeaver by serge-rider.
the class NavigateObjectHandler method getCurrentHyperlink.
private IHyperlink getCurrentHyperlink(SQLEditorBase editor) {
SQLHyperlinkDetector hyperlinkDetector = new SQLHyperlinkDetector(editor, editor.getSyntaxManager());
ITextSelection selection = (ITextSelection) editor.getTextViewer().getSelection();
IRegion curRegion = new Region(selection.getOffset(), 0);
IHyperlink[] hyperLinks = hyperlinkDetector.detectHyperlinks(editor.getTextViewer(), curRegion, false);
return ArrayUtils.isEmpty(hyperLinks) ? null : hyperLinks[0];
}
use of org.jkiss.dbeaver.ui.editors.sql.syntax.SQLHyperlinkDetector in project dbeaver by dbeaver.
the class SQLEditorHandlerNavigateObject method getCurrentHyperlink.
private IHyperlink getCurrentHyperlink(SQLEditorBase editor) {
SQLHyperlinkDetector hyperlinkDetector = editor.getViewerConfiguration().getHyperlinkDetector();
ITextSelection selection = (ITextSelection) editor.getTextViewer().getSelection();
IRegion curRegion = new Region(selection.getOffset(), 0);
IHyperlink[] hyperLinks = hyperlinkDetector.detectHyperlinks(editor.getTextViewer(), curRegion, false);
if (!ArrayUtils.isEmpty(hyperLinks)) {
return hyperLinks[0];
}
String lastKeyword = hyperlinkDetector.getLastKeyword();
if (!CommonUtils.isEmpty(lastKeyword)) {
IEditorStatusLine statusLine = editor.getAdapter(IEditorStatusLine.class);
if (statusLine != null) {
statusLine.setMessage(true, "Can't find metadata object for name '" + lastKeyword + "'", (Image) null);
}
editor.getEditorControl().getDisplay().beep();
}
return null;
}
use of org.jkiss.dbeaver.ui.editors.sql.syntax.SQLHyperlinkDetector in project dbeaver by dbeaver.
the class NavigateObjectHandler method getCurrentHyperlink.
private IHyperlink getCurrentHyperlink(SQLEditorBase editor) {
SQLHyperlinkDetector hyperlinkDetector = new SQLHyperlinkDetector(editor, editor.getSyntaxManager());
ITextSelection selection = (ITextSelection) editor.getTextViewer().getSelection();
IRegion curRegion = new Region(selection.getOffset(), 0);
IHyperlink[] hyperLinks = hyperlinkDetector.detectHyperlinks(editor.getTextViewer(), curRegion, false);
if (!ArrayUtils.isEmpty(hyperLinks)) {
return hyperLinks[0];
}
String lastKeyword = hyperlinkDetector.getLastKeyword();
if (!CommonUtils.isEmpty(lastKeyword)) {
IEditorStatusLine statusLine = (IEditorStatusLine) editor.getAdapter(IEditorStatusLine.class);
if (statusLine != null) {
statusLine.setMessage(true, "Can't find metadata object for name '" + lastKeyword + "'", (Image) null);
}
editor.getEditorControl().getDisplay().beep();
}
return null;
}
use of org.jkiss.dbeaver.ui.editors.sql.syntax.SQLHyperlinkDetector in project dbeaver by serge-rider.
the class SQLEditorHandlerNavigateObject method getCurrentHyperlink.
private IHyperlink getCurrentHyperlink(SQLEditorBase editor) {
SQLHyperlinkDetector hyperlinkDetector = editor.getViewerConfiguration().getHyperlinkDetector();
ITextSelection selection = (ITextSelection) editor.getTextViewer().getSelection();
IRegion curRegion = new Region(selection.getOffset(), 0);
IHyperlink[] hyperLinks = hyperlinkDetector.detectHyperlinks(editor.getTextViewer(), curRegion, false);
if (!ArrayUtils.isEmpty(hyperLinks)) {
return hyperLinks[0];
}
String lastKeyword = hyperlinkDetector.getLastKeyword();
if (!CommonUtils.isEmpty(lastKeyword)) {
IEditorStatusLine statusLine = editor.getAdapter(IEditorStatusLine.class);
if (statusLine != null) {
statusLine.setMessage(true, "Can't find metadata object for name '" + lastKeyword + "'", (Image) null);
}
editor.getEditorControl().getDisplay().beep();
}
return null;
}
Aggregations