Search in sources :

Example 1 with DefaultModulesProvider

use of com.intellij.openapi.roots.ui.configuration.DefaultModulesProvider in project intellij-community by JetBrains.

the class ModuleCompilerUtil method getCyclicDependencies.

@NotNull
public static List<Chunk<ModuleSourceSet>> getCyclicDependencies(@NotNull Project project, @NotNull List<Module> modules) {
    Collection<Chunk<ModuleSourceSet>> chunks = computeSourceSetCycles(new DefaultModulesProvider(project));
    final Set<Module> modulesSet = new HashSet<>(modules);
    return ContainerUtil.filter(chunks, chunk -> {
        for (ModuleSourceSet sourceSet : chunk.getNodes()) {
            if (modulesSet.contains(sourceSet.getModule())) {
                return true;
            }
        }
        return false;
    });
}
Also used : DefaultModulesProvider(com.intellij.openapi.roots.ui.configuration.DefaultModulesProvider) Chunk(com.intellij.util.Chunk) Module(com.intellij.openapi.module.Module) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with DefaultModulesProvider

use of com.intellij.openapi.roots.ui.configuration.DefaultModulesProvider in project intellij-community by JetBrains.

the class ModuleOutputPackagingElementBase method findModule.

@Override
@Nullable
public Module findModule(PackagingElementResolvingContext context) {
    if (myModulePointer != null) {
        final Module module = myModulePointer.getModule();
        final ModulesProvider modulesProvider = context.getModulesProvider();
        if (module != null) {
            if (//optimization
            modulesProvider instanceof DefaultModulesProvider || ArrayUtil.contains(module, modulesProvider.getModules())) {
                return module;
            }
        }
        return modulesProvider.getModule(myModulePointer.getModuleName());
    }
    return null;
}
Also used : ModulesProvider(com.intellij.openapi.roots.ui.configuration.ModulesProvider) DefaultModulesProvider(com.intellij.openapi.roots.ui.configuration.DefaultModulesProvider) DefaultModulesProvider(com.intellij.openapi.roots.ui.configuration.DefaultModulesProvider) Module(com.intellij.openapi.module.Module) Nullable(org.jetbrains.annotations.Nullable)

Example 3 with DefaultModulesProvider

use of com.intellij.openapi.roots.ui.configuration.DefaultModulesProvider in project intellij-community by JetBrains.

the class NewModuleAction method createModuleFromWizard.

@Nullable
public Module createModuleFromWizard(Project project, @Nullable Object dataFromContext, AbstractProjectWizard wizard) {
    final ProjectBuilder builder = wizard.getProjectBuilder();
    if (builder instanceof ModuleBuilder) {
        final ModuleBuilder moduleBuilder = (ModuleBuilder) builder;
        if (moduleBuilder.getName() == null) {
            moduleBuilder.setName(wizard.getProjectName());
        }
        if (moduleBuilder.getModuleFilePath() == null) {
            moduleBuilder.setModuleFilePath(wizard.getModuleFilePath());
        }
    }
    if (!builder.validate(project, project)) {
        return null;
    }
    Module module;
    if (builder instanceof ModuleBuilder) {
        module = ((ModuleBuilder) builder).commitModule(project, null);
        if (module != null) {
            processCreatedModule(module, dataFromContext);
        }
        return module;
    } else {
        List<Module> modules = builder.commit(project, null, new DefaultModulesProvider(project));
        if (builder.isOpenProjectSettingsAfter()) {
            ModulesConfigurator.showDialog(project, null, null);
        }
        module = modules == null || modules.isEmpty() ? null : modules.get(0);
    }
    project.save();
    return module;
}
Also used : ProjectBuilder(com.intellij.ide.util.projectWizard.ProjectBuilder) DefaultModulesProvider(com.intellij.openapi.roots.ui.configuration.DefaultModulesProvider) ModuleBuilder(com.intellij.ide.util.projectWizard.ModuleBuilder) Module(com.intellij.openapi.module.Module) Nullable(org.jetbrains.annotations.Nullable)

Example 4 with DefaultModulesProvider

use of com.intellij.openapi.roots.ui.configuration.DefaultModulesProvider in project intellij-community by JetBrains.

the class FrameworkDetectionManager method showSetupFrameworksDialog.

private void showSetupFrameworksDialog(Notification notification) {
    List<? extends DetectedFrameworkDescription> descriptions;
    try {
        descriptions = getValidDetectedFrameworks();
    } catch (IndexNotReadyException e) {
        DumbService.getInstance(myProject).showDumbModeNotification("Information about detected frameworks is not available until indices are built");
        return;
    }
    if (descriptions.isEmpty()) {
        Messages.showInfoMessage(myProject, "No frameworks are detected", "Framework Detection");
        return;
    }
    final ConfigureDetectedFrameworksDialog dialog = new ConfigureDetectedFrameworksDialog(myProject, descriptions);
    if (dialog.showAndGet()) {
        notification.expire();
        List<DetectedFrameworkDescription> selected = dialog.getSelectedFrameworks();
        FrameworkDetectionUtil.setupFrameworks(selected, new PlatformModifiableModelsProvider(), new DefaultModulesProvider(myProject));
        for (DetectedFrameworkDescription description : selected) {
            final int detectorId = FrameworkDetectorRegistry.getInstance().getDetectorId(description.getDetector());
            myDetectedFrameworksData.putExistentFrameworkFiles(detectorId, description.getRelatedFiles());
        }
    }
}
Also used : ConfigureDetectedFrameworksDialog(com.intellij.framework.detection.impl.ui.ConfigureDetectedFrameworksDialog) DefaultModulesProvider(com.intellij.openapi.roots.ui.configuration.DefaultModulesProvider) DetectedFrameworkDescription(com.intellij.framework.detection.DetectedFrameworkDescription) PlatformModifiableModelsProvider(com.intellij.openapi.roots.PlatformModifiableModelsProvider) IndexNotReadyException(com.intellij.openapi.project.IndexNotReadyException)

Example 5 with DefaultModulesProvider

use of com.intellij.openapi.roots.ui.configuration.DefaultModulesProvider in project liferay-ide by liferay.

the class NewLiferayModuleAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent event) {
    Project project = getEventProject(event);
    if (!_isValidWorkspaceLocation(project)) {
        Messages.showErrorDialog("Unable to detect current project as a Liferay workspace", "No Liferay workspace");
        return;
    }
    String defaultPath = null;
    VirtualFile virtualFile = event.getData(CommonDataKeys.VIRTUAL_FILE);
    if ((virtualFile != null) && virtualFile.isDirectory()) {
        defaultPath = virtualFile.getPath();
    }
    NewLiferayModuleWizard wizard = new NewLiferayModuleWizard(project, new DefaultModulesProvider(project), defaultPath);
    if (wizard.showAndGet()) {
        createModuleFromWizard(project, wizard);
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Project(com.intellij.openapi.project.Project) DefaultModulesProvider(com.intellij.openapi.roots.ui.configuration.DefaultModulesProvider)

Aggregations

DefaultModulesProvider (com.intellij.openapi.roots.ui.configuration.DefaultModulesProvider)11 Module (com.intellij.openapi.module.Module)5 ModuleBuilder (com.intellij.ide.util.projectWizard.ModuleBuilder)3 ProjectBuilder (com.intellij.ide.util.projectWizard.ProjectBuilder)3 Project (com.intellij.openapi.project.Project)3 VirtualFile (com.intellij.openapi.vfs.VirtualFile)3 Nullable (org.jetbrains.annotations.Nullable)3 NewProjectWizard (com.intellij.ide.projectWizard.NewProjectWizard)2 ModulesProvider (com.intellij.openapi.roots.ui.configuration.ModulesProvider)2 File (java.io.File)2 DetectedFrameworkDescription (com.intellij.framework.detection.DetectedFrameworkDescription)1 ConfigureDetectedFrameworksDialog (com.intellij.framework.detection.impl.ui.ConfigureDetectedFrameworksDialog)1 LibraryDescriptor (com.intellij.ide.util.importProject.LibraryDescriptor)1 ModuleDescriptor (com.intellij.ide.util.importProject.ModuleDescriptor)1 ProjectDescriptor (com.intellij.ide.util.importProject.ProjectDescriptor)1 ExistingModuleLoader (com.intellij.ide.util.projectWizard.ExistingModuleLoader)1 ModifiableModuleModel (com.intellij.openapi.module.ModifiableModuleModel)1 ModuleConfigurationStateImpl (com.intellij.openapi.module.impl.ModuleConfigurationStateImpl)1 ConfigurationException (com.intellij.openapi.options.ConfigurationException)1 IndexNotReadyException (com.intellij.openapi.project.IndexNotReadyException)1