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

项目:intellij-ce-playground    文件:JavaPsiFacadeImpl.java   
@Override
public boolean arePackagesTheSame(@NotNull PsiElement element1, @NotNull PsiElement element2) {
  PsiFile file1 = FileContextUtil.getContextFile(element1);
  PsiFile file2 = FileContextUtil.getContextFile(element2);
  if (Comparing.equal(file1, file2)) return true;
  if (file1 instanceof JavaDummyHolder && file2 instanceof JavaDummyHolder) return true;
  if (file1 instanceof JavaDummyHolder || file2 instanceof JavaDummyHolder) {
    JavaDummyHolder dummyHolder = (JavaDummyHolder) (file1 instanceof JavaDummyHolder ? file1 : file2);
    PsiElement other = file1 instanceof JavaDummyHolder ? file2 : file1;
    return dummyHolder.isSamePackage(other);
  }
  if (!(file1 instanceof PsiClassOwner)) return false;
  if (!(file2 instanceof PsiClassOwner)) return false;
  String package1 = ((PsiClassOwner) file1).getPackageName();
  String package2 = ((PsiClassOwner) file2).getPackageName();
  return Comparing.equal(package1, package2);
}
项目:tools-idea    文件:JavaPsiFacadeImpl.java   
@Override
public boolean arePackagesTheSame(@NotNull PsiElement element1, @NotNull PsiElement element2) {
  PsiFile file1 = FileContextUtil.getContextFile(element1);
  PsiFile file2 = FileContextUtil.getContextFile(element2);
  if (Comparing.equal(file1, file2)) return true;
  if (file1 instanceof JavaDummyHolder && file2 instanceof JavaDummyHolder) return true;
  if (file1 instanceof JavaDummyHolder || file2 instanceof JavaDummyHolder) {
    JavaDummyHolder dummyHolder = (JavaDummyHolder) (file1 instanceof JavaDummyHolder ? file1 : file2);
    PsiElement other = file1 instanceof JavaDummyHolder ? file2 : file1;
    return dummyHolder.isSamePackage(other);
  }
  if (!(file1 instanceof PsiClassOwner)) return false;
  if (!(file2 instanceof PsiClassOwner)) return false;
  String package1 = ((PsiClassOwner) file1).getPackageName();
  String package2 = ((PsiClassOwner) file2).getPackageName();
  return Comparing.equal(package1, package2);
}
项目:intellij-ce-playground    文件:JavaPsiFacadeImpl.java   
@Override
public boolean isInPackage(@NotNull PsiElement element, @NotNull PsiPackage aPackage) {
  final PsiFile file = FileContextUtil.getContextFile(element);
  if (file instanceof JavaDummyHolder) {
    return ((JavaDummyHolder) file).isInPackage(aPackage);
  }
  if (file instanceof PsiJavaFile) {
    final String packageName = ((PsiJavaFile) file).getPackageName();
    return packageName.equals(aPackage.getQualifiedName());
  }
  return false;
}
项目:intellij-ce-playground    文件:PsiLocalVariableImpl.java   
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state, PsiElement lastParent, @NotNull PsiElement place) {
  if (lastParent == null) return true;
  if (lastParent.getContext() instanceof JavaDummyHolder) {
    return processor.execute(this, state);
  }

  if (lastParent.getParent() != this) return true;
  final ASTNode lastParentTree = SourceTreeToPsiMap.psiElementToTree(lastParent);

  return getChildRole(lastParentTree) != ChildRole.INITIALIZER ||
         processor.execute(this, state);
}
项目:tools-idea    文件:JavaPsiFacadeImpl.java   
@Override
public boolean isInPackage(@NotNull PsiElement element, @NotNull PsiPackage aPackage) {
  final PsiFile file = FileContextUtil.getContextFile(element);
  if (file instanceof JavaDummyHolder) {
    return ((JavaDummyHolder) file).isInPackage(aPackage);
  }
  if (file instanceof PsiJavaFile) {
    final String packageName = ((PsiJavaFile) file).getPackageName();
    return packageName.equals(aPackage.getQualifiedName());
  }
  return false;
}
项目:tools-idea    文件:PsiLocalVariableImpl.java   
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state, PsiElement lastParent, @NotNull PsiElement place) {
  if (lastParent == null) return true;
  if (lastParent.getContext() instanceof JavaDummyHolder) {
    return processor.execute(this, state);
  }

  if (lastParent.getParent() != this) return true;
  final ASTNode lastParentTree = SourceTreeToPsiMap.psiElementToTree(lastParent);

  return getChildRole(lastParentTree) != ChildRole.INITIALIZER ||
         processor.execute(this, state);
}
项目:consulo-java    文件:JavaPsiFacadeImpl.java   
@Override
public boolean isInPackage(@NotNull PsiElement element, @NotNull PsiJavaPackage aPackage)
{
    final PsiFile file = FileContextUtil.getContextFile(element);
    if(file instanceof JavaDummyHolder)
    {
        return ((JavaDummyHolder) file).isInPackage(aPackage);
    }
    if(file instanceof PsiJavaFile)
    {
        final String packageName = ((PsiJavaFile) file).getPackageName();
        return packageName.equals(aPackage.getQualifiedName());
    }
    return false;
}
项目:consulo-java    文件:JavaPsiFacadeImpl.java   
@Override
public boolean arePackagesTheSame(@NotNull PsiElement element1, @NotNull PsiElement element2)
{
    PsiFile file1 = FileContextUtil.getContextFile(element1);
    PsiFile file2 = FileContextUtil.getContextFile(element2);
    if(Comparing.equal(file1, file2))
    {
        return true;
    }
    if(file1 instanceof JavaDummyHolder && file2 instanceof JavaDummyHolder)
    {
        return true;
    }
    if(file1 instanceof JavaDummyHolder || file2 instanceof JavaDummyHolder)
    {
        JavaDummyHolder dummyHolder = (JavaDummyHolder) (file1 instanceof JavaDummyHolder ? file1 : file2);
        PsiElement other = file1 instanceof JavaDummyHolder ? file2 : file1;
        return dummyHolder.isSamePackage(other);
    }
    if(!(file1 instanceof PsiClassOwner))
    {
        return false;
    }
    if(!(file2 instanceof PsiClassOwner))
    {
        return false;
    }
    String package1 = ((PsiClassOwner) file1).getPackageName();
    String package2 = ((PsiClassOwner) file2).getPackageName();
    return Comparing.equal(package1, package2);
}
项目:consulo-java    文件:PsiLocalVariableImpl.java   
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state, PsiElement lastParent, @NotNull PsiElement place) {
  if (lastParent == null) return true;
  if (lastParent.getContext() instanceof JavaDummyHolder) {
    return processor.execute(this, state);
  }

  if (lastParent.getParent() != this) return true;
  final ASTNode lastParentTree = SourceTreeToPsiMap.psiElementToTree(lastParent);

  return getChildRole(lastParentTree) != ChildRole.INITIALIZER ||
         processor.execute(this, state);
}