use of org.eclipse.ui.texteditor.IEditorStatusLine in project webtools.sourceediting by eclipse.
the class GotoAnnotationAction method gotoAnnotation.
/**
* Jumps to the error next according to the given direction based off
* JavaEditor#gotoAnnotation()
*
* @param forward
* is the direction
*/
public void gotoAnnotation(boolean forward) {
ITextSelection selection = (ITextSelection) getTextEditor().getSelectionProvider().getSelection();
Position position = new Position(0, 0);
if (false) /* delayed - see bug 18316 */
{
getNextAnnotation(selection.getOffset(), selection.getLength(), forward, position);
getTextEditor().selectAndReveal(position.getOffset(), position.getLength());
} else /* no delay - see bug 18316 */
{
Annotation annotation = getNextAnnotation(selection.getOffset(), selection.getLength(), forward, position);
IEditorStatusLine editorStatusLine = getTextEditor().getAdapter(IEditorStatusLine.class);
if (editorStatusLine != null) {
editorStatusLine.setMessage(true, null, null);
editorStatusLine.setMessage(false, null, null);
} else {
IStatusLineManager mgr = getStatusLineManager();
if (mgr != null) {
mgr.setErrorMessage(null);
mgr.setMessage(null, null);
}
}
if (annotation != null) {
updateAnnotationViews(annotation);
if (_debug) {
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
System.out.println("select and reveal " + annotation.getType() + "@" + position.getOffset() + ":" + position.getLength());
}
getTextEditor().selectAndReveal(position.getOffset(), position.getLength());
if (editorStatusLine != null) {
editorStatusLine.setMessage(true, null, null);
editorStatusLine.setMessage(false, annotation.getText(), null);
} else {
IStatusLineManager mgr = getStatusLineManager();
if (mgr != null) {
mgr.setErrorMessage(null);
mgr.setMessage(null, annotation.getText());
}
getTextEditor().getSelectionProvider().addSelectionChangedListener(new StatusLineClearer(mgr));
}
}
}
}
use of org.eclipse.ui.texteditor.IEditorStatusLine 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.eclipse.ui.texteditor.IEditorStatusLine 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