public XmlElementSelectionNavigation(Editor editor, String direction){
PsiElement element = PsiUtil.getElementAtCaret(editor);
CaretModel caretModel = editor.getCaretModel();
XmlTokenImpl token = (XmlTokenImpl) element;
nextRange = getRangeFromToken(token, caretModel, direction);
int startOffset = nextRange.getStartOffset();
caretModel.moveToOffset(startOffset);
SelectionModel selectionModel = editor.getSelectionModel();
selectionModel.setSelection(startOffset, nextRange.getEndOffset());