boolean renameRefRule = t.type == ATEStringTemplateSyntaxLexer.TOKEN_REFERENCE ||
t.type == ATEStringTemplateSyntaxLexer.TOKEN_DECL;
if (renameRefRule) {
for(int index = tokens.size()-1; index>0; index--) {
ATEToken token = tokens.get(index);
if(!token.getAttribute().equals(attr)) continue;
if(token.type == ATEStringTemplateSyntaxLexer.TOKEN_REFERENCE ||
token.type == ATEStringTemplateSyntaxLexer.TOKEN_DECL) {
mutator.replace(token.getStartIndex(), token.getEndIndex(), name);
}
}
} else if (isArg) {
ElementTemplateRule rule = getRuleAtPosition(window.getCaretPosition());
for(int index = tokens.size()-1; index>0; index--) {
ATEToken token = tokens.get(index);
if(!token.getAttribute().equals(attr)) continue;
if (rule.containsIndex(token.start)) {
if (token.type == ATEStringTemplateSyntaxLexer.TOKEN_ARG_DECL ||
token.type == ATEStringTemplateSyntaxLexer.TOKEN_ARG_REFERENCE) {
mutator.replace(token.getStartIndex(), token.getEndIndex(), name);
}
}
}
} else {
mutator.replace(t.getStartIndex(), t.getEndIndex(), name);