Java 类com.intellij.psi.PsiJavaParserFacade 实例源码

项目:intellij-ce-playground    文件:PsiAnnotationStubImpl.java   
@Override
public PsiAnnotation getPsiElement() {
  PsiAnnotation annotation = SoftReference.dereference(myParsedFromRepository);
  if (annotation != null) {
    return annotation;
  }

  final String text = getText();
  try {
    PsiJavaParserFacade facade = JavaPsiFacade.getInstance(getProject()).getParserFacade();
    annotation = facade.createAnnotationFromText(text, getPsi());
    myParsedFromRepository = new SoftReference<PsiAnnotation>(annotation);
    return annotation;
  }
  catch (IncorrectOperationException e) {
    LOG.error("Bad annotation in repository!", e);
    return null;
  }
}
项目:consulo-java    文件:AddRequiredModuleFix.java   
@Override
public void invoke(@NotNull Project project, @NotNull PsiFile file, @Nullable Editor editor, @NotNull PsiElement startElement, @NotNull PsiElement endElement)
{
    PsiJavaModule module = (PsiJavaModule) startElement;

    PsiJavaParserFacade parserFacade = JavaPsiFacade.getInstance(project).getParserFacade();
    PsiJavaModule tempModule = parserFacade.createModuleFromText("module " + module.getName() + " { requires " + myRequiredName + "; }");
    Iterable<PsiRequiresStatement> tempModuleRequires = tempModule.getRequires();
    PsiRequiresStatement requiresStatement = tempModuleRequires.iterator().next();

    PsiElement addingPlace = findAddingPlace(module);
    if(addingPlace != null)
    {
        addingPlace.getParent().addAfter(requiresStatement, addingPlace);
    }
}
项目:intellij-ce-playground    文件:PsiImportStatementStubImpl.java   
@Nullable
private PsiJavaCodeReferenceElement createReference() {
  final String refText = getImportReferenceText();
  if (refText == null) return null;

  final PsiJavaParserFacade parserFacade = JavaPsiFacade.getInstance(getProject()).getParserFacade();
  try {
    return parserFacade.createReferenceFromText(refText, getPsi());
  }
  catch (IncorrectOperationException e) {
    return null;
  }
}
项目:tools-idea    文件:PsiImportStatementStubImpl.java   
@Nullable
private PsiJavaCodeReferenceElement createReference() {
  final String refText = getImportReferenceText();
  if (refText == null) return null;

  final PsiJavaParserFacade parserFacade = JavaPsiFacade.getInstance(getProject()).getParserFacade();
  try {
    return parserFacade.createReferenceFromText(refText, getPsi());
  }
  catch (IncorrectOperationException e) {
    return null;
  }
}
项目:consulo-java    文件:PsiImportStatementStubImpl.java   
@Nullable
private PsiJavaCodeReferenceElement createReference() {
  final String refText = getImportReferenceText();
  if (refText == null) return null;

  final PsiJavaParserFacade parserFacade = JavaPsiFacade.getInstance(getProject()).getParserFacade();
  try {
    return parserFacade.createReferenceFromText(refText, getPsi());
  }
  catch (IncorrectOperationException e) {
    return null;
  }
}