public JavaCoreProjectEnvironment(Disposable parentDisposable, CoreApplicationEnvironment applicationEnvironment) { super(parentDisposable, applicationEnvironment); myProject.registerService(PsiElementFactory.class, new PsiElementFactoryImpl(myPsiManager)); myProject.registerService(JavaPsiImplementationHelper.class, createJavaPsiImplementationHelper()); myProject.registerService(PsiResolveHelper.class, new PsiResolveHelperImpl(myPsiManager)); myProject.registerService(LanguageLevelProjectExtension.class, new CoreLanguageLevelProjectExtension()); myProject.registerService(JavaResolveCache.class, new JavaResolveCache(myMessageBus)); myProject.registerService(JavaCodeStyleSettingsFacade.class, new CoreJavaCodeStyleSettingsFacade()); myProject.registerService(JavaCodeStyleManager.class, new CoreJavaCodeStyleManager()); myPackageIndex = createCorePackageIndex(); myProject.registerService(PackageIndex.class, myPackageIndex); myFileManager = createCoreFileManager(); myProject.registerService(JavaFileManager.class, myFileManager); JavaPsiFacadeImpl javaPsiFacade = new JavaPsiFacadeImpl(myProject, myPsiManager, myFileManager, myMessageBus); myProject.registerService(JavaPsiFacade.class, javaPsiFacade); }
public JavaCoreProjectEnvironment(Disposable parentDisposable, CoreApplicationEnvironment applicationEnvironment) { super(parentDisposable, applicationEnvironment); myProject.registerService(PsiElementFactory.class, new PsiElementFactoryImpl(myPsiManager)); myProject.registerService(JavaPsiImplementationHelper.class, createJavaPsiImplementationHelper()); myProject.registerService(PsiResolveHelper.class, new PsiResolveHelperImpl(myPsiManager)); myProject.registerService(LanguageLevelProjectExtension.class, new CoreLanguageLevelProjectExtension()); myProject.registerService(JavaResolveCache.class, new JavaResolveCache(myMessageBus)); myProject.registerService(JavaCodeStyleSettingsFacade.class, new CoreJavaCodeStyleSettingsFacade()); myProject.registerService(JavaCodeStyleManager.class, new CoreJavaCodeStyleManager()); registerProjectExtensionPoint(PsiElementFinder.EP_NAME, PsiElementFinder.class); myPackageIndex = createCorePackageIndex(); myProject.registerService(PackageIndex.class, myPackageIndex); myFileManager = createCoreFileManager(); myProject.registerService(JavaFileManager.class, myFileManager); JavaPsiFacadeImpl javaPsiFacade = new JavaPsiFacadeImpl(myProject, myPsiManager, myFileManager, myMessageBus); registerProjectComponent(JavaPsiFacade.class, javaPsiFacade); myProject.registerService(JavaPsiFacade.class, javaPsiFacade); }
private PsiClass getPsiClassAndPreventRecursionCalls(@NotNull String parentName, @NotNull GlobalSearchScope scope) { final JavaFileManager javaFileManager = getServiceManager(scope); if (null == javaFileManager) { return null; } final PsiClass foundPsiClass; try { final boolean firstInvocation = recursionPrevention.get().add(parentName); if (firstInvocation) { foundPsiClass = javaFileManager.findClass(parentName, scope); } else { foundPsiClass = null; } } finally { recursionPrevention.get().remove(parentName); } return foundPsiClass; }
public JavaCoreProjectEnvironment(Disposable parentDisposable, CoreApplicationEnvironment applicationEnvironment) { super(parentDisposable, applicationEnvironment); myProject.registerService(PsiElementFactory.class, new PsiElementFactoryImpl(myPsiManager)); myProject.registerService(JavaPsiImplementationHelper.class, createJavaPsiImplementationHelper()); myProject.registerService(PsiResolveHelper.class, new PsiResolveHelperImpl(myPsiManager)); myProject.registerService(JavaResolveCache.class, new JavaResolveCache(myMessageBus)); myProject.registerService(JavaCodeStyleSettingsFacade.class, new CoreJavaCodeStyleSettingsFacade()); myProject.registerService(JavaCodeStyleManager.class, new CoreJavaCodeStyleManager()); registerProjectExtensionPoint(PsiElementFinder.EP_NAME, PsiElementFinder.class); /* myPackageIndex = createCorePackageIndex(); myProject.registerService(PackageIndex.class, myPackageIndex); */ myFileManager = createCoreFileManager(); myProject.registerService(JavaFileManager.class, myFileManager); PsiPackageManager manager = new PsiPackageManagerImpl(getProject(), DirectoryIndex.getInstance(getProject())); myProject.registerService(PsiPackageManager.class, manager); JavaPsiFacadeImpl javaPsiFacade = new JavaPsiFacadeImpl(myProject, manager); registerProjectComponent(JavaPsiFacade.class, javaPsiFacade); myProject.registerService(JavaPsiFacade.class, javaPsiFacade); }
public JavaPsiFacadeImpl(Project project, PsiManager psiManager, JavaFileManager javaFileManager, MessageBus bus) { myProject = project; myFileManager = javaFileManager; myConstantEvaluationHelper = new PsiConstantEvaluationHelperImpl(); final PsiModificationTracker modificationTracker = psiManager.getModificationTracker(); if (bus != null) { bus.connect().subscribe(PsiModificationTracker.TOPIC, new PsiModificationTracker.Listener() { private long lastTimeSeen = -1L; @Override public void modificationCountChanged() { myClassCache.clear(); final long now = modificationTracker.getJavaStructureModificationCount(); if (lastTimeSeen != now) { lastTimeSeen = now; myPackageCache.clear(); } } }); } DummyHolderFactory.setFactory(new JavaDummyHolderFactory()); }
public JavaPsiFacadeImpl(Project project, PsiManagerImpl psiManager, JavaFileManager javaFileManager, MessageBus bus) { myProject = project; myFileManager = javaFileManager; myNameHelper = new PsiNameHelperImpl(this); myConstantEvaluationHelper = new PsiConstantEvaluationHelperImpl(); final PsiModificationTracker modificationTracker = psiManager.getModificationTracker(); if (bus != null) { bus.connect().subscribe(PsiModificationTracker.TOPIC, new PsiModificationTracker.Listener() { private long lastTimeSeen = -1L; @Override public void modificationCountChanged() { final long now = modificationTracker.getJavaStructureModificationCount(); if (lastTimeSeen != now) { lastTimeSeen = now; myPackageCache = null; } } }); } DummyHolderFactory.setFactory(new JavaDummyHolderFactory()); JavaElementType.ANNOTATION.getIndex(); // Initialize stubs. }
JavaFileManager getServiceManager(GlobalSearchScope scope) { final Project project = scope.getProject(); if (null == project) { return null; } return ServiceManager.getService(project, JavaFileManager.class); }
@Override public boolean isPartOfPackagePrefix(@NotNull String packageName) { final Collection<String> packagePrefixes = JavaFileManager.getInstance(myProject).getNonTrivialPackagePrefixes(); for(final String subpackageName : packagePrefixes) { if(isSubpackageOf(subpackageName, packageName)) { return true; } } return false; }
public static JavaFileManager getFileManager(Project project) { return new JavaFileManagerImpl(project); }
public PsiElementFinderImpl(Project project, JavaFileManager javaFileManager) { myProject = project; myFileManager = javaFileManager; }
protected JavaFileManager createCoreFileManager() { return new CoreJavaFileManager(myPsiManager); }
@Override public PsiClass findClass(@NotNull String qualifiedName, @NotNull GlobalSearchScope scope) { return JavaFileManager.getInstance(myProject).findClass(qualifiedName, scope); }
@Override @NotNull public PsiClass[] findClasses(@NotNull String qualifiedName, @NotNull GlobalSearchScope scope) { return JavaFileManager.getInstance(myProject).findClasses(qualifiedName, scope); }
private static Collection<PsiJavaModule> findModules(PsiFile file, String moduleName, boolean incompleteCode) { Project project = file.getProject(); GlobalSearchScope scope = incompleteCode ? GlobalSearchScope.allScope(project) : file.getResolveScope(); return JavaFileManager.getInstance(project).findModules(moduleName, scope); }