当前位置: 首页>>代码示例>>Java>>正文


Java JavaPsiFacade.findClasses方法代码示例

本文整理汇总了Java中com.intellij.psi.JavaPsiFacade.findClasses方法的典型用法代码示例。如果您正苦于以下问题:Java JavaPsiFacade.findClasses方法的具体用法?Java JavaPsiFacade.findClasses怎么用?Java JavaPsiFacade.findClasses使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.psi.JavaPsiFacade的用法示例。


在下文中一共展示了JavaPsiFacade.findClasses方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: resolveMember

import com.intellij.psi.JavaPsiFacade; //导入方法依赖的package包/类
@Override
public List<? extends RatedResolveResult> resolveMember(@NotNull String name,
                                                        @Nullable PyExpression location,
                                                        @NotNull AccessDirection direction,
                                                        @NotNull PyResolveContext resolveContext) {
  Project project = myPackage.getProject();
  JavaPsiFacade facade = JavaPsiFacade.getInstance(project);
  String childName = myPackage.getQualifiedName() + "." + name;
  GlobalSearchScope scope = getScope(project);
  ResolveResultList result = new ResolveResultList();
  final PsiClass[] classes = facade.findClasses(childName, scope);
  for (PsiClass aClass : classes) {
    result.poke(aClass, RatedResolveResult.RATE_NORMAL);
  }
  final PsiPackage psiPackage = facade.findPackage(childName);
  if (psiPackage != null) {
    result.poke(psiPackage, RatedResolveResult.RATE_NORMAL);
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:PyJavaPackageType.java

示例2: testFindingInternalResourceClasses

import com.intellij.psi.JavaPsiFacade; //导入方法依赖的package包/类
public void testFindingInternalResourceClasses() throws Exception {
  configureMockSdk();
  final JavaPsiFacade facade = JavaPsiFacade.getInstance(getProject());
  PsiClass activity = facade.findClass("android.app.Activity", GlobalSearchScope.allScope(getProject()));
  assertNotNull(activity);

  GlobalSearchScope scope = activity.getNavigationElement().getResolveScope();
  assertInstanceOf(scope, AndroidSdkResolveScopeProvider.MyJdkScope.class);

  assertNotNull(facade.findClass(AndroidPsiElementFinder.INTERNAL_R_CLASS_QNAME, scope));
  assertNotNull(facade.findClass(AndroidPsiElementFinder.INTERNAL_R_CLASS_QNAME + ".string", scope));

  PsiClass[] classes = facade.findClasses(AndroidPsiElementFinder.INTERNAL_R_CLASS_QNAME, scope);
  assertEquals(1, classes.length);
  classes = facade.findClasses(AndroidPsiElementFinder.INTERNAL_R_CLASS_QNAME + ".string", scope);
  assertEquals(1, classes.length);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:AndroidSdkSourcesBrowsingTest.java

示例3: supportSerializationProtocol

import com.intellij.psi.JavaPsiFacade; //导入方法依赖的package包/类
public static boolean supportSerializationProtocol(TestNGConfiguration config) {
  final Project project = config.getProject();
  final GlobalSearchScope scopeToDetermineTestngIn;
  if (config.getPersistantData().getScope() == TestSearchScope.WHOLE_PROJECT) {
    scopeToDetermineTestngIn = GlobalSearchScope.allScope(project);
  }
  else {
    final Module module = config.getConfigurationModule().getModule();
    scopeToDetermineTestngIn = module != null ? GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module) 
                                              : GlobalSearchScope.allScope(project);
  }

  final JavaPsiFacade facade = JavaPsiFacade.getInstance(project);
  final PsiClass aClass = facade.findClass(SerializedMessageSender.class.getName(), scopeToDetermineTestngIn);
  if (aClass == null) return false;

  final PsiClass[] starters = facade.findClasses(RemoteTestNG.class.getName(), scopeToDetermineTestngIn);
  for (PsiClass starter : starters) {
    if (starter.findFieldByName("m_serPort", false) == null) {
      LOG.info("Multiple TestNG versions found");
      return false;
    }
  }
  return Registry.is("testng.serialized.protocol.enabled") && !TestNGVersionChecker.isVersionIncompatible(project, scopeToDetermineTestngIn);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:TestNGRunnableState.java

示例4: removeDuplicatingClasses

import com.intellij.psi.JavaPsiFacade; //导入方法依赖的package包/类
public static void removeDuplicatingClasses(final Module module, @NotNull final String packageName, @NotNull String className,
                                            @Nullable File classFile, String sourceRootPath) {
  if (sourceRootPath == null) {
    return;
  }
  VirtualFile sourceRoot = LocalFileSystem.getInstance().findFileByPath(sourceRootPath);
  if (sourceRoot == null) {
    return;
  }
  final Project project = module.getProject();
  final JavaPsiFacade facade = JavaPsiFacade.getInstance(project);
  final String interfaceQualifiedName = packageName + '.' + className;
  PsiClass[] classes = facade.findClasses(interfaceQualifiedName, GlobalSearchScope.moduleScope(module));
  final ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(project).getFileIndex();
  for (PsiClass c : classes) {
    PsiFile psiFile = c.getContainingFile();
    if (className.equals(FileUtil.getNameWithoutExtension(psiFile.getName()))) {
      VirtualFile virtualFile = psiFile.getVirtualFile();
      if (virtualFile != null && Comparing.equal(projectFileIndex.getSourceRootForFile(virtualFile), sourceRoot)) {
        final String path = virtualFile.getPath();
        final File f = new File(path);

        if (!FileUtil.filesEqual(f, classFile) && f.exists()) {
          if (f.delete()) {
            virtualFile.refresh(true, false);
          }
          else {
            ApplicationManager.getApplication().invokeLater(new Runnable() {
              @Override
              public void run() {
                Messages.showErrorDialog(project, "Can't delete file " + path, CommonBundle.getErrorTitle());
              }
            }, project.getDisposed());
          }
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:40,代码来源:AndroidCompileUtil.java

示例5: findClassesPreferringMyScope

import com.intellij.psi.JavaPsiFacade; //导入方法依赖的package包/类
@NotNull
private PsiClass[] findClassesPreferringMyScope(String className) {
  JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(myProject);
  PsiClass[] result = psiFacade.findClasses(className, mySearchScope);
  return result.length != 0 ? result : psiFacade.findClasses(className, GlobalSearchScope.allScope(myProject));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:ExceptionInfoCache.java


注:本文中的com.intellij.psi.JavaPsiFacade.findClasses方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。