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

项目:intellij-ce-playground    文件:InspectionResultsViewComparator.java   
private static int compareEntity(final RefEntity entity, final PsiElement element) {
  if (entity instanceof RefElement) {
    final PsiElement psiElement = ((RefElement)entity).getElement();
    if (psiElement != null && element != null) {
      return PsiUtilCore.compareElementsByPosition(psiElement, element);
    }
    if (element == null) return psiElement == null ? 0 : 1;
  }
  if (element instanceof PsiQualifiedNamedElement) {
    return StringUtil.compare(entity.getQualifiedName(), ((PsiQualifiedNamedElement)element).getQualifiedName(), true);
  }
  if (element instanceof PsiNamedElement) {
    return StringUtil.compare(entity.getName(), ((PsiNamedElement)element).getName(), true);
  }
  return -1;
}
项目:intellij-ce-playground    文件:RefactoringScopeElementListenerProvider.java   
@Override
public RefactoringElementListener getListener(PsiElement element) {
  if (!(element instanceof PsiQualifiedNamedElement) && !(element instanceof PsiDirectory)) return null;

  final PsiFile containingFile = element.getContainingFile();

  RefactoringElementListenerComposite composite = null;
  String oldName = getQualifiedName(element, false);
  if (oldName != null) {
    composite = getComposite(element, containingFile, null, oldName);
  }

  if (element instanceof PsiQualifiedNamedElement) {
    oldName = getQualifiedName(element, true);
    if (oldName != null) {
      composite = getComposite(element, containingFile, composite, oldName);
    }
  }

  return composite;
}
项目:intellij-ce-playground    文件:RefactoringScopeElementListenerProvider.java   
private static String getQualifiedName(PsiElement element, boolean acceptQNames) {
  if (element instanceof PsiQualifiedNamedElement && acceptQNames) {
    return ((PsiQualifiedNamedElement)element).getQualifiedName();
  }
  else {
    final Project project = element.getProject();
    final VirtualFile virtualFile = PsiUtilCore.getVirtualFile(element);
    if (virtualFile == null) {
      return null;
    }
    return FilePatternPackageSet.getRelativePath(virtualFile,
                                                 ProjectRootManager.getInstance(project).getFileIndex(),
                                                 true,
                                                 project.getBaseDir());
  }
}
项目:tools-idea    文件:InspectionResultsViewComparator.java   
private static int compareEntity(final RefEntity entity, final PsiElement element) {
  if (entity instanceof RefElement) {
    final PsiElement psiElement = ((RefElement)entity).getElement();
    if (psiElement != null && element != null) {
      return PsiUtilCore.compareElementsByPosition(psiElement, element);
    }
    if (element == null) return psiElement == null ? 0 : 1;
  }
  if (element instanceof PsiQualifiedNamedElement) {
    return StringUtil.compare(entity.getQualifiedName(), ((PsiQualifiedNamedElement)element).getQualifiedName(), true);
  }
  if (element instanceof PsiNamedElement) {
    return StringUtil.compare(entity.getName(), ((PsiNamedElement)element).getName(), true);
  }
  return -1;
}
项目:tools-idea    文件:RefactoringScopeElementListenerProvider.java   
@Override
public RefactoringElementListener getListener(PsiElement element) {
  final PsiFile containingFile = element.getContainingFile();
  if (!(element instanceof PsiQualifiedNamedElement)) return null;
  final String oldName = ((PsiQualifiedNamedElement)element).getQualifiedName();
  RefactoringElementListenerComposite composite = null;
  for (final NamedScopesHolder holder : NamedScopeManager.getAllNamedScopeHolders(element.getProject())) {
    final NamedScope[] scopes = holder.getEditableScopes();
    for (int i = 0; i < scopes.length; i++) {
      final NamedScope scope = scopes[i];
      final PackageSet packageSet = scope.getValue();
      if (packageSet != null && (containingFile == null || packageSet.contains(containingFile, holder))) {
        composite = traverse(new OldScopeDescriptor(oldName, scope, i, holder), composite, packageSet);
      }
    }
  }
  return composite;
}
项目:consulo    文件:InspectionResultsViewComparator.java   
private static int compareEntity(final RefEntity entity, final PsiElement element) {
  if (entity instanceof RefElement) {
    final PsiElement psiElement = ((RefElement)entity).getElement();
    if (psiElement != null && element != null) {
      return PsiUtilCore.compareElementsByPosition(psiElement, element);
    }
    if (element == null) return psiElement == null ? 0 : 1;
  }
  if (element instanceof PsiQualifiedNamedElement) {
    return StringUtil.compare(entity.getQualifiedName(), ((PsiQualifiedNamedElement)element).getQualifiedName(), true);
  }
  if (element instanceof PsiNamedElement) {
    return StringUtil.compare(entity.getName(), ((PsiNamedElement)element).getName(), true);
  }
  return -1;
}
项目:consulo    文件:RefactoringScopeElementListenerProvider.java   
@Override
public RefactoringElementListener getListener(PsiElement element) {
  final PsiFile containingFile = element.getContainingFile();
  if (!(element instanceof PsiQualifiedNamedElement)) return null;
  final String oldName = ((PsiQualifiedNamedElement)element).getQualifiedName();
  RefactoringElementListenerComposite composite = null;
  for (final NamedScopesHolder holder : NamedScopeManager.getAllNamedScopeHolders(element.getProject())) {
    final NamedScope[] scopes = holder.getEditableScopes();
    for (int i = 0; i < scopes.length; i++) {
      final NamedScope scope = scopes[i];
      final PackageSet packageSet = scope.getValue();
      if (packageSet != null && (containingFile == null || packageSet.contains(containingFile, holder))) {
        composite = traverse(new OldScopeDescriptor(oldName, scope, i, holder), composite, packageSet);
      }
    }
  }
  return composite;
}