Search in sources :

Example 1 with NewProjectWizard

use of com.intellij.ide.projectWizard.NewProjectWizard 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 2 with NewProjectWizard

use of com.intellij.ide.projectWizard.NewProjectWizard in project moe-ide-integration by multi-os-engine.

the class MOENewProjectAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent anActionEvent) {
    NewProjectWizard wizard = new NewProjectWizard(null, ModulesProvider.EMPTY_MODULES_PROVIDER, null);
    NewProjectUtil.createNewProject(getEventProject(anActionEvent), wizard);
}
Also used : NewProjectWizard(com.intellij.ide.projectWizard.NewProjectWizard)

Example 3 with NewProjectWizard

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

the class NewModuleAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    final Project project = getEventProject(e);
    if (project == null) {
        return;
    }
    Object dataFromContext = prepareDataFromContext(e);
    String defaultPath = null;
    final VirtualFile virtualFile = e.getData(CommonDataKeys.VIRTUAL_FILE);
    if (virtualFile != null && virtualFile.isDirectory()) {
        defaultPath = virtualFile.getPath();
    }
    NewProjectWizard wizard = new NewProjectWizard(project, new DefaultModulesProvider(project), defaultPath);
    if (wizard.showAndGet()) {
        createModuleFromWizard(project, dataFromContext, wizard);
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Project(com.intellij.openapi.project.Project) DefaultModulesProvider(com.intellij.openapi.roots.ui.configuration.DefaultModulesProvider) NewProjectWizard(com.intellij.ide.projectWizard.NewProjectWizard)

Example 4 with NewProjectWizard

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

the class NewProjectAction method actionPerformed.

public void actionPerformed(AnActionEvent e) {
    NewProjectWizard wizard = new NewProjectWizard(null, ModulesProvider.EMPTY_MODULES_PROVIDER, null);
    NewProjectUtil.createNewProject(getEventProject(e), wizard);
}
Also used : NewProjectWizard(com.intellij.ide.projectWizard.NewProjectWizard)

Example 5 with NewProjectWizard

use of com.intellij.ide.projectWizard.NewProjectWizard in project moe-ide-integration by multi-os-engine.

the class MOENewModuleAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    Project project = getEventProject(e);
    if (project != null) {
        Object dataFromContext = this.prepareDataFromContext(e);
        // String defaultPath = null;
        // VirtualFile virtualFile = (VirtualFile)e.getData(CommonDataKeys.VIRTUAL_FILE);
        // if(virtualFile != null && virtualFile.isDirectory()) {
        // defaultPath = virtualFile.getPath();
        // }
        // 
        // NewProjectWizard wizard = new NewProjectWizard(project, new DefaultModulesProvider(project), defaultPath);
        // TODO: temp hack for adding by force a module that will be changed with correct one.
        // TODO: didn't find alternative way to fix incorrect adding MOE module in AS 2.1 and AS 2.0
        String tempModuleDir = project.getBasePath() + File.separator + "temp";
        NewProjectWizard wizard = new NewProjectWizard(project, new DefaultModulesProvider(project), tempModuleDir);
        if (wizard.showAndGet()) {
            this.createModuleFromWizard(project, dataFromContext, wizard);
        }
    }
}
Also used : Project(com.intellij.openapi.project.Project) DefaultModulesProvider(com.intellij.openapi.roots.ui.configuration.DefaultModulesProvider) NewProjectWizard(com.intellij.ide.projectWizard.NewProjectWizard)

Aggregations

NewProjectWizard (com.intellij.ide.projectWizard.NewProjectWizard)5 Project (com.intellij.openapi.project.Project)2 DefaultModulesProvider (com.intellij.openapi.roots.ui.configuration.DefaultModulesProvider)2 AbstractProjectWizard (com.intellij.ide.util.newProjectWizard.AbstractProjectWizard)1 ModuleBuilder (com.intellij.ide.util.projectWizard.ModuleBuilder)1 ProjectBuilder (com.intellij.ide.util.projectWizard.ProjectBuilder)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 Nullable (org.jetbrains.annotations.Nullable)1