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


Java StubUpdatingIndex类代码示例

本文整理汇总了Java中com.intellij.psi.stubs.StubUpdatingIndex的典型用法代码示例。如果您正苦于以下问题:Java StubUpdatingIndex类的具体用法?Java StubUpdatingIndex怎么用?Java StubUpdatingIndex使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getIndexDirectory

import com.intellij.psi.stubs.StubUpdatingIndex; //导入依赖的package包/类
@NotNull
private static File getIndexDirectory(@NotNull ID<?, ?> indexName, boolean forVersion, String relativePath) {
  final String dirName = indexName.toString().toLowerCase(Locale.US);
  File indexDir;

  if (indexName instanceof StubIndexKey) {
    // store StubIndices under StubUpdating index' root to ensure they are deleted
    // when StubUpdatingIndex version is changed
    indexDir = new File(getIndexDirectory(StubUpdatingIndex.INDEX_ID, false, relativePath), forVersion ? STUB_VERSIONS : dirName);
  } else {
    if (relativePath.length() > 0) relativePath = File.separator + relativePath;
    indexDir = new File(PathManager.getIndexRoot() + relativePath, dirName);
  }
  indexDir.mkdirs();
  return indexDir;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:IndexInfrastructure.java

示例2: getIndexDirectory

import com.intellij.psi.stubs.StubUpdatingIndex; //导入依赖的package包/类
@Nonnull
private static File getIndexDirectory(@Nonnull ID<?, ?> indexName, boolean forVersion, String relativePath) {
  final String dirName = indexName.toString().toLowerCase(Locale.US);
  File indexDir;

  if (indexName instanceof StubIndexKey) {
    // store StubIndices under StubUpdating index' root to ensure they are deleted
    // when StubUpdatingIndex version is changed
    indexDir = new File(getIndexDirectory(StubUpdatingIndex.INDEX_ID, false, relativePath), forVersion ? STUB_VERSIONS : dirName);
  } else {
    if (relativePath.length() > 0) relativePath = File.separator + relativePath;
    indexDir = new File(PathManager.getIndexRoot() + relativePath, dirName);
  }
  indexDir.mkdirs();
  return indexDir;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:IndexInfrastructure.java

示例3: testLargeFile

import com.intellij.psi.stubs.StubUpdatingIndex; //导入依赖的package包/类
public void testLargeFile() throws Exception {
  char[] text = new char[FileUtilRt.LARGE_FOR_CONTENT_LOADING + 42];
  final String clazz = "class Foo { String bar; }";
  for (int i = 0; i < text.length; i++) {
    text[i] = i < clazz.length() ? clazz.charAt(i) : ' ';
  }
  final LightVirtualFile file = new LightVirtualFile("Foo.java", new CharArrayCharSequence(text));
  assertFalse(((FileBasedIndexImpl)FileBasedIndex.getInstance()).isIndexingCandidate(file, StubUpdatingIndex.INDEX_ID));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:FileBasedIndexTest.java

示例4: addImplicitResolveResults

import com.intellij.psi.stubs.StubUpdatingIndex; //导入依赖的package包/类
private void addImplicitResolveResults(String referencedName, ResolveResultList ret) {
  final Project project = myElement.getProject();
  final GlobalSearchScope scope = PyProjectScopeBuilder.excludeSdkTestsScope(project);
  final Collection functions = PyFunctionNameIndex.find(referencedName, project, scope);
  final PsiFile containingFile = myElement.getContainingFile();
  final List<QualifiedName> imports;
  if (containingFile instanceof PyFile) {
    imports = collectImports((PyFile)containingFile);
  }
  else {
    imports = Collections.emptyList();
  }
  for (Object function : functions) {
    if (!(function instanceof PyFunction)) {
      FileBasedIndex.getInstance().scheduleRebuild(StubUpdatingIndex.INDEX_ID,
                                                   new Throwable("found non-function object " + function + " in function list"));
      break;
    }
    PyFunction pyFunction = (PyFunction)function;
    if (pyFunction.getContainingClass() != null) {
      ret.add(new ImplicitResolveResult(pyFunction, getImplicitResultRate(pyFunction, imports)));
    }
  }

  final Collection attributes = PyInstanceAttributeIndex.find(referencedName, project, scope);
  for (Object attribute : attributes) {
    if (!(attribute instanceof PyTargetExpression)) {
      FileBasedIndex.getInstance().scheduleRebuild(StubUpdatingIndex.INDEX_ID,
                                                   new Throwable(
                                                     "found non-target expression object " + attribute + " in target expression list"));
      break;
    }
    ret.add(new ImplicitResolveResult((PyTargetExpression)attribute, getImplicitResultRate((PyTargetExpression)attribute, imports)));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:36,代码来源:PyQualifiedReference.java

示例5: create

import com.intellij.psi.stubs.StubUpdatingIndex; //导入依赖的package包/类
public static Sdk create(final String version, @NotNull final VirtualFile ... additionalRoots) {
  final String mock_path = PythonTestUtil.getTestDataPath() + "/MockSdk" + version + "/";

  String sdkHome = new File(mock_path, "bin/python"+version).getPath();
  SdkType sdkType = PythonSdkType.getInstance();


  final Sdk sdk = new ProjectJdkImpl(MOCK_SDK_NAME + " " + version, sdkType) {
    @Override
    public String getVersionString() {
      return "Python " + version + " Mock SDK";
    }
  };
  final SdkModificator sdkModificator = sdk.getSdkModificator();
  sdkModificator.setHomePath(sdkHome);

  File libPath = new File(mock_path, "Lib");
  if (libPath.exists()) {
    sdkModificator.addRoot(LocalFileSystem.getInstance().refreshAndFindFileByIoFile(libPath), OrderRootType.CLASSES);
  }

  PyUserSkeletonsUtil.addUserSkeletonsRoot(PySdkUpdater.fromSdkModificator(sdk, sdkModificator));

  String mock_stubs_path = mock_path + PythonSdkType.SKELETON_DIR_NAME;
  sdkModificator.addRoot(LocalFileSystem.getInstance().refreshAndFindFileByPath(mock_stubs_path), PythonSdkType.BUILTIN_ROOT_TYPE);

  for (final VirtualFile root : additionalRoots) {
    sdkModificator.addRoot(root, OrderRootType.CLASSES);
  }

  sdkModificator.commitChanges();

  final FileBasedIndex index = FileBasedIndex.getInstance();
  index.requestRebuild(StubUpdatingIndex.INDEX_ID);
  index.requestRebuild(PyModuleNameIndex.NAME);

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

示例6: getIndexDirectory

import com.intellij.psi.stubs.StubUpdatingIndex; //导入依赖的package包/类
private static File getIndexDirectory(ID<?, ?> indexName, boolean forVersion) {
  final String dirName = indexName.toString().toLowerCase(Locale.US);
  // store StubIndices under StubUpdating index' root to ensure they are deleted
  // when StubUpdatingIndex version is changed
  final File indexDir = indexName instanceof StubIndexKey
             ? new File(getIndexRootDir(StubUpdatingIndex.INDEX_ID), forVersion ? STUB_VERSIONS : dirName)
             : new File(PathManager.getIndexRoot(), dirName);
  indexDir.mkdirs();
  return indexDir;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:11,代码来源:IndexInfrastructure.java

示例7: getStubId

import com.intellij.psi.stubs.StubUpdatingIndex; //导入依赖的package包/类
public static ID getStubId(ID<?, ?> indexName, FileType fileType) {
  if (StubUpdatingIndex.INDEX_ID.equals(indexName)) {
    String name = fileType.getName();
    ID id = ID.findByName(name);
    if (id != null) {
      return id;
    }
    else {
      return StubIndexKey.createIndexKey(name);
    }
  }
  else {
    return indexName;
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:16,代码来源:IndexInfrastructure.java

示例8: ensureIndexesUpToDate

import com.intellij.psi.stubs.StubUpdatingIndex; //导入依赖的package包/类
public static void ensureIndexesUpToDate(@NotNull Project project) {
  if (!DumbService.isDumb(project)) {
    FileBasedIndex.getInstance().ensureUpToDate(StubUpdatingIndex.INDEX_ID, project, null);
    FileBasedIndex.getInstance().ensureUpToDate(TodoIndex.NAME, project, null);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:CodeInsightTestFixtureImpl.java

示例9: ensureIndexesUpToDate

import com.intellij.psi.stubs.StubUpdatingIndex; //导入依赖的package包/类
public static void ensureIndexesUpToDate(Project project) {
  if (!DumbService.isDumb(project)) {
    FileBasedIndex.getInstance().ensureUpToDate(StubUpdatingIndex.INDEX_ID, project, null);
    FileBasedIndex.getInstance().ensureUpToDate(TodoIndex.NAME, project, null);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:7,代码来源:CodeInsightTestFixtureImpl.java


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