mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 06:05:01 +07:00
register JavaResolveCache in JavaCoreEnvironment
This commit is contained in:
@@ -37,6 +37,7 @@ import com.intellij.psi.impl.compiled.ClassFileStubBuilder;
|
||||
import com.intellij.psi.impl.compiled.ClsStubBuilderFactory;
|
||||
import com.intellij.psi.impl.compiled.DefaultClsStubBuilderFactory;
|
||||
import com.intellij.psi.impl.file.PsiPackageImplementationHelper;
|
||||
import com.intellij.psi.impl.source.resolve.JavaResolveCache;
|
||||
import com.intellij.psi.impl.source.resolve.PsiResolveHelperImpl;
|
||||
import com.intellij.psi.impl.source.tree.CoreJavaASTFactory;
|
||||
import com.intellij.psi.stubs.BinaryFileStubBuilders;
|
||||
@@ -80,7 +81,8 @@ public class JavaCoreEnvironment extends CoreEnvironment {
|
||||
myProject.registerService(PsiResolveHelper.class, new PsiResolveHelperImpl(myPsiManager));
|
||||
myProject.registerService(LanguageLevelProjectExtension.class, new CoreLanguageLevelProjectExtension());
|
||||
myProject.registerService(PackageIndex.class, myFileManager);
|
||||
|
||||
myProject.registerService(JavaResolveCache.class, new JavaResolveCache(null));
|
||||
|
||||
myApplication.registerService(EmptySubstitutor.class, new EmptySubstitutorImpl());
|
||||
myApplication.registerService(JavaDirectoryService.class, new CoreJavaDirectoryService());
|
||||
}
|
||||
|
||||
@@ -70,16 +70,18 @@ public class JavaResolveCache {
|
||||
myVarToConstValueMapPhysical = new ConcurrentWeakHashMap<PsiVariable, Object>();
|
||||
myVarToConstValueMapNonPhysical = new ConcurrentWeakHashMap<PsiVariable, Object>();
|
||||
|
||||
messageBus.connect().subscribe(PsiManagerImpl.ANY_PSI_CHANGE_TOPIC, new AnyPsiChangeListener() {
|
||||
@Override
|
||||
public void beforePsiChanged(boolean isPhysical) {
|
||||
clearCaches(isPhysical);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPsiChanged(boolean isPhysical) {
|
||||
}
|
||||
});
|
||||
if (messageBus != null) {
|
||||
messageBus.connect().subscribe(PsiManagerImpl.ANY_PSI_CHANGE_TOPIC, new AnyPsiChangeListener() {
|
||||
@Override
|
||||
public void beforePsiChanged(boolean isPhysical) {
|
||||
clearCaches(isPhysical);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPsiChanged(boolean isPhysical) {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void clearCaches(boolean isPhysical) {
|
||||
|
||||
Reference in New Issue
Block a user