public class QuickRenameRefactoring {
public static void renameWodSelection(int offset, ITextViewer htmlViewer, ITextViewer wodViewer, WodParserCache cache) throws Exception {
IWodModel wodModel = cache.getWodEntry().getModel();
if (wodModel != null) {
IWodUnit wodUnit = wodModel.getWodUnitAtIndex(offset);
if (wodUnit != null && wodUnit instanceof IWodElement) {
IWodElement wodElement = (IWodElement) wodUnit;
Position elementNamePosition = wodElement.getElementNamePosition();
if (elementNamePosition != null && elementNamePosition.includes(offset)) {
String elementName = wodElement.getElementName();