if(s != null && s.length() > 0) {
List<ElementRule> rules = window.editorRules.getSelectedRules();
if(!rules.isEmpty()) {
window.beginGroupChange("Group");
ElementRule firstRule = rules.get(0);
ElementRule lastRule = rules.get(rules.size()-1);
int end = lastRule.getEndIndex();
window.getTextEditor().insertText(end+1, "\n"+ GrammarSyntaxParser.END_GROUP+"\n");
int start = firstRule.getStartIndex();
window.getTextEditor().insertText(start-1, "\n"+ GrammarSyntaxParser.BEGIN_GROUP+s+"\n");