ProjectNameStep redesigned

This commit is contained in:
Dmitry Avdeev
2011-08-25 15:44:00 +04:00
parent 8818be00fd
commit 0c73438ea2
7 changed files with 31 additions and 19 deletions
@@ -67,12 +67,14 @@ public class ProjectNameStep extends ModuleWizardStep {
myNamePathComponent.getNameComponent().setSelectionEnd(initialProjectName.length());
myPanel = new JPanel(new GridBagLayout());
myPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEtchedBorder(), BorderFactory.createEmptyBorder(10, 10, 10, 10)));
myPanel.add(myNamePathComponent, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 4, 0, 0), 0, 0));
myPanel.add(myNamePathComponent, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(10, 0, 20, 0), 0, 0));
myPanel.add(myFormatPanel.getPanel(), new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(2, 0, 0, 0), 0, 0));
if (myWizardContext.getProject() == null) {
myNamePathComponent.add(new JLabel("Project file format:"), new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
myNamePathComponent.add(myFormatPanel.getStorageFormatComboBox(), new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
}
myNamePathComponent.setVisible(myWizardContext.getProject() == null);
myFormatPanel.setVisible(myWizardContext.getProject() == null);
myAdditionalContentPanel = new JPanel(new GridBagLayout());
myPanel.add(myAdditionalContentPanel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
}
@@ -135,13 +135,15 @@
</grid>
</children>
</grid>
<grid id="fa640" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="fa640" binding="myHeader" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
<properties/>
<properties>
<visible value="true"/>
</properties>
<border type="none"/>
<children>
<component id="63a74" class="javax.swing.JCheckBox" binding="myCreateModuleCb">
@@ -152,9 +154,9 @@
<text value="&amp;Create module"/>
</properties>
</component>
<component id="cf9e8" class="com.intellij.ui.TitledSeparator">
<component id="d48cf" class="javax.swing.JSeparator">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="7" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
@@ -22,7 +22,6 @@ import com.intellij.ide.util.BrowseFilesListener;
import com.intellij.ide.util.newProjectWizard.modes.WizardMode;
import com.intellij.ide.util.projectWizard.ModuleBuilder;
import com.intellij.ide.util.projectWizard.ProjectWizardUtil;
import com.intellij.ide.util.projectWizard.SourcePathsBuilder;
import com.intellij.ide.util.projectWizard.WizardContext;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
@@ -60,6 +59,7 @@ public class ProjectNameWithTypeStep extends ProjectNameStep {
private JTextField myModuleName;
private TextFieldWithBrowseButton myModuleContentRoot;
private TextFieldWithBrowseButton myModuleFileLocation;
private JPanel myHeader;
private boolean myModuleNameChangedByUser = false;
private boolean myModuleNameDocListenerEnabled = true;
@@ -73,8 +73,10 @@ public class ProjectNameWithTypeStep extends ProjectNameStep {
public ProjectNameWithTypeStep(final WizardContext wizardContext, StepSequence sequence, final WizardMode mode) {
super(wizardContext, sequence, mode);
myAdditionalContentPanel.add(myModulePanel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
myCreateModuleCb.setVisible(myWizardContext.isCreatingNewProject());
myAdditionalContentPanel.add(myModulePanel,
new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1, 1, GridBagConstraints.NORTHWEST,
GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
myHeader.setVisible(myWizardContext.isCreatingNewProject());
myCreateModuleCb.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
UIUtil.setEnabled(myInternalPanel, myCreateModuleCb.isSelected(), true);
@@ -81,9 +81,12 @@ public class NamePathComponent extends JPanel{
myNameLabel = new JLabel(nameLabelText);
if (bold) myNameLabel.setFont(UIUtil.getLabelFont().deriveFont(Font.BOLD));
myNameLabel.setLabelFor(myTfName);
this.add(myNameLabel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
Insets insets = new Insets(0, 0, 5, 0);
this.add(myNameLabel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
insets, 0, 0));
this.add(myTfName, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 8, 0), 0, 0));
this.add(myTfName, new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL,
insets, 0, 0));
// todo: review texts
final FileChooserDescriptor chooserDescriptor = (FileChooserDescriptor)BrowseFilesListener.SINGLE_DIRECTORY_DESCRIPTOR.clone();
chooserDescriptor.setHideIgnored(hideIgnored);
@@ -93,11 +96,14 @@ public class NamePathComponent extends JPanel{
myIsPathChangedByUser = true;
}
};
myPathPanel = new FieldPanel(myTfPath, pathLabelText, null, browseButtonActionListener, null);
final JLabel locationLabel = myPathPanel.getFieldLabel();
myPathPanel = new FieldPanel(myTfPath, null, null, browseButtonActionListener, null);
final JLabel locationLabel = new JLabel(pathLabelText);
locationLabel.setLabelFor(myTfPath);
if (bold) locationLabel.setFont(UIUtil.getLabelFont().deriveFont(Font.BOLD));
this.add(myPathPanel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(8, 0, 0, 0), 0, 0));
this.add(locationLabel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
insets, 0, 0));
this.add(myPathPanel, new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL,
insets, 0, 0));
}
public String getNameValue() {
@@ -784,9 +784,9 @@ public class ModuleStructureConfigurable extends BaseStructureConfigurable imple
try {
final String modulePresentation = IdeBundle.message("project.new.wizard.module.identification");
final NamePathComponent component = new NamePathComponent(IdeBundle.message("label.project.name"), IdeBundle.message(
"label.component.file.location", StringUtil.capitalize(modulePresentation)), 'a', 'l', IdeBundle.message(
"label.component.file.location", StringUtil.capitalize(modulePresentation)), IdeBundle.message(
"title.select.project.file.directory", modulePresentation), IdeBundle.message("description.select.project.file.directory",
StringUtil.capitalize(modulePresentation)));
StringUtil.capitalize(modulePresentation)), true, false);
final DialogWrapper copyModuleDialog = new DialogWrapper(myTree, false) {
{
setTitle(ProjectBundle.message("copy.module.dialog.title"));
@@ -672,7 +672,7 @@ title.directory.does.not.exist=Directory Does Not Exist
error.failed.to.create.directory=Failed to create directory \"{0}\"
label.select.compiler.output.path=Select c&ompiler output path:
title.select.compiler.output.path=Select compiler output path
label.project.name=N&ame:
label.project.name=Project n&ame:
label.component.file.location={0} file &location:
label.project.files.location=Project files &location:
title.select.project.file.directory=Select {0} file directory
@@ -393,7 +393,7 @@ project.new.wizard.import.title=Import {0} from external &model
project.new.wizard.import.description=<html>Create {0} {1} structure over existing external model ({2})</html>
project.new.wizard.from.existent.sources.title=Create {0} from &existing sources
project.new.wizard.from.existent.sources.description=<html>Create {0} {1} structure over existing sources</html>
project.new.wizard.module.name.title=Na&me:
project.new.wizard.module.name.title=Module na&me:
project.new.wizard.module.root.title=Content &root:
project.new.wizard.module.file.title=Module &file location: