boolean () { if (getEditor() != null && myCurrentVariableNumber >= 0) { int nextVar = getNextVariableNumber(myCurrentVariableNumber); TextRange nextVarRange = nextVar < 0 ? null : getVariableRange(getTemplate().getVariableNameAt(nextVar)); if (nextVarRange == null) return false; int caretOffset = getEditor().getCaretModel().getOffset(); if (nextVarRange.containsOffset(caretOffset)) return true; TextRange currentVarRange = getVariableRange(getTemplate().getVariableNameAt(myCurrentVariableNumber)); return currentVarRange != null && currentVarRange.getEndOffset() < caretOffset && caretOffset < nextVarRange.getStartOffset(); } return false; }