Search in sources :

Example 1 with ModuleBuilder

use of com.intellij.ide.util.projectWizard.ModuleBuilder in project intellij-community by JetBrains.

the class SupportForFrameworksStep method updateStep.

@Override
public void updateStep() {
    ProjectBuilder builder = myContext.getProjectBuilder();
    if (builder instanceof ModuleBuilder) {
        myBuilder.updateFrom((ModuleBuilder) builder);
        ((ModuleBuilder) builder).addModuleConfigurationUpdater(myConfigurationUpdater);
    }
    myFrameworkSupportModel.fireWizardStepUpdated();
}
Also used : ProjectBuilder(com.intellij.ide.util.projectWizard.ProjectBuilder) ModuleBuilder(com.intellij.ide.util.projectWizard.ModuleBuilder)

Example 2 with ModuleBuilder

use of com.intellij.ide.util.projectWizard.ModuleBuilder in project intellij-community by JetBrains.

the class ModulesConfigurator method runModuleWizard.

@Nullable
ProjectBuilder runModuleWizard(Component dialogParent, boolean anImport) {
    AbstractProjectWizard wizard;
    if (anImport) {
        wizard = ImportModuleAction.selectFileAndCreateWizard(myProject, dialogParent);
        if (wizard == null)
            return null;
        if (wizard.getStepCount() == 0) {
            ProjectBuilder builder = wizard.getProjectBuilder();
            Disposer.dispose(wizard.getDisposable());
            return builder;
        }
    } else {
        wizard = new NewProjectWizard(myProject, dialogParent, this);
    }
    if (wizard.showAndGet()) {
        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(myProject, myProject)) {
            return null;
        }
        return wizard.getProjectBuilder();
    }
    return null;
}
Also used : ProjectBuilder(com.intellij.ide.util.projectWizard.ProjectBuilder) ModuleBuilder(com.intellij.ide.util.projectWizard.ModuleBuilder) NewProjectWizard(com.intellij.ide.projectWizard.NewProjectWizard) AbstractProjectWizard(com.intellij.ide.util.newProjectWizard.AbstractProjectWizard) Nullable(org.jetbrains.annotations.Nullable)

Example 3 with ModuleBuilder

use of com.intellij.ide.util.projectWizard.ModuleBuilder 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)

Aggregations

ModuleBuilder (com.intellij.ide.util.projectWizard.ModuleBuilder)3 ProjectBuilder (com.intellij.ide.util.projectWizard.ProjectBuilder)3 Nullable (org.jetbrains.annotations.Nullable)2 NewProjectWizard (com.intellij.ide.projectWizard.NewProjectWizard)1 AbstractProjectWizard (com.intellij.ide.util.newProjectWizard.AbstractProjectWizard)1 Module (com.intellij.openapi.module.Module)1 DefaultModulesProvider (com.intellij.openapi.roots.ui.configuration.DefaultModulesProvider)1