use of org.jkiss.dbeaver.ui.editors.text.BaseTextEditor in project dbeaver by dbeaver.
the class AbstractCommentHandler method execute.
public final Object execute(ExecutionEvent event) throws ExecutionException {
BaseTextEditor textEditor = BaseTextEditor.getTextEditor(HandlerUtil.getActiveEditor(event));
if (textEditor != null) {
ICommentsSupport commentsSupport = textEditor.getCommentsSupport();
IDocument document = textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput());
if (document != null && commentsSupport != null) {
// get current text selection
ISelectionProvider provider = textEditor.getSelectionProvider();
if (provider != null) {
ISelection selection = provider.getSelection();
if (selection instanceof ITextSelection) {
ITextSelection textSelection = (ITextSelection) selection;
if (!textSelection.isEmpty()) {
try {
processAction(textEditor.getSelectionProvider(), commentsSupport, document, textSelection);
} catch (BadLocationException e) {
log.warn(e);
}
}
}
}
}
}
return null;
}
use of org.jkiss.dbeaver.ui.editors.text.BaseTextEditor in project dbeaver by dbeaver.
the class LoadTextFileHandler method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
BaseTextEditor editor = BaseTextEditor.getTextEditor(HandlerUtil.getActiveEditor(event));
if (editor == null) {
return null;
}
editor.loadFromExternalFile();
return null;
}
Aggregations