Java 类com.intellij.psi.impl.source.resolve.reference.impl.CachingReference 实例源码

项目:intellij-ce-playground    文件:FileReference.java   
@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();
}
项目:intellij-ce-playground    文件:FileReference.java   
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;
  }
}
项目:intellij-ce-playground    文件:FileReferenceWithOneContext.java   
@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);
  }
}
项目:tools-idea    文件:FileReference.java   
@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();
}
项目:tools-idea    文件:FileReference.java   
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;
  }
}
项目:consulo    文件:FileReference.java   
@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();
}
项目:consulo    文件:FileReference.java   
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;
  }
}
项目:consulo-java    文件:JavaClassReference.java   
@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;
}