Java 类com.intellij.psi.impl.source.xml.PossiblePrefixReference 实例源码

项目:intellij-ce-playground    文件:SchemaPrefixRenameHandler.java   
@Override
protected VariableInplaceRenamer createRenamer(@NotNull PsiElement elementToRename, Editor editor) {
  PossiblePrefixReference reference = getReference(elementToRename.getContainingFile(), editor);
  if (reference != null) {
    PsiElement prefix = reference.resolve();
    if (prefix instanceof SchemaPrefix) {
      return new VariableInplaceRenamer((PsiNamedElement)prefix, editor) {
        @Override
        protected void addReferenceAtCaret(Collection<PsiReference> refs) {}

        @Override
        protected boolean isReferenceAtCaret(PsiElement selectedElement, PsiReference ref) {
          return false;
        }
      };
    }
  }
  return null;
}
项目:tools-idea    文件:SchemaPrefixRenameHandler.java   
@Override
protected VariableInplaceRenamer createRenamer(@NotNull PsiElement elementToRename, Editor editor) {
  PossiblePrefixReference reference = getReference(elementToRename.getContainingFile(), editor);
  if (reference != null) {
    PsiElement prefix = reference.resolve();
    if (prefix instanceof SchemaPrefix) {
      return new VariableInplaceRenamer((PsiNamedElement)prefix, editor) {
        @Override
        protected void addReferenceAtCaret(Collection<PsiReference> refs) {}

        @Override
        protected boolean isReferenceAtCaret(PsiElement selectedElement, PsiReference ref) {
          return false;
        }
      };
    }
  }
  if (ApplicationManager.getApplication().isUnitTestMode()) {
    System.out.println("Reference: " + reference);
    if (reference != null) {
      System.out.println("Resolved: " + reference.resolve());
    }
  }
  return null;
}
项目:consulo-xml    文件:SchemaPrefixRenameHandler.java   
@Override
protected VariableInplaceRenamer createRenamer(@NotNull PsiElement elementToRename, Editor editor) {
  PossiblePrefixReference reference = getReference(elementToRename.getContainingFile(), editor);
  if (reference != null) {
    PsiElement prefix = reference.resolve();
    if (prefix instanceof SchemaPrefix) {
      return new VariableInplaceRenamer((PsiNamedElement)prefix, editor) {
        @Override
        protected void addReferenceAtCaret(Collection<PsiReference> refs) {}

        @Override
        protected boolean isReferenceAtCaret(PsiElement selectedElement, PsiReference ref) {
          return false;
        }
      };
    }
  }
  if (ApplicationManager.getApplication().isUnitTestMode()) {
    System.out.println("Reference: " + reference);
    if (reference != null) {
      System.out.println("Resolved: " + reference.resolve());
    }
  }
  return null;
}
项目:intellij-ce-playground    文件:XmlRefCountHolder.java   
private void visitOuterLanguageElement(@NotNull final PsiElement element) {
  myHolder.registerOuterLanguageElement(element);
  PsiReference[] references = element.getReferences();
  for (PsiReference reference : references) {
    if (reference instanceof PossiblePrefixReference && ((PossiblePrefixReference)reference).isPrefixReference()) {
      PsiElement resolve = reference.resolve();
      if (resolve instanceof SchemaPrefix) {
        myHolder.addUsedPrefix(((SchemaPrefix)resolve).getName());
      }
    }
  }
}
项目:intellij-ce-playground    文件:SchemaPrefixRenameHandler.java   
@Nullable
private static PossiblePrefixReference getReference(PsiFile file, Editor editor) {
  if (file != null && editor != null) {
    int offset = editor.getCaretModel().getOffset();
    PsiReference reference = file.findReferenceAt(offset);
    if (reference instanceof PossiblePrefixReference) {
      return (PossiblePrefixReference)reference;
    }
  }
  return null;

}
项目:tools-idea    文件:XmlRefCountHolder.java   
private void visitOuterLanguageElement(@NotNull final PsiElement element) {
  myHolder.registerOuterLanguageElement(element);
  PsiReference[] references = element.getReferences();
  for (PsiReference reference : references) {
    if (reference instanceof PossiblePrefixReference && ((PossiblePrefixReference)reference).isPrefixReference()) {
      PsiElement resolve = reference.resolve();
      if (resolve instanceof SchemaPrefix) {
        myHolder.addUsedPrefix(((SchemaPrefix)resolve).getName());
      }
    }
  }
}
项目:tools-idea    文件:SchemaPrefixRenameHandler.java   
@Nullable
private static PossiblePrefixReference getReference(PsiFile file, Editor editor) {
  if (file != null && editor != null) {
    int offset = editor.getCaretModel().getOffset();
    PsiReference reference = file.findReferenceAt(offset);
    if (reference instanceof PossiblePrefixReference) {
      return (PossiblePrefixReference)reference;
    }
  }
  return null;

}
项目:consulo-xml    文件:XmlRefCountHolder.java   
private void visitOuterLanguageElement(@NotNull final PsiElement element) {
  myHolder.registerOuterLanguageElement(element);
  PsiReference[] references = element.getReferences();
  for (PsiReference reference : references) {
    if (reference instanceof PossiblePrefixReference && ((PossiblePrefixReference)reference).isPrefixReference()) {
      PsiElement resolve = reference.resolve();
      if (resolve instanceof SchemaPrefix) {
        myHolder.addUsedPrefix(((SchemaPrefix)resolve).getName());
      }
    }
  }
}
项目:consulo-xml    文件:SchemaPrefixRenameHandler.java   
@Nullable
private static PossiblePrefixReference getReference(PsiFile file, Editor editor) {
  if (file != null && editor != null) {
    int offset = editor.getCaretModel().getOffset();
    PsiReference reference = file.findReferenceAt(offset);
    if (reference instanceof PossiblePrefixReference) {
      return (PossiblePrefixReference)reference;
    }
  }
  return null;

}
项目:intellij-ce-playground    文件:SchemaPrefixRenameHandler.java   
@Override
protected boolean isAvailable(PsiElement element, Editor editor, PsiFile file) {
  PossiblePrefixReference ref = getReference(file, editor);
  return ref != null && ref.resolve() instanceof SchemaPrefix;
}
项目:tools-idea    文件:SchemaPrefixRenameHandler.java   
@Override
protected boolean isAvailable(PsiElement element, Editor editor, PsiFile file) {
  PossiblePrefixReference ref = getReference(file, editor);
  return ref != null && ref.resolve() instanceof SchemaPrefix;
}
项目:consulo-xml    文件:SchemaPrefixRenameHandler.java   
@Override
protected boolean isAvailable(PsiElement element, Editor editor, PsiFile file) {
  PossiblePrefixReference ref = getReference(file, editor);
  return ref != null && ref.resolve() instanceof SchemaPrefix;
}