diff --git a/platform/core-api/src/com/intellij/openapi/module/Module.java b/platform/core-api/src/com/intellij/openapi/module/Module.java index cd2d95e584e9..4469e8d0a80a 100644 --- a/platform/core-api/src/com/intellij/openapi/module/Module.java +++ b/platform/core-api/src/com/intellij/openapi/module/Module.java @@ -124,6 +124,9 @@ public interface Module extends ComponentManager, AreaInstance, Disposable { */ GlobalSearchScope getModuleWithDependenciesScope(); + GlobalSearchScope getModuleContentScope(); + GlobalSearchScope getModuleContentWithDependenciesScope(); + GlobalSearchScope getModuleWithDependenciesAndLibrariesScope(boolean includeTests); GlobalSearchScope getModuleWithDependentsScope(); GlobalSearchScope getModuleTestsWithDependentsScope(); diff --git a/platform/lang-impl/src/com/intellij/openapi/module/impl/ModuleImpl.java b/platform/lang-impl/src/com/intellij/openapi/module/impl/ModuleImpl.java index ce1a463bbd08..423711e8b47c 100644 --- a/platform/lang-impl/src/com/intellij/openapi/module/impl/ModuleImpl.java +++ b/platform/lang-impl/src/com/intellij/openapi/module/impl/ModuleImpl.java @@ -253,6 +253,16 @@ public class ModuleImpl extends ComponentManagerImpl implements Module { return getCachedScope(ModuleWithDependenciesScope.COMPILE | ModuleWithDependenciesScope.TESTS | ModuleWithDependenciesScope.MODULES); } + @Override + public GlobalSearchScope getModuleContentScope() { + return getCachedScope(ModuleWithDependenciesScope.CONTENT); + } + + @Override + public GlobalSearchScope getModuleContentWithDependenciesScope() { + return getCachedScope(ModuleWithDependenciesScope.CONTENT | ModuleWithDependenciesScope.MODULES); + } + public GlobalSearchScope getModuleWithDependenciesAndLibrariesScope(boolean includeTests) { return getCachedScope(ModuleWithDependenciesScope.COMPILE | ModuleWithDependenciesScope.MODULES | diff --git a/platform/testFramework/src/com/intellij/mock/MockModule.java b/platform/testFramework/src/com/intellij/mock/MockModule.java index fa3269e740ed..9a0065c2115c 100644 --- a/platform/testFramework/src/com/intellij/mock/MockModule.java +++ b/platform/testFramework/src/com/intellij/mock/MockModule.java @@ -21,7 +21,7 @@ public class MockModule extends MockComponentManager implements Module { this(null, parentDisposable); } - public MockModule(final Project project, @NotNull Disposable parentDisposable) { + public MockModule(@Nullable final Project project, @NotNull Disposable parentDisposable) { super(project == null ? null : project.getPicoContainer(), parentDisposable); myProject = project; } @@ -69,6 +69,16 @@ public class MockModule extends MockComponentManager implements Module { return new MockGlobalSearchScope(); } + @Override + public GlobalSearchScope getModuleContentWithDependenciesScope() { + throw new UnsupportedOperationException("Method getModuleContentWithDependenciesScope is not yet implemented in " + getClass().getName()); + } + + @Override + public GlobalSearchScope getModuleContentScope() { + throw new UnsupportedOperationException("Method getModuleContentScope is not yet implemented in " + getClass().getName()); + } + @Override public GlobalSearchScope getModuleWithDependentsScope() { throw new UnsupportedOperationException("Method getModuleWithDependentsScope is not yet implemented in " + getClass().getName()); diff --git a/plugins/devkit/src/inspections/quickfix/RegisterInspectionFix.java b/plugins/devkit/src/inspections/quickfix/RegisterInspectionFix.java index 1edffbc87f8e..15e3e9a891fe 100644 --- a/plugins/devkit/src/inspections/quickfix/RegisterInspectionFix.java +++ b/plugins/devkit/src/inspections/quickfix/RegisterInspectionFix.java @@ -25,8 +25,6 @@ import com.intellij.openapi.editor.Editor; import com.intellij.openapi.extensions.ExtensionPointName; import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleUtil; -import com.intellij.openapi.module.impl.ModuleImpl; -import com.intellij.openapi.module.impl.scopes.ModuleWithDependenciesScope; import com.intellij.openapi.project.Project; import com.intellij.openapi.roots.ProjectRootManager; import com.intellij.openapi.ui.popup.JBPopupFactory; @@ -87,7 +85,7 @@ class RegisterInspectionFix implements IntentionAction { Module module = ModuleUtil.findModuleForPsiElement(file); assert module != null; List> elements = - DomService.getInstance().getFileElements(IdeaPlugin.class, project, ((ModuleImpl)module).getCachedScope(ModuleWithDependenciesScope.CONTENT | ModuleWithDependenciesScope.MODULES)); + DomService.getInstance().getFileElements(IdeaPlugin.class, project, module.getModuleContentWithDependenciesScope()); elements = ContainerUtil.filter(elements, new Condition>() { @Override