@Override
        public void run() {
            final DBPPreferenceStore store = editor.getActivePreferenceStore();
            if (!store.getBoolean(SQLPreferenceConstants.SMART_WORD_ITERATOR)) {
                super.run();
                return;
            }

            final ISourceViewer viewer = getSourceViewer();
            final IDocument document = viewer.getDocument();
            try {
                wordIterator.setText((CharacterIterator) new SQLDocumentCharacterIterator(document));
                int position = widgetOffset2ModelOffset(viewer.getTextWidget().getCaretOffset());
                if (position == -1)
                    return;

                int previous = findPreviousPosition(position);
                if (editor.isBlockSelectionModeEnabled() && document.getLineOfOffset(previous) != document.getLineOfOffset(position)) {
                    super.run(); // may navigate into virtual white space
                } else if (previous != BreakIterator.DONE) {
                    setCaretPosition(previous);
                    getTextWidget().showSelection();
                    fireSelectionChanged();
                }
            } catch (BadLocationException e) {
                log.debug(e);
            }

        }
Finds the next position after the given position.

@param position the current position
@return the next position
plugins/org.jkiss.dbeaver.ui.editors.sql/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditorCustomActions.java