IDEA-107248 Enabling/disabling breakpoint from breakpoint popup does not change the label of the corresponding option

This commit is contained in:
Egor.Ushakov
2015-08-31 15:21:06 +03:00
parent 49b0906573
commit c9eb185899
4 changed files with 80 additions and 44 deletions
@@ -1,38 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.xdebugger.impl.breakpoints.ui.XLightBreakpointPropertiesPanel">
<grid id="27dc6" binding="myMainPanel" layout-manager="GridLayoutManager" row-count="11" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="27dc6" binding="myMainPanel" layout-manager="GridLayoutManager" row-count="12" 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="502"/>
<xy x="20" y="20" width="500" height="538"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<vspacer id="71127">
<constraints>
<grid row="10" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
<grid row="11" 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>
<grid id="8bb86" binding="myConditionPanel" 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"/>
<grid id="8bb86" binding="myConditionPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints>
<grid row="3" column="0" row-span="1" col-span="2" 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="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<border type="none">
<size top="0" left="0" bottom="0" right="4"/>
</border>
<children>
<grid id="5482b" binding="myConditionExpressionPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="7" anchor="0" fill="3" indent="1" use-parent-layout="false"/>
</constraints>
<grid id="5547c" binding="myConditionEnabledPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints border-constraint="West"/>
<properties/>
<border type="none"/>
<children/>
</grid>
<grid id="5547c" binding="myConditionEnabledPanel" layout-manager="CardLayout" hgap="0" vgap="0">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="1" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<grid id="5482b" binding="myConditionExpressionPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints border-constraint="Center"/>
<properties/>
<border type="none"/>
<children/>
@@ -41,22 +38,22 @@
</grid>
<nested-form id="11152" form-file="com/intellij/xdebugger/impl/breakpoints/ui/XSuspendPolicyPanel.form" binding="mySuspendPolicyPanel">
<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"/>
<grid row="3" 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>
<nested-form id="e13dc" form-file="com/intellij/xdebugger/impl/breakpoints/ui/XBreakpointActionsPanel.form" binding="myActionsPanel">
<constraints>
<grid row="5" 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="6" 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>
</nested-form>
<nested-form id="26e47" form-file="com/intellij/xdebugger/impl/breakpoints/ui/XMasterBreakpointPanel.form" binding="myMasterBreakpointPanel">
<constraints>
<grid row="6" 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="7" 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>
</nested-form>
<grid id="24056" binding="myCustomPropertiesPanelWrapper" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints>
<grid row="8" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="9" 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>
<properties/>
<border type="none"/>
@@ -64,7 +61,7 @@
</grid>
<hspacer id="ab565">
<constraints>
<grid row="9" column="0" row-span="1" col-span="2" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false">
<grid row="10" column="0" row-span="1" col-span="2" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
@@ -72,7 +69,7 @@
<grid id="e59bd" binding="myCustomConditionsPanelWrapper" 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="4" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="5" 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>
<properties/>
<border type="none"/>
@@ -80,16 +77,16 @@
</grid>
<component id="90296" class="javax.swing.JCheckBox" binding="myEnabledCheckbox">
<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"/>
<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"/>
</constraints>
<properties>
<font style="1"/>
<font/>
<text value="Enabled"/>
</properties>
</component>
<grid id="56399" binding="myCustomRightPropertiesPanelWrapper" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints>
<grid row="5" column="1" row-span="3" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="6" column="1" row-span="3" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<enabled value="true"/>
@@ -100,17 +97,26 @@
</grid>
<vspacer id="9f6bc">
<constraints>
<grid row="7" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
<grid row="8" 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>
<grid id="1d843" binding="myCustomTopPropertiesPanelWrapper" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints>
<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"/>
<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>
<properties/>
<border type="none"/>
<children/>
</grid>
<component id="1d98e" class="com.intellij.ui.components.JBLabel" binding="myBreakpointNameLabel">
<constraints>
<grid row="0" 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>
<properties>
<font style="1"/>
<text value="Breakpoint name"/>
</properties>
</component>
</children>
</grid>
</form>
@@ -20,7 +20,7 @@ import com.intellij.openapi.wm.IdeFocusManager;
import com.intellij.ui.components.JBCheckBox;
import com.intellij.ui.components.JBLabel;
import com.intellij.ui.popup.util.DetailView;
import com.intellij.util.ui.UIUtil;
import com.intellij.util.ui.JBUI;
import com.intellij.xdebugger.XDebuggerBundle;
import com.intellij.xdebugger.XExpression;
import com.intellij.xdebugger.breakpoints.XBreakpointManager;
@@ -89,6 +89,7 @@ public class XLightBreakpointPropertiesPanel<B extends XBreakpointBase<?,?,?>> i
private JBCheckBox myConditionEnabledCheckbox;
private JPanel myCustomTopPropertiesPanelWrapper;
private JPanel myConditionEnabledPanel;
private JBLabel myBreakpointNameLabel;
private final List<XBreakpointCustomPropertiesPanel<B>> myCustomPanels;
private final List<XBreakpointPropertiesSubPanel<B>> mySubPanels = new ArrayList<XBreakpointPropertiesSubPanel<B>>();
@@ -98,8 +99,6 @@ public class XLightBreakpointPropertiesPanel<B extends XBreakpointBase<?,?,?>> i
private final B myBreakpoint;
private final boolean myShowAllOptions;
private static final String CONDITION_ENABLED_LABEL = "label";
private static final String CONDITION_ENABLED_CHECKBOX = "checkbox";
public void setDetailView(DetailView detailView) {
myMasterBreakpointPanel.setDetailView(detailView);
@@ -140,12 +139,9 @@ public class XLightBreakpointPropertiesPanel<B extends XBreakpointBase<?,?,?>> i
myCustomPanels = new ArrayList<XBreakpointCustomPropertiesPanel<B>>();
if (debuggerEditorsProvider != null) {
myConditionEnabledCheckbox = new JBCheckBox(XDebuggerBundle.message("xbreakpoints.condition.checkbox"));
JBLabel conditionEnabledLabel = new JBLabel(XDebuggerBundle.message("xbreakpoints.condition.checkbox"));
conditionEnabledLabel.setBorder(UIUtil.getTextAlignBorder(myConditionEnabledCheckbox));
myConditionEnabledPanel.add(myConditionEnabledCheckbox, CONDITION_ENABLED_CHECKBOX);
myConditionEnabledPanel.add(conditionEnabledLabel, CONDITION_ENABLED_LABEL);
myConditionComboBox = new XDebuggerExpressionComboBox(project, debuggerEditorsProvider, CONDITION_HISTORY_ID, myBreakpoint.getSourcePosition());
JComponent conditionComponent = myConditionComboBox.getComponent();
conditionComponent.setBorder(JBUI.Borders.emptyRight(3));
myConditionExpressionPanel.add(conditionComponent, BorderLayout.CENTER);
myConditionEnabledCheckbox.addActionListener(new ActionListener() {
@Override
@@ -192,6 +188,9 @@ public class XLightBreakpointPropertiesPanel<B extends XBreakpointBase<?,?,?>> i
myCustomTopPropertiesPanelWrapper.add(customTopPropertiesPanel.getComponent(), BorderLayout.CENTER);
myCustomPanels.add(customTopPropertiesPanel);
}
else {
myCustomTopPropertiesPanelWrapper.getParent().remove(myCustomTopPropertiesPanelWrapper);
}
myMainPanel.addFocusListener(new FocusAdapter() {
@Override
@@ -252,7 +251,15 @@ public class XLightBreakpointPropertiesPanel<B extends XBreakpointBase<?,?,?>> i
myConditionComboBox.setExpression(condition);
boolean hideCheckbox = !myShowAllOptions && condition == null;
myConditionEnabledCheckbox.setSelected(hideCheckbox || (myBreakpoint.isConditionEnabled() && condition != null));
((CardLayout)myConditionEnabledPanel.getLayout()).show(myConditionEnabledPanel, hideCheckbox ? CONDITION_ENABLED_LABEL : CONDITION_ENABLED_CHECKBOX);
myConditionEnabledPanel.removeAll();
if (hideCheckbox) {
JBLabel label = new JBLabel(XDebuggerBundle.message("xbreakpoints.condition.checkbox"));
label.setBorder(JBUI.Borders.empty(0, 4));
myConditionEnabledPanel.add(label);
}
else {
myConditionEnabledPanel.add(myConditionEnabledCheckbox);
}
onCheckboxChanged();
}
@@ -261,7 +268,7 @@ public class XLightBreakpointPropertiesPanel<B extends XBreakpointBase<?,?,?>> i
customPanel.loadFrom(myBreakpoint);
}
myEnabledCheckbox.setSelected(myBreakpoint.isEnabled());
myEnabledCheckbox.setText(XBreakpointUtil.getShortText(myBreakpoint) + " enabled");
myBreakpointNameLabel.setText(XBreakpointUtil.getShortText(myBreakpoint));
}
public JPanel getMainPanel() {
@@ -3,7 +3,7 @@
<grid id="27dc6" binding="myContentPane" layout-manager="GridLayoutManager" row-count="1" column-count="5" 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="537" height="57"/>
<xy x="20" y="20" width="537" height="60"/>
</constraints>
<properties/>
<border type="etched" title-resource-bundle="messages/XDebuggerBundle" title-key="suspend.policy.panel.title"/>
@@ -39,14 +39,32 @@
<text resource-bundle="messages/XDebuggerBundle" key="suspend.policy.panel.suspend"/>
</properties>
</component>
<component id="ac069" class="javax.swing.JButton" binding="myMakeDefaultButton" default-binding="true">
<grid id="b5b11" binding="myMakeDefaultPanel" layout-manager="CardLayout" hgap="0" vgap="0">
<constraints>
<grid row="0" column="4" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="0" column="4" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/XDebuggerBundle" key="suspend.policy.panel.makeDefault"/>
</properties>
</component>
<properties/>
<border type="none"/>
<children>
<component id="ac069" class="javax.swing.JButton" binding="myMakeDefaultButton" default-binding="true">
<constraints>
<card name="Show"/>
</constraints>
<properties>
<text resource-bundle="messages/XDebuggerBundle" key="suspend.policy.panel.makeDefault"/>
</properties>
</component>
<grid id="8c1b4" 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>
<card name="Hide"/>
</constraints>
<properties/>
<border type="none"/>
<children/>
</grid>
</children>
</grid>
</children>
</grid>
<buttonGroups>
@@ -36,6 +36,7 @@ public class XSuspendPolicyPanel<B extends XBreakpoint<?>> extends XBreakpointPr
private JPanel myContentPane;
private JButton myMakeDefaultButton;
private JPanel myMakeDefaultPanel;
private ButtonGroup mySuspendPolicyGroup;
@@ -99,7 +100,11 @@ public class XSuspendPolicyPanel<B extends XBreakpoint<?>> extends XBreakpointPr
}
private void updateMakeDefaultEnableState() {
myMakeDefaultButton.setEnabled(!getSelectedSuspendPolicy().equals(((XBreakpointManagerImpl)myBreakpointManager).getBreakpointDefaults(myBreakpointType).getSuspendPolicy()));
boolean enabled = !getSelectedSuspendPolicy().equals(
((XBreakpointManagerImpl)myBreakpointManager).getBreakpointDefaults(myBreakpointType).getSuspendPolicy());
((CardLayout)myMakeDefaultPanel.getLayout()).show(myMakeDefaultPanel, enabled ? "Show" : "Hide");
myMakeDefaultButton.setVisible(enabled);
myMakeDefaultButton.setEnabled(enabled);
}
private void updateSuspendPolicyFont() {
@@ -125,7 +130,7 @@ public class XSuspendPolicyPanel<B extends XBreakpoint<?>> extends XBreakpointPr
private void changeVisibleState(boolean suspendThreadSupported) {
mySuspendAll.setVisible(suspendThreadSupported);
mySuspendThread.setVisible(suspendThreadSupported);
myMakeDefaultButton.setVisible(suspendThreadSupported);
myMakeDefaultPanel.setVisible(suspendThreadSupported);
}
@Override