IDEA-159094 Filter exception breakpoints by catch location - ui for catch class filters

This commit is contained in:
Egor.Ushakov
2016-08-01 15:57:33 +03:00
parent ad307c0cc8
commit 1adcf182f0
3 changed files with 77 additions and 10 deletions
@@ -8,7 +8,7 @@
<properties/>
<border type="none"/>
<children>
<grid id="5736" binding="myConditionsPanel" layout-manager="GridLayoutManager" row-count="4" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="7">
<grid id="5736" binding="myConditionsPanel" layout-manager="GridLayoutManager" row-count="5" column-count="2" 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="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
@@ -22,7 +22,7 @@
<grid id="8e867" 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="0" column="0" row-span="1" col-span="2" 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="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
@@ -67,7 +67,7 @@
<grid id="25884" 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="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" 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="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
@@ -109,7 +109,7 @@
<grid id="275ca" 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="2" vsize-policy="3" hsize-policy="7" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="3" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="7" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
@@ -155,9 +155,51 @@
</grid>
<vspacer id="d1c29">
<constraints>
<grid row="3" 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="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"/>
</constraints>
</vspacer>
<grid id="350e7" binding="myCatchFiltersPanel" 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="0" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="c5dfb" class="javax.swing.JCheckBox" binding="myCatchCheckBox">
<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.catch.class.filters"/>
</properties>
</component>
<grid id="63496" 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="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<hspacer id="225e2">
<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>
<component id="73a6e" class="com.intellij.debugger.ui.breakpoints.ClassFiltersField" binding="myCatchClassFilters" custom-create="true">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
</children>
</grid>
</children>
</grid>
</children>
</grid>
</children>
@@ -32,6 +32,7 @@ import com.intellij.xdebugger.impl.breakpoints.XBreakpointBase;
import com.intellij.xdebugger.impl.ui.DebuggerUIUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.java.debugger.breakpoints.properties.JavaBreakpointProperties;
import org.jetbrains.java.debugger.breakpoints.properties.JavaExceptionBreakpointProperties;
import javax.swing.*;
import java.awt.*;
@@ -53,6 +54,9 @@ public class JavaBreakpointFiltersPanel<T extends JavaBreakpointProperties, B ex
private ClassFiltersField myClassFiltersField;
private JCheckBox myPassCountCheckbox;
private JTextField myPassCountField;
private JCheckBox myCatchCheckBox;
private ClassFiltersField myCatchClassFilters;
private JPanel myCatchFiltersPanel;
private final FieldPanel myInstanceFiltersField;
@@ -90,6 +94,7 @@ public class JavaBreakpointFiltersPanel<T extends JavaBreakpointProperties, B ex
myPassCountCheckbox.addActionListener(updateListener);
myInstanceFiltersCheckBox.addActionListener(updateListener);
myClassFiltersCheckBox.addActionListener(updateListener);
myCatchCheckBox.addActionListener(updateListener);
ToolTipManager.sharedInstance().registerComponent(myInstanceFiltersField.getTextField());
@@ -98,6 +103,7 @@ public class JavaBreakpointFiltersPanel<T extends JavaBreakpointProperties, B ex
DebuggerUIUtil.focusEditorOnCheck(myPassCountCheckbox, myPassCountField);
DebuggerUIUtil.focusEditorOnCheck(myInstanceFiltersCheckBox, myInstanceFiltersField.getTextField());
DebuggerUIUtil.focusEditorOnCheck(myClassFiltersCheckBox, myClassFiltersField.getTextField());
DebuggerUIUtil.focusEditorOnCheck(myCatchCheckBox, myCatchClassFilters.getTextField());
}
@NotNull
@@ -136,11 +142,20 @@ public class JavaBreakpointFiltersPanel<T extends JavaBreakpointProperties, B ex
reloadInstanceFilters();
updateInstanceFilterEditor(true);
changed = properties.setINSTANCE_FILTERS_ENABLED(!myInstanceFiltersField.getText().isEmpty() && myInstanceFiltersCheckBox.isSelected()) || changed;
if (properties instanceof JavaExceptionBreakpointProperties) {
JavaExceptionBreakpointProperties exceptionBreakpointProperties = (JavaExceptionBreakpointProperties)properties;
changed = exceptionBreakpointProperties.setCatchFiltersEnabled(!myCatchClassFilters.getText().isEmpty() && myCatchCheckBox.isSelected()) || changed;
changed = exceptionBreakpointProperties.setCatchClassFilters(myCatchClassFilters.getClassFilters()) || changed;
changed = exceptionBreakpointProperties.setCatchClassExclusionFilters(myCatchClassFilters.getClassExclusionFilters()) || changed;
}
changed = properties.setCLASS_FILTERS_ENABLED(!myClassFiltersField.getText().isEmpty() && myClassFiltersCheckBox.isSelected()) || changed;
changed = properties.setClassFilters(myClassFiltersField.getClassFilters()) || changed;
changed = properties.setClassExclusionFilters(myClassFiltersField.getClassExclusionFilters()) || changed;
changed = properties.setINSTANCE_FILTERS_ENABLED(!myInstanceFiltersField.getText().isEmpty() && myInstanceFiltersCheckBox.isSelected()) || changed;
changed = properties.setInstanceFilters(myInstanceFilters) || changed;
if (changed) {
((XBreakpointBase)breakpoint).fireBreakpointChanged();
}
@@ -153,6 +168,7 @@ public class JavaBreakpointFiltersPanel<T extends JavaBreakpointProperties, B ex
@Override
public void loadFrom(@NotNull B breakpoint) {
myCatchFiltersPanel.setVisible(false);
JavaBreakpointProperties properties = breakpoint.getProperties();
if (properties != null) {
if (properties.getCOUNT_FILTER() > 0) {
@@ -165,16 +181,20 @@ public class JavaBreakpointFiltersPanel<T extends JavaBreakpointProperties, B ex
myPassCountCheckbox.setSelected(properties.isCOUNT_FILTER_ENABLED());
myInstanceFiltersCheckBox.setSelected(properties.isINSTANCE_FILTERS_ENABLED());
myInstanceFiltersField.setEnabled(properties.isINSTANCE_FILTERS_ENABLED());
myInstanceFiltersField.getTextField().setEditable(properties.isINSTANCE_FILTERS_ENABLED());
myInstanceFilters = properties.getInstanceFilters();
updateInstanceFilterEditor(true);
myClassFiltersCheckBox.setSelected(properties.isCLASS_FILTERS_ENABLED());
myClassFiltersField.setEnabled(properties.isCLASS_FILTERS_ENABLED());
myClassFiltersField.setEditable(properties.isCLASS_FILTERS_ENABLED());
myClassFiltersField.setClassFilters(properties.getClassFilters(), properties.getClassExclusionFilters());
if (properties instanceof JavaExceptionBreakpointProperties) {
myCatchFiltersPanel.setVisible(true);
JavaExceptionBreakpointProperties exceptionBreakpointProperties = (JavaExceptionBreakpointProperties)properties;
myCatchCheckBox.setSelected(exceptionBreakpointProperties.isCatchFiltersEnabled());
myCatchClassFilters.setClassFilters(exceptionBreakpointProperties.getCatchClassFilters(),
exceptionBreakpointProperties.getCatchClassExclusionFilters());
}
XSourcePosition position = breakpoint.getSourcePosition();
// TODO: need to calculate psi class
//myBreakpointPsiClass = breakpoint.getPsiClass();
@@ -199,6 +219,7 @@ public class JavaBreakpointFiltersPanel<T extends JavaBreakpointProperties, B ex
private void createUIComponents() {
myClassFiltersField = new ClassFiltersField(myProject);
myCatchClassFilters = new ClassFiltersField(myProject);
}
private class MyTextField extends JTextField {
@@ -302,5 +323,8 @@ public class JavaBreakpointFiltersPanel<T extends JavaBreakpointProperties, B ex
myClassFiltersField.setEnabled(myClassFiltersCheckBox.isSelected());
myClassFiltersField.setEditable(myClassFiltersCheckBox.isSelected());
myCatchClassFilters.setEnabled(myCatchCheckBox.isSelected());
myCatchClassFilters.setEditable(myCatchCheckBox.isSelected());
}
}
@@ -474,3 +474,4 @@ rule.name.group.by.package=Group by package
error.context.has.changed=Context has changed, operation is not possible
editor.notification.alternative.source=Alternative source available for the class {0}
label.threads.view.configurable.show.prams.types=Show method arguments types
breakpoint.properties.panel.option.catch.class.filters=Catch class filters: