Search in sources :

Example 1 with SelectImportedProjectsStep

use of com.intellij.projectImport.SelectImportedProjectsStep in project intellij-community by JetBrains.

the class MavenProjectImportProvider method createSteps.

public ModuleWizardStep[] createSteps(final WizardContext wizardContext) {
    final ProjectWizardStepFactory stepFactory = ProjectWizardStepFactory.getInstance();
    return new ModuleWizardStep[] { new MavenProjectImportStep(wizardContext), new SelectProfilesStep(wizardContext), new SelectImportedProjectsStep<MavenProject>(wizardContext) {

        @Override
        protected String getElementText(final MavenProject project) {
            final StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.append(project.getMavenId());
            VirtualFile root = ((MavenProjectBuilder) getBuilder()).getRootDirectory();
            if (root != null) {
                final String relPath = VfsUtilCore.getRelativePath(project.getDirectoryFile(), root, File.separatorChar);
                if (StringUtil.isNotEmpty(relPath)) {
                    stringBuilder.append(" [").append(relPath).append("]");
                }
            }
            if (!isElementEnabled(project)) {
                stringBuilder.append(" (project is ignored. See ").append(CommonBundle.settingsActionPath()).append(" | Maven | Ignored Files)");
            }
            return stringBuilder.toString();
        }

        @Override
        protected boolean isElementEnabled(MavenProject mavenProject) {
            Project project = wizardContext.getProject();
            if (project == null)
                return true;
            return !MavenProjectsManager.getInstance(project).isIgnored(mavenProject);
        }

        @Override
        public void updateDataModel() {
            super.updateDataModel();
            getWizardContext().setProjectName(((MavenProjectBuilder) getBuilder()).getSuggestedProjectName());
        }

        @Override
        public String getHelpId() {
            return "reference.dialogs.new.project.import.maven.page3";
        }
    }, stepFactory.createProjectJdkStep(wizardContext), stepFactory.createNameAndLocationStep(wizardContext) };
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) SelectImportedProjectsStep(com.intellij.projectImport.SelectImportedProjectsStep) MavenProject(org.jetbrains.idea.maven.project.MavenProject) Project(com.intellij.openapi.project.Project) ModuleWizardStep(com.intellij.ide.util.projectWizard.ModuleWizardStep) MavenProject(org.jetbrains.idea.maven.project.MavenProject) ProjectWizardStepFactory(com.intellij.ide.util.projectWizard.ProjectWizardStepFactory)

Aggregations

ModuleWizardStep (com.intellij.ide.util.projectWizard.ModuleWizardStep)1 ProjectWizardStepFactory (com.intellij.ide.util.projectWizard.ProjectWizardStepFactory)1 Project (com.intellij.openapi.project.Project)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 SelectImportedProjectsStep (com.intellij.projectImport.SelectImportedProjectsStep)1 MavenProject (org.jetbrains.idea.maven.project.MavenProject)1