本文整理汇总了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;
}
示例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;
}
示例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));
}
示例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)));
}
}
示例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;
}
示例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;
}
示例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;
}
}
示例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);
}
}
示例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);
}
}