mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
create project from template: radio button replaced with checkbox
This commit is contained in:
@@ -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.projectWizard.ChooseTemplateStep">
|
||||
<grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="3" 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="2" 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="500" height="400"/>
|
||||
@@ -8,33 +8,24 @@
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="13f52" class="com.intellij.ui.components.JBRadioButton" binding="myEmptyProjectButton">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<selected value="true"/>
|
||||
<text value="Create &empty project"/>
|
||||
</properties>
|
||||
</component>
|
||||
<hspacer id="35cc7">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</hspacer>
|
||||
<component id="2c81b" class="com.intellij.ui.components.JBRadioButton" binding="myFromTemplateButton">
|
||||
<nested-form id="2fbda" form-file="com/intellij/ide/projectWizard/ProjectTemplateList.form" binding="myTemplateList">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<grid row="1" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</nested-form>
|
||||
<component id="fb5d8" class="com.intellij.ui.components.JBCheckBox" binding="myCreateFromTemplateCheckBox">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Create project from &template"/>
|
||||
</properties>
|
||||
</component>
|
||||
<nested-form id="2fbda" form-file="com/intellij/ide/projectWizard/ProjectTemplateList.form" binding="myTemplateList">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</nested-form>
|
||||
</children>
|
||||
</grid>
|
||||
<buttonGroups>
|
||||
|
||||
@@ -18,7 +18,7 @@ package com.intellij.ide.projectWizard;
|
||||
import com.intellij.ide.util.projectWizard.ModuleWizardStep;
|
||||
import com.intellij.ide.util.projectWizard.WizardContext;
|
||||
import com.intellij.platform.ProjectTemplate;
|
||||
import com.intellij.ui.components.JBRadioButton;
|
||||
import com.intellij.ui.components.JBCheckBox;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
@@ -34,26 +34,22 @@ public class ChooseTemplateStep extends ModuleWizardStep {
|
||||
private final ProjectTypeStep myProjectTypeStep;
|
||||
|
||||
private JPanel myPanel;
|
||||
private JBRadioButton myEmptyProjectButton;
|
||||
private JBRadioButton myFromTemplateButton;
|
||||
private ProjectTemplateList myTemplateList;
|
||||
private JBCheckBox myCreateFromTemplateCheckBox;
|
||||
|
||||
public ChooseTemplateStep(WizardContext wizardContext, ProjectTypeStep projectTypeStep) {
|
||||
myWizardContext = wizardContext;
|
||||
myProjectTypeStep = projectTypeStep;
|
||||
ActionListener listener = new ActionListener() {
|
||||
myCreateFromTemplateCheckBox.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
updateSelection();
|
||||
myTemplateList.setEnabled(myCreateFromTemplateCheckBox.isSelected());
|
||||
if (myCreateFromTemplateCheckBox.isSelected()) {
|
||||
myTemplateList.getList().requestFocus();
|
||||
}
|
||||
}
|
||||
};
|
||||
myEmptyProjectButton.addActionListener(listener);
|
||||
myFromTemplateButton.addActionListener(listener);
|
||||
updateSelection();
|
||||
}
|
||||
|
||||
private void updateSelection() {
|
||||
myTemplateList.setEnabled(myFromTemplateButton.isSelected());
|
||||
});
|
||||
myTemplateList.setEnabled(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -73,7 +69,7 @@ public class ChooseTemplateStep extends ModuleWizardStep {
|
||||
|
||||
@Override
|
||||
public void updateDataModel() {
|
||||
if (myFromTemplateButton.isSelected()) {
|
||||
if (myCreateFromTemplateCheckBox.isSelected()) {
|
||||
myWizardContext.setProjectTemplate(myTemplateList.getSelectedTemplate());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,6 +177,10 @@ public class ProjectTemplateList extends JPanel {
|
||||
});
|
||||
}
|
||||
|
||||
public JBList getList() {
|
||||
return myList;
|
||||
}
|
||||
|
||||
public void addListSelectionListener(ListSelectionListener listener) {
|
||||
myList.addListSelectionListener(listener);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user