Exemplo n.º 1
0
public class JetAnnotationsIndex extends StringStubIndexExtension<KtAnnotationEntry> {
  private static final StubIndexKey<String, KtAnnotationEntry> KEY =
      KotlinIndexUtil.createIndexKey(JetAnnotationsIndex.class);

  private static final JetAnnotationsIndex ourInstance = new JetAnnotationsIndex();

  public static JetAnnotationsIndex getInstance() {
    return ourInstance;
  }

  private JetAnnotationsIndex() {}

  @NotNull
  @Override
  public StubIndexKey<String, KtAnnotationEntry> getKey() {
    return KEY;
  }

  @NotNull
  @Override
  public Collection<KtAnnotationEntry> get(
      @NotNull String s, @NotNull Project project, @NotNull GlobalSearchScope scope) {
    return super.get(s, project, JetSourceFilterScope.kotlinSourcesAndLibraries(scope, project));
  }

  @Override
  public int getVersion() {
    return super.getVersion() + 1;
  }
}
public class JetTopLevelPropertyByPackageIndex extends StringStubIndexExtension<KtProperty> {
  private static final StubIndexKey<String, KtProperty> KEY =
      KotlinIndexUtil.createIndexKey(JetTopLevelPropertyByPackageIndex.class);

  private static final JetTopLevelPropertyByPackageIndex ourInstance =
      new JetTopLevelPropertyByPackageIndex();

  public static JetTopLevelPropertyByPackageIndex getInstance() {
    return ourInstance;
  }

  private JetTopLevelPropertyByPackageIndex() {}

  @NotNull
  @Override
  public StubIndexKey<String, KtProperty> getKey() {
    return KEY;
  }

  @NotNull
  @Override
  public Collection<KtProperty> get(
      @NotNull String fqName, @NotNull Project project, @NotNull GlobalSearchScope scope) {
    return super.get(
        fqName, project, JetSourceFilterScope.kotlinSourcesAndLibraries(scope, project));
  }
}
/** Stores package top level function (both extension and non-extension) full qualified names. */
public class KotlinTopLevelFunctionFqnNameIndex extends StringStubIndexExtension<KtNamedFunction> {
  private static final StubIndexKey<String, KtNamedFunction> KEY =
      KotlinIndexUtil.createIndexKey(KotlinTopLevelFunctionFqnNameIndex.class);

  private static final KotlinTopLevelFunctionFqnNameIndex INSTANCE =
      new KotlinTopLevelFunctionFqnNameIndex();

  @NotNull
  public static KotlinTopLevelFunctionFqnNameIndex getInstance() {
    return INSTANCE;
  }

  private KotlinTopLevelFunctionFqnNameIndex() {}

  @NotNull
  @Override
  public StubIndexKey<String, KtNamedFunction> getKey() {
    return KEY;
  }

  @NotNull
  @Override
  public Collection<KtNamedFunction> get(
      @NotNull String s, @NotNull Project project, @NotNull GlobalSearchScope scope) {
    return super.get(s, project, KotlinSourceFilterScope.sourcesAndLibraries(scope, project));
  }
}
public class KotlinTopLevelPropertyFqnNameIndex extends StringStubIndexExtension<KtProperty> {
  private static final StubIndexKey<String, KtProperty> KEY =
      KotlinIndexUtil.createIndexKey(KotlinTopLevelPropertyFqnNameIndex.class);

  private static final KotlinTopLevelPropertyFqnNameIndex INSTANCE =
      new KotlinTopLevelPropertyFqnNameIndex();

  @NotNull
  public static KotlinTopLevelPropertyFqnNameIndex getInstance() {
    return INSTANCE;
  }

  private KotlinTopLevelPropertyFqnNameIndex() {}

  @NotNull
  @Override
  public StubIndexKey<String, KtProperty> getKey() {
    return KEY;
  }

  @NotNull
  @Override
  public Collection<KtProperty> get(
      @NotNull String s, @NotNull Project project, @NotNull GlobalSearchScope scope) {
    return StubIndex.getElements(KEY, s, project, scope, KtProperty.class);
  }
}
public class JetTopLevelExtensionFunctionShortNameIndex
    extends StringStubIndexExtension<JetNamedFunction> {
  private static final StubIndexKey<String, JetNamedFunction> KEY =
      KotlinIndexUtil.createIndexKey(JetTopLevelExtensionFunctionShortNameIndex.class);

  private static final JetTopLevelExtensionFunctionShortNameIndex instance =
      new JetTopLevelExtensionFunctionShortNameIndex();

  @NotNull
  public static JetTopLevelExtensionFunctionShortNameIndex getInstance() {
    return instance;
  }

  private JetTopLevelExtensionFunctionShortNameIndex() {}

  @NotNull
  @Override
  public StubIndexKey<String, JetNamedFunction> getKey() {
    return KEY;
  }
}