Merge branch 'modulefileinex-service' of https://github.com/yole/intellij-community into yole-modulefileinex-service

This commit is contained in:
peter
2014-05-23 18:03:44 +02:00
4 changed files with 8 additions and 12 deletions
@@ -42,10 +42,9 @@ import com.intellij.openapi.vfs.pointers.VirtualFilePointerManager;
public class ModuleRootManagerComponent extends ModuleRootManagerImpl implements
PersistentStateComponent<ModuleRootManagerImpl.ModuleRootManagerState> {
public ModuleRootManagerComponent(Module module,
DirectoryIndex directoryIndex,
ProjectRootManagerImpl projectRootManager,
VirtualFilePointerManager filePointerManager) {
super(module, directoryIndex, projectRootManager, filePointerManager);
super(module, projectRootManager, filePointerManager);
}
public static class StorageChooser implements StateStorageChooser<ModuleRootManagerImpl> {
@@ -332,6 +332,8 @@
serviceImplementation="com.intellij.psi.impl.file.impl.ResolveScopeManagerImpl"/>
<projectService serviceInterface="com.intellij.openapi.roots.ProjectFileIndex"
serviceImplementation="com.intellij.openapi.roots.impl.ProjectFileIndexImpl"/>
<moduleService serviceInterface="com.intellij.openapi.roots.ModuleFileIndex"
serviceImplementation="com.intellij.openapi.roots.impl.ModuleFileIndexImpl"/>
<projectService serviceInterface="com.intellij.psi.impl.source.resolve.ResolveCache"
serviceImplementation="com.intellij.psi.impl.source.resolve.ResolveCache"/>
<projectService serviceInterface="com.intellij.openapi.roots.ProjectRootModificationTracker"
@@ -29,8 +29,10 @@ import com.intellij.openapi.module.impl.ModuleEx;
import com.intellij.openapi.module.impl.ModuleScopeProvider;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ModuleExtension;
import com.intellij.openapi.roots.ModuleFileIndex;
import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.openapi.roots.impl.DirectoryIndex;
import com.intellij.openapi.roots.impl.ModuleFileIndexImpl;
import com.intellij.openapi.roots.impl.ModuleRootManagerImpl;
import com.intellij.openapi.roots.impl.ProjectRootManagerImpl;
import com.intellij.openapi.util.Disposer;
@@ -68,7 +70,6 @@ public class CoreModule extends MockComponentManager implements ModuleEx {
final ModuleRootManagerImpl moduleRootManager =
new ModuleRootManagerImpl(this,
DirectoryIndex.getInstance(project),
ProjectRootManagerImpl.getInstanceImpl(project),
VirtualFilePointerManager.getInstance()) {
@Override
@@ -84,6 +85,7 @@ public class CoreModule extends MockComponentManager implements ModuleEx {
});
getPicoContainer().registerComponentInstance(ModuleRootManager.class, moduleRootManager);
getPicoContainer().registerComponentInstance(PathMacroManager.class, new ModulePathMacroManager(PathMacros.getInstance(), this));
getPicoContainer().registerComponentInstance(ModuleFileIndex.class, new ModuleFileIndexImpl(this, DirectoryIndex.getInstance(project)));
myModuleScopeProvider = createModuleScopeProvider();
}
@@ -18,10 +18,7 @@ package com.intellij.openapi.roots.impl;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.module.ModifiableModuleModel;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleComponent;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.module.*;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.roots.*;
@@ -50,7 +47,6 @@ public class ModuleRootManagerImpl extends ModuleRootManager implements ModuleCo
private final ProjectRootManagerImpl myProjectRootManager;
private final VirtualFilePointerManager myFilePointerManager;
private RootModelImpl myRootModel;
private final ModuleFileIndexImpl myFileIndex;
private boolean myIsDisposed = false;
private boolean myLoaded = false;
private boolean isModuleAdded = false;
@@ -59,15 +55,12 @@ public class ModuleRootManagerImpl extends ModuleRootManager implements ModuleCo
public ModuleRootManagerImpl(Module module,
DirectoryIndex directoryIndex,
ProjectRootManagerImpl projectRootManager,
VirtualFilePointerManager filePointerManager) {
myModule = module;
myProjectRootManager = projectRootManager;
myFilePointerManager = filePointerManager;
myFileIndex = new ModuleFileIndexImpl(myModule, directoryIndex);
myRootModel = new RootModelImpl(this, myProjectRootManager, myFilePointerManager);
myOrderRootsCache = new OrderRootsCache(module);
}
@@ -81,7 +74,7 @@ public class ModuleRootManagerImpl extends ModuleRootManager implements ModuleCo
@Override
@NotNull
public ModuleFileIndex getFileIndex() {
return myFileIndex;
return ModuleServiceManager.getService(myModule, ModuleFileIndex.class);
}
@Override