diff --git a/java/idea-ui/src/com/intellij/ide/projectWizard/NewProjectWizard.java b/java/idea-ui/src/com/intellij/ide/projectWizard/NewProjectWizard.java index ba5db8c309f1..96022bf410b2 100644 --- a/java/idea-ui/src/com/intellij/ide/projectWizard/NewProjectWizard.java +++ b/java/idea-ui/src/com/intellij/ide/projectWizard/NewProjectWizard.java @@ -16,34 +16,20 @@ package com.intellij.ide.projectWizard; import com.intellij.ide.util.newProjectWizard.AbstractProjectWizard; -import com.intellij.ide.util.newProjectWizard.ProjectNameStep; import com.intellij.ide.wizard.Step; -import com.intellij.openapi.Disposable; import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.Disposer; import org.jetbrains.annotations.Nullable; -import javax.swing.*; - /** * @author Dmitry Avdeev * Date: 04.09.13 */ public class NewProjectWizard extends AbstractProjectWizard { - private final ProjectNameStep myProjectNameStep; - public NewProjectWizard(@Nullable Project project, String defaultPath) { super("New Project", null, defaultPath); addStep(new ProjectTypeStep(myWizardContext, getDisposable())); - myProjectNameStep = new ProjectNameStep(myWizardContext, null) { - @Override - public Icon getIcon() { - return null; - } - }; - addStep(myProjectNameStep); - Disposer.register(getDisposable(), myProjectNameStep); + addStep(new ProjectSummaryStep(myWizardContext)); init(); } @@ -58,10 +44,4 @@ public class NewProjectWizard extends AbstractProjectWizard { protected String getDimensionServiceKey() { return "new project wizard"; } - - @Override - protected void doOKAction() { - myProjectNameStep.updateDataModel(); - super.doOKAction(); - } } diff --git a/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectSummaryStep.form b/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectSummaryStep.form new file mode 100644 index 000000000000..a0f1f25df0ec --- /dev/null +++ b/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectSummaryStep.form @@ -0,0 +1,26 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectSummaryStep.java b/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectSummaryStep.java new file mode 100644 index 000000000000..990fea835248 --- /dev/null +++ b/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectSummaryStep.java @@ -0,0 +1,53 @@ +/* + * Copyright 2000-2013 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.ide.projectWizard; + +import com.intellij.ide.util.projectWizard.NamePathComponent; +import com.intellij.ide.util.projectWizard.WizardContext; +import com.intellij.ide.wizard.CommitStepException; +import com.intellij.ide.wizard.StepAdapter; + +import javax.swing.*; +import java.awt.*; + +/** + * @author Dmitry Avdeev + * Date: 20.09.13 + */ +public class ProjectSummaryStep extends StepAdapter { + + private final WizardContext myWizardContext; + private JPanel myRootPanel; + private JPanel myNameAndLocationPanel; + private final NamePathComponent myNamePathComponent; + + public ProjectSummaryStep(WizardContext context) { + myWizardContext = context; + myNamePathComponent = NamePathComponent.initNamePathComponent(myWizardContext); + myNameAndLocationPanel.add(myNamePathComponent, BorderLayout.CENTER); + } + + @Override + public void _commit(boolean finishChosen) throws CommitStepException { + myWizardContext.setProjectName(myNamePathComponent.getNameValue()); + myWizardContext.setProjectFileDirectory(myNamePathComponent.getPath()); + } + + @Override + public JComponent getComponent() { + return myRootPanel; + } +} diff --git a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/SelectTemplateStep.java b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/SelectTemplateStep.java index 13b4fcda9964..40ec96e750ca 100644 --- a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/SelectTemplateStep.java +++ b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/SelectTemplateStep.java @@ -106,7 +106,7 @@ public class SelectTemplateStep extends ModuleWizardStep implements SettingsStep Messages.installHyperlinkSupport(myDescriptionPane); myFormatPanel = new ProjectFormatPanel(); - myNamePathComponent = initNamePathComponent(context); + myNamePathComponent = NamePathComponent.initNamePathComponent(context); if (context.isCreatingNewProject()) { mySettingsPanel.add(myNamePathComponent, BorderLayout.NORTH); addExpertPanel(myModulePanel); @@ -168,24 +168,6 @@ public class SelectTemplateStep extends ModuleWizardStep implements SettingsStep return helpId; } - private static NamePathComponent initNamePathComponent(WizardContext context) { - NamePathComponent component = new NamePathComponent( - IdeBundle.message("label.project.name"), - IdeBundle.message("label.project.files.location"), - IdeBundle.message("title.select.project.file.directory", IdeBundle.message("project.new.wizard.project.identification")), - IdeBundle.message("description.select.project.file.directory", StringUtil - .capitalize(IdeBundle.message("project.new.wizard.project.identification"))), - true, false - ); - final String baseDir = context.getProjectFileDirectory(); - final String projectName = context.getProjectName(); - final String initialProjectName = projectName != null ? projectName : ProjectWizardUtil.findNonExistingFileName(baseDir, "untitled", ""); - component.setPath(projectName == null ? (baseDir + File.separator + initialProjectName) : baseDir); - component.setNameValue(initialProjectName); - component.getNameComponent().select(0, initialProjectName.length()); - return component; - } - private void setupPanels(@Nullable ProjectTemplate template) { restorePanel(myNamePathComponent, 4); diff --git a/java/idea-ui/src/com/intellij/ide/util/projectWizard/NamePathComponent.java b/java/idea-ui/src/com/intellij/ide/util/projectWizard/NamePathComponent.java index 47889b02c923..2a81296181f3 100644 --- a/java/idea-ui/src/com/intellij/ide/util/projectWizard/NamePathComponent.java +++ b/java/idea-ui/src/com/intellij/ide/util/projectWizard/NamePathComponent.java @@ -25,6 +25,7 @@ import com.intellij.openapi.fileChooser.FileChooserDescriptor; import com.intellij.openapi.options.ConfigurationException; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.Messages; +import com.intellij.openapi.util.text.StringUtil; import com.intellij.ui.DocumentAdapter; import com.intellij.ui.FieldPanel; import com.intellij.util.ui.UIUtil; @@ -118,6 +119,24 @@ public class NamePathComponent extends JPanel{ insets, 0, 0)); } + public static NamePathComponent initNamePathComponent(WizardContext context) { + NamePathComponent component = new NamePathComponent( + IdeBundle.message("label.project.name"), + IdeBundle.message("label.project.files.location"), + IdeBundle.message("title.select.project.file.directory", IdeBundle.message("project.new.wizard.project.identification")), + IdeBundle.message("description.select.project.file.directory", StringUtil + .capitalize(IdeBundle.message("project.new.wizard.project.identification"))), + true, false + ); + final String baseDir = context.getProjectFileDirectory(); + final String projectName = context.getProjectName(); + final String initialProjectName = projectName != null ? projectName : ProjectWizardUtil.findNonExistingFileName(baseDir, "untitled", ""); + component.setPath(projectName == null ? (baseDir + File.separator + initialProjectName) : baseDir); + component.setNameValue(initialProjectName); + component.getNameComponent().select(0, initialProjectName.length()); + return component; + } + private String getProjectFilePath(boolean isDefault) { if (isDefault) { return getPath() + "/" + getNameValue() + ProjectFileType.DOT_DEFAULT_EXTENSION;