コード例 #1
0
 private static void recordClassOrObjectByPackage(
     StubElement<? extends JetClassOrObject> stub, IndexSink sink) {
   StubElement parentStub = stub.getParentStub();
   if (parentStub instanceof PsiJetFileStub) {
     PsiJetFileStub jetFileStub = (PsiJetFileStub) parentStub;
     String packageName = jetFileStub.getPackageName();
     if (packageName != null) {
       sink.occurrence(JetClassByPackageIndex.getInstance().getKey(), packageName);
     }
   }
 }
コード例 #2
0
  @Override
  public void indexFile(PsiJetFileStub stub, IndexSink sink) {
    String packageName = stub.getPackageName();
    FqName fqName = new FqName(packageName == null ? "" : packageName);

    sink.occurrence(JetPackageDeclarationIndex.getInstance().getKey(), fqName.getFqName());

    while (true) {
      sink.occurrence(JetAllPackagesIndex.getInstance().getKey(), fqName.getFqName());
      if (fqName.isRoot()) {
        return;
      }
      fqName = fqName.parent();
    }
  }