more on Breakpoint Editor

This commit is contained in:
andrey.zaytsev
2012-04-09 21:00:41 +04:00
parent 306d6eeeab
commit eefc12245b
4 changed files with 92 additions and 118 deletions
@@ -174,27 +174,21 @@
<clientProperties>
<BorderFactoryClass class="java.lang.String" value="com.intellij.ui.IdeBorderFactory$PlainSmallWithoutIndent"/>
</clientProperties>
<border type="etched" title-resource-bundle="messages/DebuggerBundle" title-key="label.breakpoint.properties.panel.group.suspend.policy"/>
<border type="none">
<font/>
</border>
<children>
<component id="f6192" class="javax.swing.JRadioButton" binding="mySuspendThreadRadio">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/DebuggerBundle" key="breakpoint.properties.panel.option.suspend.thread"/>
</properties>
</component>
<component id="876b0" class="javax.swing.JRadioButton" binding="mySuspendNoneRadio">
<constraints>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/DebuggerBundle" key="breakpoint.properties.panel.option.suspend.none"/>
</properties>
</component>
<component id="106f5" class="javax.swing.JRadioButton" binding="mySuspendAllRadio">
<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="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/DebuggerBundle" key="breakpoint.properties.panel.option.suspend.all"/>
@@ -213,19 +207,46 @@
<text resource-bundle="messages/DebuggerBundle" key="breakpoint.properties.panel.option.suspend.default"/>
</properties>
</component>
<component id="cd928" class="com.intellij.ui.components.JBCheckBox" binding="mySuspendJBCheckBox">
<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="Suspend"/>
</properties>
</component>
</children>
</grid>
<grid id="8e155" binding="myCompactConditionsPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
<grid id="7978d" 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="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="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="1" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children/>
<children>
<xy id="f3049" binding="myConditionComboPanel" layout-manager="XYLayout" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children/>
</xy>
<component id="46592" class="javax.swing.JLabel">
<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>
<text value="Condition"/>
</properties>
</component>
</children>
</grid>
</children>
</grid>
<grid id="d03f5" binding="myConditionsPanel" layout-manager="GridLayoutManager" row-count="5" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="7">
<grid id="d03f5" binding="myConditionsPanel" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="7">
<margin top="2" left="2" bottom="5" right="5"/>
<constraints>
<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"/>
@@ -239,7 +260,7 @@
<grid id="b404a" binding="myInstanceFiltersPanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="0">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
@@ -284,7 +305,7 @@
<grid id="f07fc" binding="myClassFiltersPanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="0">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
@@ -329,7 +350,7 @@
<grid id="21edd" binding="myPassCountPanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="0">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="7" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="7" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
@@ -375,61 +396,9 @@
</grid>
<vspacer id="905e2">
<constraints>
<grid row="4" 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="3" 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="71106" binding="myConditionPlaceholder" layout-manager="BorderLayout" hgap="0" vgap="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"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<grid id="bf471" binding="myConditionPanel" layout-manager="GridLayoutManager" row-count="2" 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 border-constraint="Center"/>
<properties/>
<border type="none"/>
<children>
<grid id="7978d" 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="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="1" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<xy id="f3049" binding="myConditionComboPanel" layout-manager="XYLayout" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children/>
</xy>
<hspacer id="d39a2">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="0" anchor="0" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="15" height="-1"/>
</grid>
</constraints>
</hspacer>
</children>
</grid>
<component id="77584" class="javax.swing.JCheckBox" binding="myConditionCheckbox">
<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>
<margin top="2" left="2" bottom="0" right="2"/>
<text resource-bundle="messages/DebuggerBundle" key="breakpoint.properties.panel.option.condition"/>
</properties>
</component>
</children>
</grid>
</children>
</grid>
</children>
</grid>
</children>
@@ -42,6 +42,7 @@ import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiElement;
import com.intellij.ui.FieldPanel;
import com.intellij.ui.MultiLineTooltipUI;
import com.intellij.ui.components.JBCheckBox;
import com.intellij.xdebugger.impl.ui.DebuggerUIUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -71,7 +72,6 @@ public abstract class BreakpointPropertiesPanel {
private JCheckBox myLogExpressionCheckBox;
private JCheckBox myLogMessageCheckBox;
protected JCheckBox myPassCountCheckbox;
private JCheckBox myConditionCheckbox;
private JCheckBox myInstanceFiltersCheckBox;
private JCheckBox myClassFiltersCheckBox;
@@ -84,21 +84,19 @@ public abstract class BreakpointPropertiesPanel {
private PsiClass myBreakpointPsiClass;
private JRadioButton mySuspendThreadRadio;
private JRadioButton mySuspendNoneRadio;
private JRadioButton mySuspendAllRadio;
private JRadioButton myDisableAgainRadio;
private JRadioButton myLeaveEnabledRadioButton;
private JLabel myEnableOrDisableLabel;
private JBCheckBox mySuspendJBCheckBox;
private JButton myMakeDefaultButton;
private JRadioButton myDisableAgainRadio;
private JRadioButton myLeaveEnabledRadioButton;
private JLabel myEnableOrDisableLabel;
private JPanel myDependsOnPanel;
private JPanel myInstanceFiltersPanel;
private JPanel myClassFiltersPanel;
private JPanel myPassCountPanel;
private JPanel myConditionsPanel;
private JPanel myConditionPanel;
private JPanel myCompactConditionsPanel;
private JPanel myConditionPlaceholder;
private JPanel myActionsPanel;
ButtonGroup mySuspendPolicyGroup;
@@ -146,14 +144,8 @@ public abstract class BreakpointPropertiesPanel {
myMoreOptionsVisible = b;
myDependsOnPanel.setVisible(b);
myConditionsPanel.setVisible(b);
if (!b) {
myConditionPlaceholder.remove(myConditionPanel);
myCompactConditionsPanel.add(myConditionPanel, BorderLayout.CENTER);
}
else {
if (b) {
myActionsPanel.setVisible(true);
myCompactConditionsPanel.remove(myConditionPanel);
myConditionPlaceholder.add(myConditionPanel, BorderLayout.CENTER);
}
}
@@ -195,8 +187,7 @@ public abstract class BreakpointPropertiesPanel {
mySuspendPolicyGroup = new ButtonGroup();
mySuspendPolicyGroup.add(mySuspendAllRadio);
mySuspendPolicyGroup.add(mySuspendThreadRadio);
mySuspendPolicyGroup.add(mySuspendNoneRadio);
updateSuspendPolicyRbFont();
final ItemListener suspendPolicyChangeListener = new ItemListener() {
public void itemStateChanged(final ItemEvent e) {
@@ -207,8 +198,16 @@ public abstract class BreakpointPropertiesPanel {
}
}
};
mySuspendJBCheckBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
mySuspendAllRadio.setEnabled(mySuspendJBCheckBox.isSelected());
mySuspendThreadRadio.setEnabled(mySuspendJBCheckBox.isSelected());
}
});
mySuspendAllRadio.addItemListener(suspendPolicyChangeListener);
mySuspendNoneRadio.addItemListener(suspendPolicyChangeListener);
mySuspendThreadRadio.addItemListener(suspendPolicyChangeListener);
myMakeDefaultButton.addActionListener(new ActionListener() {
@@ -220,9 +219,6 @@ public abstract class BreakpointPropertiesPanel {
if (DebuggerSettings.SUSPEND_THREAD.equals(suspendPolicy)) {
mySuspendThreadRadio.requestFocus();
}
else if (DebuggerSettings.SUSPEND_NONE.equals(suspendPolicy)) {
mySuspendNoneRadio.requestFocus();
}
else {
mySuspendAllRadio.requestFocus();
}
@@ -312,23 +308,21 @@ public abstract class BreakpointPropertiesPanel {
}
};
myPassCountCheckbox.addActionListener(listener);
myConditionCheckbox.addActionListener(listener);
myInstanceFiltersCheckBox.addActionListener(listener);
myClassFiltersCheckBox.addActionListener(listener);
DebuggerUIUtil.focusEditorOnCheck(myPassCountCheckbox, myPassCountField);
DebuggerUIUtil.focusEditorOnCheck(myConditionCheckbox, myConditionCombo);
DebuggerUIUtil.focusEditorOnCheck(myLogExpressionCheckBox, myLogExpressionCombo);
DebuggerUIUtil.focusEditorOnCheck(myInstanceFiltersCheckBox, myInstanceFiltersField.getTextField());
DebuggerUIUtil.focusEditorOnCheck(myClassFiltersCheckBox, myClassFiltersField.getTextField());
}
private String getSelectedSuspendPolicy() {
if (!mySuspendJBCheckBox.isSelected()) {
return DebuggerSettings.SUSPEND_NONE;
}
if (mySuspendThreadRadio.isSelected()) {
return DebuggerSettings.SUSPEND_THREAD;
}
if (mySuspendNoneRadio.isSelected()) {
return DebuggerSettings.SUSPEND_NONE;
}
return DebuggerSettings.SUSPEND_ALL;
}
@@ -340,7 +334,6 @@ public abstract class BreakpointPropertiesPanel {
mySuspendAllRadio.setFont(DebuggerSettings.SUSPEND_ALL.equals(defPolicy)? boldFont : font);
mySuspendThreadRadio.setFont(DebuggerSettings.SUSPEND_THREAD.equals(defPolicy)? boldFont : font);
mySuspendNoneRadio.setFont(DebuggerSettings.SUSPEND_NONE.equals(defPolicy)? boldFont : font);
}
protected ClassFilter createClassConditionFilter() {
@@ -379,10 +372,19 @@ public abstract class BreakpointPropertiesPanel {
PsiElement context = breakpoint.getEvaluationElement();
myPassCountCheckbox.setSelected(breakpoint.COUNT_FILTER_ENABLED);
myConditionCheckbox.setSelected(breakpoint.CONDITION_ENABLED);
if (!breakpoint.CONDITION_ENABLED) {
myConditionCombo.setText(emptyText());
}
else {
myConditionCombo.setContext(context);
myConditionCombo.setText(breakpoint.getCondition() != null ? breakpoint.getCondition() : emptyText());
}
mySuspendJBCheckBox.setSelected(!breakpoint.SUSPEND_POLICY.equals(DebuggerSettings.SUSPEND_NONE));
mySuspendThreadRadio.setEnabled(mySuspendJBCheckBox.isSelected());
mySuspendAllRadio.setEnabled(mySuspendJBCheckBox.isSelected());
if(DebuggerSettings.SUSPEND_NONE.equals(breakpoint.SUSPEND_POLICY)) {
mySuspendPolicyGroup.setSelected(mySuspendNoneRadio.getModel(), true);
actionsPanelVisible = true;
}
else if(DebuggerSettings.SUSPEND_THREAD.equals(breakpoint.SUSPEND_POLICY)){
@@ -391,16 +393,19 @@ public abstract class BreakpointPropertiesPanel {
else {
mySuspendPolicyGroup.setSelected(mySuspendAllRadio.getModel(), true);
}
mySuspendNoneRadio.addActionListener(new ActionListener() {
mySuspendJBCheckBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
if (!myActionsPanel.isVisible()) {
if (mySuspendNoneRadio.isSelected()) {
if (!mySuspendJBCheckBox.isSelected()) {
if (myDelegate != null) {
myDelegate.showActionsPanel();
}
}
}
mySuspendThreadRadio.setEnabled(mySuspendJBCheckBox.isSelected());
mySuspendAllRadio.setEnabled(mySuspendJBCheckBox.isSelected());
}
});
myLogMessageCheckBox.setSelected(breakpoint.LOG_ENABLED);
@@ -409,16 +414,13 @@ public abstract class BreakpointPropertiesPanel {
actionsPanelVisible = true;
}
myConditionCombo.setContext(context);
myConditionCombo.setText(breakpoint.getCondition() != null ? breakpoint.getCondition() : new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, ""));
myLogExpressionCombo.setContext(context);
if (breakpoint.getLogMessage() != null) {
myLogExpressionCombo.setText(breakpoint.getLogMessage());
}
else {
myLogExpressionCombo.setText(new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, ""));
myLogExpressionCombo.setText(emptyText());
}
myLogExpressionCombo.setEnabled(breakpoint.LOG_EXPRESSION_ENABLED);
@@ -453,6 +455,10 @@ public abstract class BreakpointPropertiesPanel {
setMoreOptionsVisible(moreOptionsVisible);
}
private TextWithImportsImpl emptyText() {
return new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, "");
}
/**
* Save values in the UI components to the breakpoint object
*/
@@ -470,7 +476,7 @@ public abstract class BreakpointPropertiesPanel {
}
breakpoint.COUNT_FILTER_ENABLED = breakpoint.COUNT_FILTER > 0 && myPassCountCheckbox.isSelected();
breakpoint.setCondition(myConditionCombo.getText());
breakpoint.CONDITION_ENABLED = !breakpoint.getCondition().isEmpty() && myConditionCheckbox.isSelected();
breakpoint.CONDITION_ENABLED = !breakpoint.getCondition().isEmpty();
breakpoint.setLogMessage(myLogExpressionCombo.getText());
breakpoint.LOG_EXPRESSION_ENABLED = !breakpoint.getLogMessage().isEmpty() && myLogExpressionCheckBox.isSelected();
breakpoint.LOG_ENABLED = myLogMessageCheckBox.isSelected();
@@ -616,7 +622,7 @@ public abstract class BreakpointPropertiesPanel {
}
protected void updateCheckboxes() {
JCheckBox [] checkBoxes = { myConditionCheckbox, myInstanceFiltersCheckBox, myClassFiltersCheckBox };
JCheckBox [] checkBoxes = {myInstanceFiltersCheckBox, myClassFiltersCheckBox };
JCheckBox selected = null;
for (JCheckBox checkBoxe : checkBoxes) {
if (checkBoxe.isSelected()) {
@@ -624,8 +630,7 @@ public abstract class BreakpointPropertiesPanel {
break;
}
}
if(selected != null){
if(selected != null || !myConditionCombo.getText().isEmpty()){
myPassCountCheckbox.setEnabled(false);
} else {
myPassCountCheckbox.setEnabled(true);
@@ -637,8 +642,8 @@ public abstract class BreakpointPropertiesPanel {
myPassCountField.setEditable(myPassCountCheckbox.isSelected());
myPassCountField.setEnabled (myPassCountCheckbox.isSelected());
myConditionCombo.setEnabled(myConditionCheckbox.isSelected());
myConditionMagnifierButton.setEnabled(myConditionCheckbox.isSelected());
myConditionCombo.setEnabled(true);
myConditionMagnifierButton.setEnabled(true);
myInstanceFiltersField.setEnabled(myInstanceFiltersCheckBox.isSelected());
myInstanceFiltersField.getTextField().setEditable(myInstanceFiltersCheckBox.isSelected());
myClassFiltersField.setEnabled(myClassFiltersCheckBox.isSelected());
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.xdebugger.impl.ui.BreakpointEditor">
<grid id="27dc6" binding="myMainPanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<grid id="27dc6" binding="myMainPanel" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="5" left="5" bottom="5" right="5"/>
<constraints>
<xy x="20" y="20" width="500" height="400"/>
</constraints>
@@ -10,7 +10,7 @@
<children>
<grid id="e1a21" binding="myPropertiesPlaceholder" layout-manager="BorderLayout" hgap="0" vgap="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"/>
<grid row="0" 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"/>
@@ -19,7 +19,7 @@
<grid id="3bdaa" layout-manager="GridLayoutManager" row-count="1" column-count="3" 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="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="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>
<properties/>
<border type="none"/>
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -244,7 +244,7 @@ public class DebuggerUIUtil {
editor.setShowMoreOptionsLink(showMoreOptions != null);
final Balloon balloon = JBPopupFactory.getInstance()
.createDialogBalloonBuilder(editor.getMainPanel(), displayName)
.createDialogBalloonBuilder(editor.getMainPanel(), null)
.setHideOnClickOutside(true)
.setCloseButtonEnabled(false)
.setAnimationCycle(0)