@Override public PsiElement handleElementRename(String newElementName) throws IncorrectOperationException { final ElementManipulator<PsiElement> manipulator = CachingReference.getManipulator(getElement()); myFileReferenceSet.setElement(manipulator.handleContentChange(getElement(), getRangeInElement(), newElementName)); //Correct ranges int delta = newElementName.length() - myRange.getLength(); myRange = new TextRange(getRangeInElement().getStartOffset(), getRangeInElement().getStartOffset() + newElementName.length()); FileReference[] references = myFileReferenceSet.getAllReferences(); for (int idx = myIndex + 1; idx < references.length; idx++) { references[idx].myRange = references[idx].myRange.shiftRight(delta); } return myFileReferenceSet.getElement(); }
protected PsiElement rename(final String newName) throws IncorrectOperationException { final TextRange range = new TextRange(myFileReferenceSet.getStartInElement(), getRangeInElement().getEndOffset()); PsiElement element = getElement(); try { return CachingReference.getManipulator(element).handleContentChange(element, range, newName); } catch (IncorrectOperationException e) { LOG.error("Cannot rename " + getClass() + " from " + myFileReferenceSet.getClass() + " to " + newName, e); throw e; } }
@Override protected PsiElement rename(final String newName) throws IncorrectOperationException { if (FileUtil.isAbsolutePlatformIndependent(newName)) { return super.rename(newName); } else { PsiElement element = getElement(); return CachingReference.getManipulator(element).handleContentChange(element, getRangeInElement(), newName); } }
protected PsiElement rename(final String newName) throws IncorrectOperationException { final TextRange range = new TextRange(myFileReferenceSet.getStartInElement(), getRangeInElement().getEndOffset()); PsiElement element = getElement(); try { return CachingReference.getManipulator(element).handleContentChange(element, range, newName); } catch (IncorrectOperationException e) { LOG.error("Cannot rename " + getClass() + " from " + myFileReferenceSet.getClass() + " to " + newName); throw e; } }
@Override public PsiElement handleElementRename(String newElementName) throws IncorrectOperationException { final ElementManipulator<PsiElement> manipulator = CachingReference.getManipulator(getElement()); final PsiElement element = manipulator.handleContentChange(getElement(), getRangeInElement(), newElementName); myRange = new TextRange(getRangeInElement().getStartOffset(), getRangeInElement().getStartOffset() + newElementName.length()); return element; }