Search in sources :

Example 61 with Module

use of com.intellij.openapi.module.Module in project intellij-community by JetBrains.

the class XsltRunConfiguration method getEffectiveModule.

@Nullable
public Module getEffectiveModule() {
    //assert myJdkChoice == JdkChoice.FROM_MODULE;
    Module module = myJdkChoice == JdkChoice.FROM_MODULE ? getModule() : null;
    if (module == null && myXsltFile != null) {
        final VirtualFile file = myXsltFile.getFile();
        if (file != null) {
            final ProjectFileIndex index = ProjectRootManager.getInstance(getProject()).getFileIndex();
            module = index.getModuleForFile(file);
        }
    }
    return module;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ProjectFileIndex(com.intellij.openapi.roots.ProjectFileIndex) Module(com.intellij.openapi.module.Module) Nullable(org.jetbrains.annotations.Nullable)

Example 62 with Module

use of com.intellij.openapi.module.Module in project intellij-community by JetBrains.

the class AbstractPythonRunConfiguration method getValidModules.

public static List<Module> getValidModules(Project project) {
    final Module[] modules = ModuleManager.getInstance(project).getModules();
    List<Module> result = Lists.newArrayList();
    for (Module module : modules) {
        if (PythonSdkType.findPythonSdk(module) != null) {
            result.add(module);
        }
    }
    return result;
}
Also used : Module(com.intellij.openapi.module.Module)

Example 63 with Module

use of com.intellij.openapi.module.Module in project intellij-community by JetBrains.

the class PythonCommandLineState method getInterpreterPath.

@Nullable
public static String getInterpreterPath(Project project, PythonRunParams config) {
    String sdkHome = config.getSdkHome();
    if (config.isUseModuleSdk() || StringUtil.isEmpty(sdkHome)) {
        Module module = getModule(project, config);
        Sdk sdk = PythonSdkType.findPythonSdk(module);
        if (sdk != null) {
            sdkHome = sdk.getHomePath();
        }
    }
    return sdkHome;
}
Also used : Sdk(com.intellij.openapi.projectRoots.Sdk) Module(com.intellij.openapi.module.Module) Nullable(org.jetbrains.annotations.Nullable)

Example 64 with Module

use of com.intellij.openapi.module.Module in project intellij-community by JetBrains.

the class PythonCommandLineState method collectPythonPath.

protected static Collection<String> collectPythonPath(Project project, PythonRunParams config, boolean isDebug) {
    final Module module = getModule(project, config);
    final HashSet<String> pythonPath = Sets.newHashSet(collectPythonPath(module, config.shouldAddContentRoots(), config.shouldAddSourceRoots()));
    if (isDebug && PythonSdkFlavor.getFlavor(config.getSdkHome()) instanceof JythonSdkFlavor) {
        //that fixes Jython problem changing sys.argv on execfile, see PY-8164
        pythonPath.add(PythonHelpersLocator.getHelperPath("pycharm"));
        pythonPath.add(PythonHelpersLocator.getHelperPath("pydev"));
    }
    return pythonPath;
}
Also used : JythonSdkFlavor(com.jetbrains.python.sdk.flavors.JythonSdkFlavor) Module(com.intellij.openapi.module.Module)

Example 65 with Module

use of com.intellij.openapi.module.Module in project intellij-community by JetBrains.

the class MavenProjectsManager method setMavenizedModules.

public void setMavenizedModules(Collection<Module> modules, boolean mavenized) {
    ApplicationManager.getApplication().assertWriteAccessAllowed();
    for (Module m : modules) {
        if (m.isDisposed())
            continue;
        if (mavenized) {
            m.setOption(getMavenizedModuleOptionName(), "true");
            // clear external system API options
            // see com.intellij.openapi.externalSystem.service.project.manage.ModuleDataService#setModuleOptions
            m.clearOption(ExternalSystemConstants.EXTERNAL_SYSTEM_ID_KEY);
            m.clearOption(ExternalSystemConstants.LINKED_PROJECT_PATH_KEY);
            m.clearOption(ExternalSystemConstants.ROOT_PROJECT_PATH_KEY);
            m.clearOption(ExternalSystemConstants.EXTERNAL_SYSTEM_MODULE_GROUP_KEY);
            m.clearOption(ExternalSystemConstants.EXTERNAL_SYSTEM_MODULE_VERSION_KEY);
        } else {
            m.clearOption(getMavenizedModuleOptionName());
        }
    }
}
Also used : Module(com.intellij.openapi.module.Module)

Aggregations

Module (com.intellij.openapi.module.Module)1893 VirtualFile (com.intellij.openapi.vfs.VirtualFile)585 Project (com.intellij.openapi.project.Project)379 NotNull (org.jetbrains.annotations.NotNull)330 Nullable (org.jetbrains.annotations.Nullable)267 File (java.io.File)185 PsiFile (com.intellij.psi.PsiFile)147 AndroidFacet (org.jetbrains.android.facet.AndroidFacet)134 ArrayList (java.util.ArrayList)118 GlobalSearchScope (com.intellij.psi.search.GlobalSearchScope)112 Sdk (com.intellij.openapi.projectRoots.Sdk)95 PsiElement (com.intellij.psi.PsiElement)89 PsiDirectory (com.intellij.psi.PsiDirectory)77 ModuleManager (com.intellij.openapi.module.ModuleManager)65 PsiClass (com.intellij.psi.PsiClass)65 IOException (java.io.IOException)61 ModifiableRootModel (com.intellij.openapi.roots.ModifiableRootModel)57 ProjectFileIndex (com.intellij.openapi.roots.ProjectFileIndex)57 List (java.util.List)57 AndroidModuleModel (com.android.tools.idea.gradle.project.model.AndroidModuleModel)51