Use radio buttons instead of checkboxes when creating a new task

Checkboxes are not the appropriate way to present multiple
mutually exclusive options. Radio buttons are.

GitOrigin-RevId: c606526364ff4f11a746f13c2dfd291500566a0d
This commit is contained in:
Sergej Jaskiewicz
2025-07-11 12:40:07 +00:00
committed by intellij-monorepo-bot
parent 08e15d61b3
commit 53924e36da
3 changed files with 33 additions and 9 deletions
@@ -243,3 +243,4 @@ notification.group.branch.context=Branch context switched
notification.group.tasks=Task server connection failed
notification.group.context.corrupted=Task context data corrupted
task.list.url.configuration.parameter.is.mandatory='Task list URL' configuration parameter is mandatory
do.not.associate.branch=Do &not associate branch
@@ -3,12 +3,12 @@
<grid id="27dc6" 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>
<xy x="20" y="20" width="527" height="210"/>
<xy x="20" y="20" width="527" height="225"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<grid id="4e586" binding="myPanel" layout-manager="GridLayoutManager" row-count="5" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="4e586" binding="myPanel" layout-manager="GridLayoutManager" row-count="6" column-count="4" 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="1" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
@@ -29,7 +29,7 @@
<enabled value="false"/>
</properties>
</component>
<component id="30060" class="com.intellij.ui.components.JBCheckBox" binding="myCreateBranch" default-binding="true">
<component id="30060" class="com.intellij.ui.components.JBRadioButton" binding="myCreateBranch" default-binding="true">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
@@ -54,7 +54,7 @@
<text resource-bundle="messages/TaskBundle" key="from"/>
</properties>
</component>
<component id="2ca8c" class="com.intellij.ui.components.JBCheckBox" binding="myUseBranch">
<component id="2ca8c" class="com.intellij.ui.components.JBRadioButton" binding="myUseBranch">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
@@ -96,11 +96,27 @@
</component>
<vspacer id="928f7">
<constraints>
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<component id="1c16c" class="com.intellij.ui.components.JBRadioButton" binding="myDoNotAssociateBranch">
<constraints>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<selected value="true"/>
<text resource-bundle="messages/TaskBundle" key="do.not.associate.branch"/>
</properties>
</component>
</children>
</grid>
</children>
</grid>
<buttonGroups>
<group name="myBranchBehaviorRadioButtonGroup">
<member id="1c16c"/>
<member id="2ca8c"/>
<member id="30060"/>
</group>
</buttonGroups>
</form>
@@ -21,6 +21,7 @@ import com.intellij.ui.ComboboxSpeedSearch;
import com.intellij.ui.SimpleListCellRenderer;
import com.intellij.ui.components.JBCheckBox;
import com.intellij.ui.components.JBLabel;
import com.intellij.ui.components.JBRadioButton;
import com.intellij.ui.scale.JBUIScale;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
@@ -39,13 +40,14 @@ public class VcsOpenTaskPanel extends TaskDialogPanel {
private JPanel myPanel;
private JTextField myBranchName;
private JTextField myChangelistName;
private JBCheckBox myCreateBranch;
private JBRadioButton myCreateBranch;
private JBCheckBox myCreateChangelist;
private ComboBox myBranchFrom;
private JBLabel myFromLabel;
private JBCheckBox myUseBranch;
private JBRadioButton myUseBranch;
private ComboBox<VcsTaskHandler.TaskInfo> myUseBranchCombo;
private JBCheckBox myShelveChanges;
private JBRadioButton myDoNotAssociateBranch;
private VcsTaskHandler myVcsTaskHandler;
private static final String START_FROM_BRANCH = "start.from.branch";
@@ -72,14 +74,18 @@ public class VcsOpenTaskPanel extends TaskDialogPanel {
myCreateBranch.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (myCreateBranch.isSelected()) myUseBranch.setSelected(false);
updateFields(false);
}
});
myUseBranch.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (myUseBranch.isSelected()) myCreateBranch.setSelected(false);
updateFields(false);
}
});
myDoNotAssociateBranch.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
updateFields(false);
}
});
@@ -103,6 +109,7 @@ public class VcsOpenTaskPanel extends TaskDialogPanel {
myUseBranch.setSelected(false);
myUseBranch.setVisible(false);
myUseBranchCombo.setVisible(false);
myDoNotAssociateBranch.setVisible(false);
}
else {
String branchName = getBranchName(task);