From 5d678cc1aa2df7089607819e09c157b284228e65 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Thu, 18 Oct 2012 16:55:03 +0200 Subject: [PATCH] some fixes for new wizard --- .../newProjectWizard/AddModuleWizardPro.java | 8 ++++++++ .../ProjectCreateModeStep.java | 20 +++++++++++++++++-- .../actions/NewModuleAction.java | 6 +++++- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/AddModuleWizardPro.java b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/AddModuleWizardPro.java index 91d54fb3ef73..ac954f2146da 100644 --- a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/AddModuleWizardPro.java +++ b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/AddModuleWizardPro.java @@ -81,6 +81,13 @@ public class AddModuleWizardPro extends AddModuleWizard { doPreviousAction(); } }.registerCustomShortcutSet(CustomShortcutSet.fromString("control shift TAB"), getContentPanel(), getDisposable()); + new AnAction(){ + @Override + public void actionPerformed(AnActionEvent e) { + myCurrentStep = mySteps.size() - 1; + doOKAction(); + } + }.registerCustomShortcutSet(CustomShortcutSet.fromString("control shift ENTER"), getContentPanel(), getDisposable()); } @Override @@ -145,6 +152,7 @@ public class AddModuleWizardPro extends AddModuleWizard { final int ind = index; final ModuleWizardStep step = mySteps.get(index); final JRadioButton rb = new JRadioButton(step.getName(), index == myCurrentStep); + rb.setFocusable(false); rb.setUI(new WizardArrowUI(rb, index < myCurrentStep)); myStepsPanel.add(rb); group.add(rb); diff --git a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/ProjectCreateModeStep.java b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/ProjectCreateModeStep.java index f6afd575f880..b178be207a08 100644 --- a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/ProjectCreateModeStep.java +++ b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/ProjectCreateModeStep.java @@ -30,6 +30,7 @@ import com.intellij.ide.util.projectWizard.WizardContext; import com.intellij.openapi.extensions.Extensions; import com.intellij.openapi.options.ConfigurationException; import com.intellij.openapi.util.Disposer; +import com.intellij.openapi.util.registry.Registry; import com.intellij.ui.ClickListener; import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.NonNls; @@ -46,6 +47,7 @@ import java.util.List; public class ProjectCreateModeStep extends ModuleWizardStep { private static final String LAST_PROJECT_CREATION_MODE = "LAST_PROJECT_CREATION_MODE"; private final JPanel myWholePanel; + private JPanel myPanelWithDescription; private WizardMode myMode; private final List myModes = new ArrayList(); @@ -77,7 +79,7 @@ public class ProjectCreateModeStep extends ModuleWizardStep { myWizardContext = wizardContext; myWholePanel = new JPanel(new GridBagLayout()); - myWholePanel.setBorder(BorderFactory.createEtchedBorder()); + //myWholePanel.setBorder(BorderFactory.createEtchedBorder()); final Insets insets = new Insets(0, 0, 0, 5); GridBagConstraints gc = new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1, 0, GridBagConstraints.NORTHWEST, @@ -129,10 +131,24 @@ public class ProjectCreateModeStep extends ModuleWizardStep { gc.fill = GridBagConstraints.HORIZONTAL; gc.insets.bottom = 5; myWholePanel.add(note, gc); + if (Registry.is("new.project.wizard")) { + myPanelWithDescription = new JPanel(new BorderLayout()); + myPanelWithDescription.add(createDescription(), BorderLayout.NORTH); + myPanelWithDescription.add(myWholePanel, BorderLayout.CENTER); + } + } + + private JComponent createDescription() { + return new JLabel("

Welcome to Create New Project Wizard

" + + "Some text explaining what are we going to do on possible steps should be placed here

" + + "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

" + + "To navigate through steps use keyboard shortcuts Control+Tab to go next step or Control+Shift+Tab to go back. Or click on a Wizard Arrow" + + ""); + } public JComponent getComponent() { - return myWholePanel; + return Registry.is("new.project.wizard") ? myPanelWithDescription : myWholePanel; } public void updateDataModel() { diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/actions/NewModuleAction.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/actions/NewModuleAction.java index 6e1be5d761b6..497800be4134 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/actions/NewModuleAction.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/actions/NewModuleAction.java @@ -16,6 +16,7 @@ package com.intellij.openapi.roots.ui.configuration.actions; import com.intellij.ide.util.newProjectWizard.AddModuleWizard; +import com.intellij.ide.util.newProjectWizard.AddModuleWizardPro; import com.intellij.ide.util.projectWizard.ModuleBuilder; import com.intellij.ide.util.projectWizard.ProjectBuilder; import com.intellij.openapi.actionSystem.AnAction; @@ -27,6 +28,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ProjectBundle; import com.intellij.openapi.roots.ui.configuration.DefaultModulesProvider; import com.intellij.openapi.roots.ui.configuration.ModulesConfigurator; +import com.intellij.openapi.util.registry.Registry; import com.intellij.openapi.vfs.VirtualFile; import org.jetbrains.annotations.Nullable; @@ -52,7 +54,9 @@ public class NewModuleAction extends AnAction implements DumbAware { if (virtualFile != null && virtualFile.isDirectory()) { defaultPath = virtualFile.getPath(); } - final AddModuleWizard wizard = new AddModuleWizard(project, new DefaultModulesProvider(project), defaultPath); + final AddModuleWizard wizard = Registry.is("new.project.wizard") + ? new AddModuleWizardPro(project, new DefaultModulesProvider(project), defaultPath) + : new AddModuleWizard(project, new DefaultModulesProvider(project), defaultPath); wizard.show();