use of com.intellij.openapi.module.impl.ModuleEx in project intellij-community by JetBrains.
the class CoreModuleManager method createAndLoadModule.
@NotNull
@Override
protected ModuleEx createAndLoadModule(@NotNull String filePath, @NotNull VirtualFile file) throws IOException {
final ModuleEx module = createModule(filePath);
try {
ModuleRootManagerImpl.ModuleRootManagerState state = new ModuleRootManagerImpl.ModuleRootManagerState();
state.readExternal(CoreProjectLoader.loadStorageFile(module, file).get("NewModuleRootManager"));
((ModuleRootManagerImpl) ModuleRootManager.getInstance(module)).loadState(state);
} catch (JDOMException e) {
throw new IOException(e);
}
return module;
}
use of com.intellij.openapi.module.impl.ModuleEx in project intellij-community by JetBrains.
the class ModuleRootManagerComponent method getStateModificationCount.
@Override
public long getStateModificationCount() {
Module module = getModule();
if (!module.isLoaded() || !(module instanceof ModuleEx)) {
return myModificationCount;
}
final long[] result = { myModificationCount };
result[0] += ((ModuleEx) module).getOptionsModificationCount();
final List<String> handledLibraryTables = new SmartList<>();
getRootModel().orderEntries().forEachLibrary(library -> {
LibraryTable table = library.getTable();
if (table instanceof LibraryTableBase && !handledLibraryTables.contains(table.getTableLevel())) {
handledLibraryTables.add(table.getTableLevel());
long count = ((LibraryTableBase) table).getStateModificationCount();
if (count > 0) {
if (Registry.is("store.track.module.root.manager.changes", false)) {
LOG.error("modification count changed due to library " + library.getName() + " change (" + count + "), module " + getModule().getName());
}
}
result[0] += count;
}
return true;
});
return result[0] + myRootModel.getStateModificationCount();
}
use of com.intellij.openapi.module.impl.ModuleEx in project intellij-community by JetBrains.
the class ProjectRootManagerComponent method clearScopesCachesForModules.
@Override
public void clearScopesCachesForModules() {
super.clearScopesCachesForModules();
Module[] modules = ModuleManager.getInstance(myProject).getModules();
for (Module module : modules) {
((ModuleEx) module).clearScopesCache();
}
}
use of com.intellij.openapi.module.impl.ModuleEx in project intellij-community by JetBrains.
the class ModuleScopesTest method testScopeEquality.
public void testScopeEquality() {
Module module = createModule("a.iml", StdModuleTypes.JAVA);
addDependentModule(module, DependencyScope.COMPILE);
addLibrary(module, DependencyScope.COMPILE);
GlobalSearchScope deps = module.getModuleWithDependentsScope();
GlobalSearchScope depsTests = module.getModuleTestsWithDependentsScope();
assertFalse(deps.equals(depsTests));
assertFalse(depsTests.equals(deps));
((ModuleEx) module).clearScopesCache();
GlobalSearchScope deps2 = module.getModuleWithDependentsScope();
GlobalSearchScope depsTests2 = module.getModuleTestsWithDependentsScope();
assertFalse(deps2.equals(depsTests2));
assertFalse(depsTests2.equals(deps2));
assertNotSame(deps, deps2);
assertNotSame(depsTests, depsTests2);
assertEquals(deps, deps2);
assertEquals(depsTests, depsTests2);
}
Aggregations