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


Java JavaPsiFacade.findPackage方法代码示例

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


在下文中一共展示了JavaPsiFacade.findPackage方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: resolveImportReference

import com.intellij.psi.JavaPsiFacade; //导入方法依赖的package包/类
@Nullable
public PsiElement resolveImportReference(QualifiedName name, QualifiedNameResolveContext context, boolean withRoots) {
  String fqn = name.toString();
  final JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(context.getProject());
  final PsiPackage aPackage = psiFacade.findPackage(fqn);
  if (aPackage != null) {
    return aPackage;
  }

  Module module = context.getModule();
  if (module != null) {
    final PsiClass aClass = psiFacade.findClass(fqn, module.getModuleWithDependenciesAndLibrariesScope(false));
    if (aClass != null) return aClass;
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:PyJavaImportResolver.java

示例3: createPositionManager

import com.intellij.psi.JavaPsiFacade; //导入方法依赖的package包/类
@Override
public PositionManager createPositionManager(@NotNull final DebugProcess process) {
  AccessToken accessToken = ApplicationManager.getApplication().acquireReadActionLock();
  try {
    JavaPsiFacade facade = JavaPsiFacade.getInstance(process.getProject());
    if (facade.findPackage("com.springsource.loaded") != null || facade.findPackage("org.springsource.loaded") != null) {
      return new SpringLoadedPositionManager(process);
    }
  }
  finally {
    accessToken.finish();
  }

  try {
    // Check spring loaded for remote process
    if (!process.getVirtualMachineProxy().classesByName("com.springsource.loaded.agent.SpringLoadedAgent").isEmpty()
        || !process.getVirtualMachineProxy().classesByName("org.springsource.loaded.agent.SpringLoadedAgent").isEmpty()) {
      return new SpringLoadedPositionManager(process);
    }
  }
  catch (Exception ignored) {
    // Some problem with virtual machine.
  }

  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:SpringLoadedPositionManagerFactory.java

示例4: getDescriptionsDirs

import com.intellij.psi.JavaPsiFacade; //导入方法依赖的package包/类
public static PsiDirectory[] getDescriptionsDirs(Module module,
                                                 DescriptionType descriptionType) {
  final JavaPsiFacade javaPsiFacade = JavaPsiFacade.getInstance(module.getProject());
  final PsiPackage psiPackage = javaPsiFacade.findPackage(descriptionType.getDescriptionFolder());
  if (psiPackage != null) {
    return psiPackage.getDirectories(GlobalSearchScope.moduleWithDependenciesScope(module));
  }
  return PsiDirectory.EMPTY_ARRAY;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:DescriptionCheckerUtil.java

示例5: collectVariants

import com.intellij.psi.JavaPsiFacade; //导入方法依赖的package包/类
public static Collection<LookupElement> collectVariants(@NotNull Module module, @NotNull String text, int offset, @NotNull String prefix) {
  if (prefix.startsWith("-D")) {
    return getSystemPropertiesVariants();
  }

  List<LookupElement> res = new ArrayList<LookupElement>();

  if (text.substring(0, offset).matches("\\s*(grails\\s*)?(?:(:?-D\\S+|dev|prod|test)\\s+)*\\S*")) {
    // Complete command name because command name is not typed.
    for (String completionVariant : getAllTargetNames(module)) {
      res.add(TailTypeDecorator.withTail(LookupElementBuilder.create(completionVariant), TailType.SPACE));
    }
  }
  else {
    // Command name already typed. Try to complete classes and packages names.

    GlobalSearchScope scope = GlobalSearchScope.moduleScope(module);
    JavaPsiFacade facade = JavaPsiFacade.getInstance(module.getProject());
    
    // Complete class names if prefix is a package name with dot at end.
    if (prefix.endsWith(".") && prefix.length() > 1) {
      PsiPackage p = facade.findPackage(prefix.substring(0, prefix.length() - 1));
      if (p != null) {
        for (PsiClass aClass : p.getClasses(scope)) {
          String qualifiedName = aClass.getQualifiedName();
          if (qualifiedName != null) {
            res.add(LookupElementBuilder.create(aClass, qualifiedName));
          }
        }
      }
    }

    PsiPackage defaultPackage = facade.findPackage("");
    if (defaultPackage != null) {
      collectClassesAndPackageNames(res, defaultPackage, scope);
    }
  }

  return res;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:41,代码来源:MvcTargetDialogCompletionUtils.java

示例6: resolvePackage

import com.intellij.psi.JavaPsiFacade; //导入方法依赖的package包/类
private PsiPackage resolvePackage(PsiClass aggregateRoot) {
    String qualifiedName = aggregateRoot.getQualifiedName();
    JavaPsiFacade javaPsiFacade = JavaPsiFacade.getInstance(getProject());
    return javaPsiFacade.findPackage(qualifiedName.substring(0, qualifiedName.lastIndexOf(".")));
}
 
开发者ID:seedstack,项目名称:intellij-plugin,代码行数:6,代码来源:AggregateNode.java


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