templates step re-layouted

This commit is contained in:
Dmitry Avdeev
2012-10-31 14:46:59 +04:00
parent 633c4f9271
commit 7533953db8
5 changed files with 46 additions and 50 deletions
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.ide.util.newProjectWizard.SelectTemplateStep">
<grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="27dc6" binding="myPanel" 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>
<xy x="20" y="20" width="608" height="393"/>
@@ -10,7 +10,7 @@
<children>
<grid id="ac540" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="8" fill="2" indent="0" use-parent-layout="false">
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="8" fill="2" indent="0" use-parent-layout="false">
<preferred-size width="155" height="44"/>
</grid>
</constraints>
@@ -37,37 +37,18 @@
</scrollpane>
</children>
</grid>
<component id="dafde" class="com.intellij.ui.components.JBLabel">
<grid id="e5cc3" layout-manager="GridLayoutManager" row-count="5" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="5" left="5" bottom="0" right="0"/>
<constraints>
<grid row="0" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Please select desired template from the list"/>
</properties>
</component>
<grid id="e5cc3" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<grid id="caf4" binding="mySettingsPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<clientProperties>
<BorderFactoryClass class="java.lang.String" value="com.intellij.ui.IdeBorderFactory$PlainSmallWithIndent"/>
</clientProperties>
<border type="etched" title="Settings"/>
<children/>
</grid>
<grid id="5732c" binding="myDescriptionPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" 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="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<clientProperties>
@@ -84,14 +65,14 @@
<properties>
<contentType value="text/html"/>
<editable value="false"/>
<text value="&lt;html&gt;&#13;&#10; &lt;head&gt;&#13;&#10; &#13;&#10; &lt;/head&gt;&#13;&#10; &lt;body&gt;&#13;&#10; &lt;/body&gt;&#13;&#10;&lt;/html&gt;&#13;&#10;"/>
<text value="&lt;html&gt;&#13;&#10; &lt;head&gt;&#13;&#10;&#13;&#10; &lt;/head&gt;&#13;&#10; &lt;body&gt;&#13;&#10; &lt;p style=&quot;margin-top: 0&quot;&gt;&#13;&#10; &#13;&#10; &lt;/p&gt;&#13;&#10; &lt;/body&gt;&#13;&#10;&lt;/html&gt;&#13;&#10;"/>
</properties>
</component>
</children>
</grid>
<grid id="5d4a2" binding="myExpertPlaceholder" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
@@ -106,7 +87,7 @@
</grid>
<grid id="fb50c" binding="myModulePanel" layout-manager="GridBagLayout">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
@@ -168,6 +149,22 @@
</component>
</children>
</grid>
<grid id="caf4" binding="mySettingsPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<clientProperties>
<BorderFactoryClass class="java.lang.String" value="com.intellij.ui.IdeBorderFactory$PlainSmallWithIndent"/>
</clientProperties>
<border type="none"/>
<children/>
</grid>
<vspacer id="44e0b">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
</children>
</grid>
</children>
@@ -242,18 +242,20 @@ public class SelectTemplateStep extends ModuleWizardStep implements SettingsStep
}
});
//if (myTemplatesTree.getModel().getSize() > 0) {
// myTemplatesTree.setSelectedIndex(0);
//}
mySearchField.addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
doFilter();
}
});
myDescriptionPanel.setVisible(false);
mySettingsPanel.setVisible(false);
myExpertPanel.setVisible(false);
if (myWizardContext.isCreatingNewProject()) {
addField("Project \u001bformat:", myFormatPanel.getStorageFormatComboBox(), myModulePanel);
}
// mySettingsPanel.setVisible(false);
// myExpertPanel.setVisible(false);
new AnAction() {
@Override
@@ -314,11 +316,8 @@ public class SelectTemplateStep extends ModuleWizardStep implements SettingsStep
private void setupPanels(@Nullable ProjectTemplate template) {
restorePanel(myNamePathComponent, 4);
restorePanel(myModulePanel, 6);
restorePanel(myModulePanel, myWizardContext.isCreatingNewProject() ? 8 : 6);
restorePanel(myExpertPanel, myWizardContext.isCreatingNewProject() ? 1 : 0);
if (myWizardContext.isCreatingNewProject()) {
addExpertField("Project \u001bformat:", myFormatPanel.getStorageFormatComboBox());
}
mySettingsStep = myModuleBuilder == null ? null : myModuleBuilder.modifySettingsStep(this);
String description = null;
@@ -333,8 +332,8 @@ public class SelectTemplateStep extends ModuleWizardStep implements SettingsStep
}
}
mySettingsPanel.setVisible(template != null);
myExpertPlaceholder.setVisible(template != null && myExpertPanel.getComponentCount() > 0);
// mySettingsPanel.setVisible(template != null);
myExpertPlaceholder.setVisible(myExpertPanel.getComponentCount() > 0);
myDescriptionPanel.setVisible(StringUtil.isNotEmpty(description));
mySettingsPanel.revalidate();
@@ -47,7 +47,7 @@ public class JavaSettingsStep extends SdkSettingsStep {
private JPanel myPanel;
public JavaSettingsStep(SettingsStep settingsStep, ModuleBuilder moduleBuilder, Condition<SdkTypeId> sdkFilter) {
super(settingsStep, sdkFilter);
super(settingsStep, moduleBuilder, sdkFilter);
myModuleBuilder = moduleBuilder;
if (moduleBuilder instanceof JavaModuleBuilder) {
@@ -19,6 +19,7 @@ import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.projectRoots.SdkTypeId;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.roots.ui.configuration.JdkComboBox;
import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectSdksModel;
import com.intellij.openapi.util.Condition;
@@ -35,7 +36,7 @@ public class SdkSettingsStep extends ModuleWizardStep {
protected final WizardContext myWizardContext;
protected final ProjectSdksModel myModel;
public SdkSettingsStep(SettingsStep settingsStep, Condition<SdkTypeId> sdkFilter) {
public SdkSettingsStep(SettingsStep settingsStep, ModuleBuilder moduleBuilder, Condition<SdkTypeId> sdkFilter) {
myWizardContext = settingsStep.getContext();
myModel = new ProjectSdksModel();
@@ -44,6 +45,14 @@ public class SdkSettingsStep extends ModuleWizardStep {
myJdkComboBox = new JdkComboBox(myModel, sdkFilter);
if (project != null) {
Sdk sdk = ProjectRootManager.getInstance(project).getProjectSdk();
if (sdk != null && moduleBuilder.isSuitableSdkType(sdk.getSdkType())) {
// use default project SDK
return;
}
}
JButton button = new JButton("\u001BNew...");
myJdkComboBox.setSetupButton(button, project, myModel,
project == null ? new JdkComboBox.NoneJdkComboBoxItem() : new JdkComboBox.ProjectJdkComboBoxItem(),
@@ -105,15 +105,6 @@ public class JavaModuleType extends ModuleType<JavaModuleBuilder> {
@Nullable
@Override
public ModuleWizardStep modifySettingsStep(SettingsStep settingsStep, final ModuleBuilder moduleBuilder) {
Project project = settingsStep.getContext().getProject();
if (project != null) {
Sdk sdk = ProjectRootManager.getInstance(project).getProjectSdk();
if (sdk != null && moduleBuilder.isSuitableSdkType(sdk.getSdkType())) {
// use default project SDK
// context.setProjectJdk(sdk);
return null;
}
}
return ProjectWizardStepFactory.getInstance().createJavaSettingsStep(settingsStep, moduleBuilder, new Condition<SdkTypeId>() {
@Override
public boolean value(SdkTypeId sdkType) {