Java 类com.intellij.psi.impl.light.LightMethod 实例源码

项目:intellij-ce-playground    文件:JavaVetoRenameCondition.java   
@Override
public boolean value(PsiElement element) {
  if (element instanceof LightMethod) {
    PsiClass containingClass = ((LightMethod)element).getContainingClass();
    if (containingClass != null && containingClass.isEnum()) return true;
  }

  if (element instanceof PsiReceiverParameter) {
    return true;
  }

  return element instanceof PsiJavaFile &&
         !FileTypeUtils.isInServerPageFile(element) &&
         !JavaProjectRootsUtil.isOutsideJavaSourceRoot((PsiFile)element) &&
         ((PsiJavaFile) element).getClasses().length > 0;
}
项目:tools-idea    文件:PsiClassImpl.java   
@Nullable
public PsiMethod getValuesMethod() {
  PsiMethod method = myValuesMethod;
  if (method == null && isEnum() && getName() != null) {
    PsiElementFactory elementFactory = JavaPsiFacade.getInstance(getProject()).getElementFactory();
    final PsiMethod valuesMethod = elementFactory.createMethodFromText("public static " + getName() + "[] values() {}", this);
    myValuesMethod = method = new LightMethod(getManager(), valuesMethod, this);
  }
  return method;
}
项目:tools-idea    文件:PsiClassImpl.java   
@Nullable
public PsiMethod getValueOfMethod() {
  PsiMethod method = myValueOfMethod;
  if (method == null && isEnum() && getName() != null) {
    PsiElementFactory elementFactory = JavaPsiFacade.getInstance(getProject()).getElementFactory();
    final PsiMethod valuesMethod = elementFactory.createMethodFromText("public static " + getName() + " valueOf(String name) throws IllegalArgumentException {}", this);
    myValueOfMethod = method = new LightMethod(getManager(), valuesMethod, this);
  }
  return method;
}
项目:intellij-ce-playground    文件:ClassInnerStuffCache.java   
private PsiMethod getSyntheticMethod(String text) {
  PsiElementFactory factory = JavaPsiFacade.getInstance(myClass.getProject()).getElementFactory();
  PsiMethod method = factory.createMethodFromText(text, myClass);
  return new LightMethod(myClass.getManager(), method, myClass);
}