コード例 #1
0
 @Override
 @Nullable
 public PsiPackage findPackage(@NotNull String packageName) {
   Query<VirtualFile> dirs = myPackageIndex.getDirsByPackageName(packageName, true);
   if (dirs.findFirst() == null) return null;
   return new PsiPackageImpl(myManager, packageName);
 }
コード例 #2
0
 public JavaFileManagerImpl(Project project) {
   myManager = PsiManagerEx.getInstanceEx(project);
   myPackageIndex = PackageIndex.getInstance(myManager.getProject());
   project
       .getMessageBus()
       .connect()
       .subscribe(
           ProjectTopics.PROJECT_ROOTS,
           new ModuleRootAdapter() {
             @Override
             public void rootsChanged(final ModuleRootEvent event) {
               myNontrivialPackagePrefixes = null;
             }
           });
 }