public void decreaseIndent() { if (currentEditor.getValue().getMediaType().equals(MediaType.XHTML)) { XHTMLCodeEditor xhtmlCodeEditor = (XHTMLCodeEditor) currentEditor.getValue(); XMLTagPair pair = xhtmlCodeEditor.findSurroundingTags(new XHTMLCodeEditor.BlockTagInspector()); if (pair != null) { logger.info("found xml block tag " + pair.getTagName()); String tagAtttributes = xhtmlCodeEditor.getRange(pair.getOpenTagEnd(), pair.getTagAttributesEnd()); Matcher regexMatcher = indentRegex.matcher(tagAtttributes); if (regexMatcher.find()) { String currentIndentStr = regexMatcher.group(2); int currentIndent = NumberUtils.toInt(currentIndentStr, 0); String currentUnit = regexMatcher.group(3); switch (currentUnit) { case "%": case "rem": case "em": currentIndent--; break; case "px": currentIndent = currentIndent - 10; break; } insertStyle("text-indent", currentIndent + currentUnit); } else { insertStyle("text-indent", "-1em"); } } } }