mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
XBreakpoints-ui: in-place breakpoint properties editing
This commit is contained in:
@@ -17,6 +17,8 @@ package com.intellij.openapi.editor.ex;
|
||||
|
||||
import com.intellij.openapi.editor.EditorGutter;
|
||||
import com.intellij.openapi.editor.FoldRegion;
|
||||
import com.intellij.openapi.editor.markup.GutterIconRenderer;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -47,4 +49,7 @@ public abstract class EditorGutterComponentEx extends JComponent implements Edit
|
||||
public abstract int getLineMarkerAreaOffset();
|
||||
|
||||
public abstract int getIconsAreaWidth();
|
||||
|
||||
@Nullable
|
||||
public abstract Point getPoint(GutterIconRenderer renderer);
|
||||
}
|
||||
|
||||
+14
@@ -1273,6 +1273,20 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Point getPoint(GutterIconRenderer renderer) {
|
||||
for (int line : myLineToGutterRenderers.keys()) {
|
||||
for (GutterIconRenderer gutterIconRenderer : myLineToGutterRenderers.get(line)) {
|
||||
if (gutterIconRenderer == renderer) {
|
||||
int x = getLineMarkerAreaOffset() + 1;
|
||||
final int y = myEditor.logicalPositionToXY(new LogicalPosition(line, 0)).y;
|
||||
return new Point(x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void invokePopup(MouseEvent e) {
|
||||
final ActionManager actionManager = ActionManager.getInstance();
|
||||
if (myEditor.getMouseEventArea(e) == EditorMouseEventArea.ANNOTATIONS_AREA) {
|
||||
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright 2000-2011 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.xdebugger.impl.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.ex.EditorEx;
|
||||
import com.intellij.openapi.editor.ex.EditorGutterComponentEx;
|
||||
import com.intellij.openapi.editor.markup.GutterIconRenderer;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.xdebugger.impl.breakpoints.XBreakpointBase;
|
||||
import com.intellij.xdebugger.impl.ui.DebuggerUIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class EditBreakpointAction extends AnAction {
|
||||
private XBreakpointBase myBreakpoint;
|
||||
private GutterIconRenderer myBreakpointGutterRenderer;
|
||||
|
||||
public EditBreakpointAction(String text,
|
||||
@NotNull XBreakpointBase breakpoint,
|
||||
GutterIconRenderer breakpointGutterRenderer) {
|
||||
super(text);
|
||||
myBreakpoint = breakpoint;
|
||||
myBreakpointGutterRenderer = breakpointGutterRenderer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
DataContext dataContext = e.getDataContext();
|
||||
Project project = PlatformDataKeys.PROJECT.getData(dataContext);
|
||||
if (project == null) return;
|
||||
|
||||
Editor editor = PlatformDataKeys.EDITOR.getData(dataContext);
|
||||
if (editor != null) {
|
||||
final EditorGutterComponentEx gutterComponent = ((EditorEx)editor).getGutterComponentEx();
|
||||
Point point = gutterComponent.getPoint(myBreakpointGutterRenderer);
|
||||
final Icon icon = myBreakpointGutterRenderer.getIcon();
|
||||
DebuggerUIUtil.showBreakpointEditorBalloon(project, new Point(point.x + icon.getIconWidth()/2 + gutterComponent.getIconsAreaWidth(), point.y + icon.getIconHeight()/2), gutterComponent, false, myBreakpoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -48,7 +48,7 @@ public class ViewBreakpointsAction extends AnAction implements AnAction.Transpar
|
||||
if (project == null) return;
|
||||
|
||||
if (myInitialBreakpoint == null) {
|
||||
Editor editor = PlatformDataKeys.EDITOR.getData(dataContext);
|
||||
Editor editor = PlatformDataKeys.EDITOR.getData(dataContext);
|
||||
if (editor != null) {
|
||||
myInitialBreakpoint = findSelectedBreakpoint(project, editor);
|
||||
}
|
||||
|
||||
+5
-4
@@ -32,13 +32,13 @@ import com.intellij.xdebugger.XDebugSession;
|
||||
import com.intellij.xdebugger.XDebuggerBundle;
|
||||
import com.intellij.xdebugger.XDebuggerManager;
|
||||
import com.intellij.xdebugger.XSourcePosition;
|
||||
import com.intellij.xdebugger.impl.XDebugSessionImpl;
|
||||
import com.intellij.xdebugger.impl.XDebuggerUtilImpl;
|
||||
import com.intellij.xdebugger.breakpoints.SuspendPolicy;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpoint;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpointProperties;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpointType;
|
||||
import com.intellij.xdebugger.impl.actions.ViewBreakpointsAction;
|
||||
import com.intellij.xdebugger.impl.XDebugSessionImpl;
|
||||
import com.intellij.xdebugger.impl.XDebuggerUtilImpl;
|
||||
import com.intellij.xdebugger.impl.actions.EditBreakpointAction;
|
||||
import com.intellij.xdebugger.ui.DebuggerIcons;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -368,7 +368,8 @@ public class XBreakpointBase<Self extends XBreakpoint<P>, P extends XBreakpointP
|
||||
group.add(action);
|
||||
}
|
||||
group.add(new Separator());
|
||||
group.add(new ViewBreakpointsAction(XDebuggerBundle.message("xdebugger.view.breakpoint.properties.action"), XBreakpointBase.this));
|
||||
|
||||
group.add(new EditBreakpointAction(XDebuggerBundle.message("xdebugger.view.breakpoint.properties.action"), XBreakpointBase.this, this));
|
||||
return group;
|
||||
}
|
||||
|
||||
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
<?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.XBreakpointActionsPanel">
|
||||
<grid id="27dc6" binding="myContentPane" 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="500" height="400"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="a076b" 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"/>
|
||||
<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="etched" title-resource-bundle="messages/XDebuggerBundle" title-key="xbreakpoints.properties.actions.group.title"/>
|
||||
<children>
|
||||
<component id="26324" class="javax.swing.JCheckBox" binding="myLogMessageCheckBox">
|
||||
<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>
|
||||
<text resource-bundle="messages/XDebuggerBundle" key="xbreakpoints.log.message.checkbox"/>
|
||||
</properties>
|
||||
</component>
|
||||
<grid id="43359" 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>
|
||||
<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>
|
||||
<component id="4a782" class="javax.swing.JCheckBox" binding="myLogExpressionCheckBox" default-binding="true">
|
||||
<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>
|
||||
<enabled value="true"/>
|
||||
<text resource-bundle="messages/XDebuggerBundle" key="xbreakpoints.log.expression.checkbox"/>
|
||||
</properties>
|
||||
</component>
|
||||
<grid id="16042" binding="myLogExpressionPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="1" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children/>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* Copyright 2000-2011 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.xdebugger.impl.breakpoints.ui;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpoint;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpointManager;
|
||||
import com.intellij.xdebugger.evaluation.XDebuggerEditorsProvider;
|
||||
import com.intellij.xdebugger.impl.ui.DebuggerUIUtil;
|
||||
import com.intellij.xdebugger.impl.ui.XDebuggerExpressionComboBox;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: zajac
|
||||
* Date: 18.06.11
|
||||
* Time: 9:45
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public class XBreakpointActionsPanel<B extends XBreakpoint<?>> extends XBreakpointPropertiesSubPanel<B> {
|
||||
private JCheckBox myLogMessageCheckBox;
|
||||
private JCheckBox myLogExpressionCheckBox;
|
||||
private JPanel myLogExpressionPanel;
|
||||
private JPanel myContentPane;
|
||||
private JPanel myMainPanel;
|
||||
private XDebuggerExpressionComboBox myLogExpressionComboBox;
|
||||
|
||||
public void init(Project project, XBreakpointManager breakpointManager, @NotNull B breakpoint, @Nullable XDebuggerEditorsProvider debuggerEditorsProvider) {
|
||||
init(project, breakpointManager, breakpoint);
|
||||
if (debuggerEditorsProvider != null) {
|
||||
ActionListener listener = new ActionListener() {
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
onCheckboxChanged();
|
||||
}
|
||||
};
|
||||
|
||||
myLogExpressionComboBox = new XDebuggerExpressionComboBox(project, debuggerEditorsProvider, "breakpointLogExpression", myBreakpoint.getSourcePosition());
|
||||
JComponent logExpressionComponent = myLogExpressionComboBox.getComponent();
|
||||
myLogExpressionPanel.add(logExpressionComponent, BorderLayout.CENTER);
|
||||
myLogExpressionComboBox.setEnabled(false);
|
||||
myLogExpressionCheckBox.addActionListener(listener);
|
||||
DebuggerUIUtil.focusEditorOnCheck(myLogExpressionCheckBox, logExpressionComponent);
|
||||
}
|
||||
else {
|
||||
myLogExpressionCheckBox.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean lightVariant(boolean showAllOptions) {
|
||||
if (!showAllOptions && !myBreakpoint.isLogMessage() && myBreakpoint.getLogExpression() == null) {
|
||||
myMainPanel.setVisible(false);
|
||||
return true;
|
||||
} else {
|
||||
myMainPanel.setBorder(null);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void onCheckboxChanged() {
|
||||
if (myLogExpressionComboBox != null) {
|
||||
myLogExpressionComboBox.setEnabled(myLogExpressionCheckBox.isSelected());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
void loadProperties() {
|
||||
myLogMessageCheckBox.setSelected(myBreakpoint.isLogMessage());
|
||||
if (myLogExpressionComboBox != null) {
|
||||
String logExpression = myBreakpoint.getLogExpression();
|
||||
myLogExpressionCheckBox.setSelected(logExpression != null);
|
||||
myLogExpressionComboBox.setText(logExpression != null ? logExpression : "");
|
||||
}
|
||||
onCheckboxChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
void saveProperties() {
|
||||
myBreakpoint.setLogMessage(myLogMessageCheckBox.isSelected());
|
||||
|
||||
if (myLogExpressionComboBox != null) {
|
||||
String logExpression = myLogExpressionCheckBox.isSelected() ? myLogExpressionComboBox.getText() : null;
|
||||
myBreakpoint.setLogExpression(logExpression);
|
||||
myLogExpressionComboBox.saveTextInHistory();
|
||||
}
|
||||
//To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
}
|
||||
+13
-169
@@ -3,7 +3,7 @@
|
||||
<grid id="27dc6" binding="myMainPanel" 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="5" bottom="0" right="5"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="547" height="400"/>
|
||||
<xy x="20" y="20" width="547" height="431"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
@@ -16,124 +16,11 @@
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="733c8" binding="mySuspendPolicyPanel" layout-manager="CardLayout" 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="etched" title-resource-bundle="messages/XDebuggerBundle" title-key="xbreakpoints.suspend.group.title"/>
|
||||
<children>
|
||||
<grid id="d0d4f" 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="checkbox"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="57d07" class="javax.swing.JCheckBox" binding="mySuspendCheckBox" default-binding="true">
|
||||
<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 resource-bundle="messages/XDebuggerBundle" key="xbreakpoints.suspend.checkbox"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="8fef9" layout-manager="GridLayoutManager" row-count="1" 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>
|
||||
<card name="radioButtons"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="e972f" class="javax.swing.JRadioButton" binding="mySuspendAllRadioButton">
|
||||
<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 resource-bundle="messages/XDebuggerBundle" key="xbreakpoints.suspend.all.radio"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="c0938" class="javax.swing.JRadioButton" binding="mySuspendThreadRadioButton">
|
||||
<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"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text resource-bundle="messages/XDebuggerBundle" key="xbreakpoints.suspend.thread.radio"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="f0f00" class="javax.swing.JRadioButton" binding="mySuspendNoneRadioButton">
|
||||
<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/XDebuggerBundle" key="xbreakpoints.suspend.none.radio"/>
|
||||
</properties>
|
||||
</component>
|
||||
<hspacer id="c39ac">
|
||||
<constraints>
|
||||
<grid row="0" column="3" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</hspacer>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
<vspacer id="7e25">
|
||||
<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"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<grid id="623e" 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>
|
||||
<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="etched" title-resource-bundle="messages/XDebuggerBundle" title-key="xbreakpoints.properties.actions.group.title"/>
|
||||
<children>
|
||||
<component id="f463e" class="javax.swing.JCheckBox" binding="myLogMessageCheckBox">
|
||||
<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>
|
||||
<text resource-bundle="messages/XDebuggerBundle" key="xbreakpoints.log.message.checkbox"/>
|
||||
</properties>
|
||||
</component>
|
||||
<grid id="e1f87" 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>
|
||||
<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>
|
||||
<component id="c422a" class="javax.swing.JCheckBox" binding="myLogExpressionCheckBox" default-binding="true">
|
||||
<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>
|
||||
<enabled value="true"/>
|
||||
<text resource-bundle="messages/XDebuggerBundle" key="xbreakpoints.log.expression.checkbox"/>
|
||||
</properties>
|
||||
</component>
|
||||
<grid id="100b3" binding="myLogExpressionPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="1" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children/>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="b7bb7" binding="myCustomPropertiesPanelWrapper" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
@@ -142,64 +29,21 @@
|
||||
<border type="none"/>
|
||||
<children/>
|
||||
</grid>
|
||||
<grid id="996d4" layout-manager="GridLayoutManager" row-count="2" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<nested-form id="7f878" form-file="com/intellij/xdebugger/impl/breakpoints/ui/XSuspendPolicyPanel.form" binding="mySuspendPolicyPanel">
|
||||
<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>
|
||||
</nested-form>
|
||||
<nested-form id="2a592" form-file="com/intellij/xdebugger/impl/breakpoints/ui/XMasterBreakpointPanel.form" binding="myMasterBreakpointPanel">
|
||||
<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"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="etched" title-resource-bundle="messages/XDebuggerBundle" title-key="xbreakpoint.group.depends.on"/>
|
||||
<children>
|
||||
<grid id="c078c" binding="myMasterBreakpointComboBoxPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="3" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children/>
|
||||
</grid>
|
||||
<grid id="1659c" binding="myAfterBreakpointHitPanel" layout-manager="GridLayoutManager" row-count="1" 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="1" column="0" row-span="1" col-span="3" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="effb6" 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 resource-bundle="messages/XDebuggerBundle" key="xbreakpoint.label.after.breakpoint.was.hit"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="40f5a" class="javax.swing.JRadioButton">
|
||||
<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"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<selected value="true"/>
|
||||
<text resource-bundle="messages/XDebuggerBundle" key="xbreakpoint.radio.disable.again"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="aae0f" class="javax.swing.JRadioButton" binding="myLeaveEnabledRadioButton" default-binding="true">
|
||||
<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/XDebuggerBundle" key="xbreakpoint.radio.leave.enabled"/>
|
||||
</properties>
|
||||
</component>
|
||||
<hspacer id="b5c11">
|
||||
<constraints>
|
||||
<grid row="0" column="3" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</hspacer>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
</nested-form>
|
||||
<nested-form id="e4427" form-file="com/intellij/xdebugger/impl/breakpoints/ui/XBreakpointActionsPanel.form" binding="myBreakpointActionsPanel">
|
||||
<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>
|
||||
</nested-form>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="185a9" binding="myConditionsPanel" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
|
||||
+31
-136
@@ -16,19 +16,15 @@
|
||||
package com.intellij.xdebugger.impl.breakpoints.ui;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.ComboBox;
|
||||
import com.intellij.xdebugger.XDebuggerBundle;
|
||||
import com.intellij.xdebugger.breakpoints.*;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpoint;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpointManager;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpointType;
|
||||
import com.intellij.xdebugger.breakpoints.ui.XBreakpointCustomPropertiesPanel;
|
||||
import com.intellij.xdebugger.evaluation.XDebuggerEditorsProvider;
|
||||
import com.intellij.xdebugger.impl.breakpoints.XBreakpointBase;
|
||||
import com.intellij.xdebugger.impl.breakpoints.XBreakpointManagerImpl;
|
||||
import com.intellij.xdebugger.impl.breakpoints.XDependentBreakpointManager;
|
||||
import com.intellij.xdebugger.impl.breakpoints.XBreakpointUtil;
|
||||
import com.intellij.xdebugger.impl.ui.DebuggerUIUtil;
|
||||
import com.intellij.xdebugger.impl.ui.XDebuggerExpressionComboBox;
|
||||
import com.intellij.ui.GuiUtils;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -36,65 +32,41 @@ import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
public class XBreakpointPropertiesPanel<B extends XBreakpoint<?>> {
|
||||
private JPanel myMainPanel;
|
||||
private JCheckBox mySuspendCheckBox;
|
||||
private JRadioButton mySuspendAllRadioButton;
|
||||
private JRadioButton mySuspendThreadRadioButton;
|
||||
private JRadioButton mySuspendNoneRadioButton;
|
||||
private JCheckBox myLogMessageCheckBox;
|
||||
private JCheckBox myLogExpressionCheckBox;
|
||||
private JPanel myLogExpressionPanel;
|
||||
|
||||
private XSuspendPolicyPanel<B> mySuspendPolicyPanel;
|
||||
|
||||
private JCheckBox myConditionCheckBox;
|
||||
private JPanel myConditionExpressionPanel;
|
||||
private JPanel myCustomConditionsPanelWrapper;
|
||||
private JPanel mySuspendPolicyPanel;
|
||||
private JPanel myCustomPropertiesPanelWrapper;
|
||||
private JRadioButton myLeaveEnabledRadioButton;
|
||||
private JPanel myMasterBreakpointComboBoxPanel;
|
||||
private JPanel myAfterBreakpointHitPanel;
|
||||
private JPanel myConditionsPanel;
|
||||
private final XBreakpointManager myBreakpointManager;
|
||||
private final B myBreakpoint;
|
||||
private final Map<SuspendPolicy, JRadioButton> mySuspendRadioButtons;
|
||||
private final List<XBreakpointCustomPropertiesPanel<B>> myCustomPanels;
|
||||
private XDebuggerExpressionComboBox myLogExpressionComboBox;
|
||||
|
||||
private XMasterBreakpointPanel<B> myMasterBreakpointPanel;
|
||||
private XBreakpointActionsPanel<B> myBreakpointActionsPanel;
|
||||
|
||||
private XDebuggerExpressionComboBox myConditionComboBox;
|
||||
private final ComboBox myMasterBreakpointComboBox;
|
||||
private final XDependentBreakpointManager myDependentBreakpointManager;
|
||||
|
||||
private final List<XBreakpointCustomPropertiesPanel<B>> myCustomPanels;
|
||||
|
||||
private final B myBreakpoint;
|
||||
|
||||
public XBreakpointPropertiesPanel(Project project, final XBreakpointManager breakpointManager, @NotNull B breakpoint) {
|
||||
myBreakpointManager = breakpointManager;
|
||||
myDependentBreakpointManager = ((XBreakpointManagerImpl)breakpointManager).getDependentBreakpointManager();
|
||||
myBreakpoint = breakpoint;
|
||||
XBreakpointType<B, ?> breakpointType = XBreakpointUtil.getType(breakpoint);
|
||||
|
||||
XBreakpointType<B,?> type = XBreakpointUtil.getType(breakpoint);
|
||||
mySuspendPolicyPanel.init(project, breakpointManager, breakpoint);
|
||||
|
||||
mySuspendRadioButtons = new HashMap<SuspendPolicy, JRadioButton>();
|
||||
mySuspendRadioButtons.put(SuspendPolicy.ALL, mySuspendAllRadioButton);
|
||||
mySuspendRadioButtons.put(SuspendPolicy.THREAD, mySuspendThreadRadioButton);
|
||||
mySuspendRadioButtons.put(SuspendPolicy.NONE, mySuspendNoneRadioButton);
|
||||
@NonNls String card = type.isSuspendThreadSupported() ? "radioButtons" : "checkbox";
|
||||
((CardLayout)mySuspendPolicyPanel.getLayout()).show(mySuspendPolicyPanel, card);
|
||||
XDebuggerEditorsProvider debuggerEditorsProvider = breakpointType.getEditorsProvider();
|
||||
|
||||
myMasterBreakpointComboBox = new ComboBox(300);
|
||||
myMasterBreakpointComboBoxPanel.add(myMasterBreakpointComboBox, BorderLayout.CENTER);
|
||||
myMasterBreakpointComboBox.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
updateAfterBreakpointHitPanel();
|
||||
}
|
||||
});
|
||||
myMasterBreakpointComboBox.setRenderer(new BreakpointsListCellRenderer<B>());
|
||||
fillMasterBreakpointComboBox();
|
||||
myBreakpointActionsPanel.init(project, breakpointManager, breakpoint, debuggerEditorsProvider);
|
||||
|
||||
XDebuggerEditorsProvider debuggerEditorsProvider = type.getEditorsProvider();
|
||||
if (debuggerEditorsProvider != null) {
|
||||
ActionListener listener = new ActionListener() {
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
@@ -102,13 +74,6 @@ public class XBreakpointPropertiesPanel<B extends XBreakpoint<?>> {
|
||||
}
|
||||
};
|
||||
|
||||
myLogExpressionComboBox = new XDebuggerExpressionComboBox(project, debuggerEditorsProvider, "breakpointLogExpression", myBreakpoint.getSourcePosition());
|
||||
JComponent logExpressionComponent = myLogExpressionComboBox.getComponent();
|
||||
myLogExpressionPanel.add(logExpressionComponent, BorderLayout.CENTER);
|
||||
myLogExpressionComboBox.setEnabled(false);
|
||||
myLogExpressionCheckBox.addActionListener(listener);
|
||||
DebuggerUIUtil.focusEditorOnCheck(myLogExpressionCheckBox, logExpressionComponent);
|
||||
|
||||
myConditionComboBox = new XDebuggerExpressionComboBox(project, debuggerEditorsProvider, "breakpointCondition", myBreakpoint.getSourcePosition());
|
||||
JComponent conditionComponent = myConditionComboBox.getComponent();
|
||||
myConditionExpressionPanel.add(conditionComponent, BorderLayout.CENTER);
|
||||
@@ -117,12 +82,13 @@ public class XBreakpointPropertiesPanel<B extends XBreakpoint<?>> {
|
||||
DebuggerUIUtil.focusEditorOnCheck(myConditionCheckBox, conditionComponent);
|
||||
}
|
||||
else {
|
||||
myLogExpressionCheckBox.setVisible(false);
|
||||
myConditionCheckBox.setVisible(false);
|
||||
}
|
||||
|
||||
myMasterBreakpointPanel.init(project, breakpointManager, breakpoint);
|
||||
|
||||
myCustomPanels = new ArrayList<XBreakpointCustomPropertiesPanel<B>>();
|
||||
XBreakpointCustomPropertiesPanel<B> customConditionPanel = type.createCustomConditionsPanel();
|
||||
XBreakpointCustomPropertiesPanel<B> customConditionPanel = breakpointType.createCustomConditionsPanel();
|
||||
if (customConditionPanel != null) {
|
||||
myCustomConditionsPanelWrapper.add(customConditionPanel.getComponent(), BorderLayout.CENTER);
|
||||
myCustomPanels.add(customConditionPanel);
|
||||
@@ -132,7 +98,7 @@ public class XBreakpointPropertiesPanel<B extends XBreakpoint<?>> {
|
||||
myConditionsPanel.setVisible(false);
|
||||
}
|
||||
|
||||
XBreakpointCustomPropertiesPanel<B> customPropertiesPanel = type.createCustomPropertiesPanel();
|
||||
XBreakpointCustomPropertiesPanel<B> customPropertiesPanel = breakpointType.createCustomPropertiesPanel();
|
||||
if (customPropertiesPanel != null) {
|
||||
myCustomPropertiesPanelWrapper.add(customPropertiesPanel.getComponent(), BorderLayout.CENTER);
|
||||
myCustomPanels.add(customPropertiesPanel);
|
||||
@@ -141,44 +107,25 @@ public class XBreakpointPropertiesPanel<B extends XBreakpoint<?>> {
|
||||
loadProperties();
|
||||
}
|
||||
|
||||
private void updateAfterBreakpointHitPanel() {
|
||||
boolean enable = myMasterBreakpointComboBox.getSelectedItem() != null;
|
||||
GuiUtils.enableChildren(enable, myAfterBreakpointHitPanel);
|
||||
}
|
||||
|
||||
private void onCheckboxChanged() {
|
||||
if (myLogExpressionComboBox != null) {
|
||||
myLogExpressionComboBox.setEnabled(myLogExpressionCheckBox.isSelected());
|
||||
}
|
||||
if (myConditionComboBox != null) {
|
||||
myConditionComboBox.setEnabled(myConditionCheckBox.isSelected());
|
||||
}
|
||||
}
|
||||
|
||||
private void loadProperties() {
|
||||
SuspendPolicy suspendPolicy = myBreakpoint.getSuspendPolicy();
|
||||
mySuspendRadioButtons.get(suspendPolicy).setSelected(true);
|
||||
mySuspendCheckBox.setSelected(suspendPolicy != SuspendPolicy.NONE);
|
||||
mySuspendPolicyPanel.loadProperties();
|
||||
|
||||
myBreakpointActionsPanel.loadProperties();
|
||||
|
||||
myMasterBreakpointPanel.loadProperties();
|
||||
|
||||
myLogMessageCheckBox.setSelected(myBreakpoint.isLogMessage());
|
||||
if (myLogExpressionComboBox != null) {
|
||||
String logExpression = myBreakpoint.getLogExpression();
|
||||
myLogExpressionCheckBox.setSelected(logExpression != null);
|
||||
myLogExpressionComboBox.setText(logExpression != null ? logExpression : "");
|
||||
}
|
||||
if (myConditionComboBox != null) {
|
||||
String condition = myBreakpoint.getCondition();
|
||||
myConditionCheckBox.setSelected(condition != null);
|
||||
myConditionComboBox.setText(condition != null ? condition : "");
|
||||
}
|
||||
|
||||
XBreakpoint<?> masterBreakpoint = myDependentBreakpointManager.getMasterBreakpoint(myBreakpoint);
|
||||
if (masterBreakpoint != null) {
|
||||
myMasterBreakpointComboBox.setSelectedItem(masterBreakpoint);
|
||||
myLeaveEnabledRadioButton.setSelected(myDependentBreakpointManager.isLeaveEnabled(myBreakpoint));
|
||||
}
|
||||
updateAfterBreakpointHitPanel();
|
||||
|
||||
for (XBreakpointCustomPropertiesPanel<B> customPanel : myCustomPanels) {
|
||||
customPanel.loadFrom(myBreakpoint);
|
||||
}
|
||||
@@ -186,16 +133,6 @@ public class XBreakpointPropertiesPanel<B extends XBreakpoint<?>> {
|
||||
onCheckboxChanged();
|
||||
}
|
||||
|
||||
private void fillMasterBreakpointComboBox() {
|
||||
myMasterBreakpointComboBox.removeAllItems();
|
||||
myMasterBreakpointComboBox.addItem(null);
|
||||
for (B breakpoint : myBreakpointManager.getBreakpoints(XBreakpointUtil.getType(myBreakpoint))) {
|
||||
if (breakpoint != myBreakpoint) {
|
||||
myMasterBreakpointComboBox.addItem(breakpoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public B getBreakpoint() {
|
||||
return myBreakpoint;
|
||||
}
|
||||
@@ -205,14 +142,11 @@ public class XBreakpointPropertiesPanel<B extends XBreakpoint<?>> {
|
||||
}
|
||||
|
||||
public void saveProperties() {
|
||||
myBreakpoint.setSuspendPolicy(getConfiguredSuspendPolicy());
|
||||
myBreakpoint.setLogMessage(myLogMessageCheckBox.isSelected());
|
||||
mySuspendPolicyPanel.saveProperties();
|
||||
|
||||
if (myLogExpressionComboBox != null) {
|
||||
String logExpression = myLogExpressionCheckBox.isSelected() ? myLogExpressionComboBox.getText() : null;
|
||||
myBreakpoint.setLogExpression(logExpression);
|
||||
myLogExpressionComboBox.saveTextInHistory();
|
||||
}
|
||||
myBreakpointActionsPanel.saveProperties();
|
||||
|
||||
myMasterBreakpointPanel.saveProperties();
|
||||
|
||||
if (myConditionComboBox != null) {
|
||||
String condition = myConditionCheckBox.isSelected() ? myConditionComboBox.getText() : null;
|
||||
@@ -220,14 +154,6 @@ public class XBreakpointPropertiesPanel<B extends XBreakpoint<?>> {
|
||||
myConditionComboBox.saveTextInHistory();
|
||||
}
|
||||
|
||||
XBreakpoint<?> masterBreakpoint = (XBreakpoint<?>)myMasterBreakpointComboBox.getSelectedItem();
|
||||
if (masterBreakpoint == null) {
|
||||
myDependentBreakpointManager.clearMasterBreakpoint(myBreakpoint);
|
||||
}
|
||||
else {
|
||||
myDependentBreakpointManager.setMasterBreakpoint(myBreakpoint, masterBreakpoint, myLeaveEnabledRadioButton.isSelected());
|
||||
}
|
||||
|
||||
for (XBreakpointCustomPropertiesPanel<B> customPanel : myCustomPanels) {
|
||||
customPanel.saveTo(myBreakpoint);
|
||||
}
|
||||
@@ -236,18 +162,6 @@ public class XBreakpointPropertiesPanel<B extends XBreakpoint<?>> {
|
||||
}
|
||||
}
|
||||
|
||||
private SuspendPolicy getConfiguredSuspendPolicy() {
|
||||
if (!myBreakpoint.getType().isSuspendThreadSupported()) {
|
||||
return mySuspendCheckBox.isSelected() ? SuspendPolicy.ALL : SuspendPolicy.NONE;
|
||||
}
|
||||
|
||||
for (SuspendPolicy policy : mySuspendRadioButtons.keySet()) {
|
||||
if (mySuspendRadioButtons.get(policy).isSelected()) {
|
||||
return policy;
|
||||
}
|
||||
}
|
||||
return SuspendPolicy.ALL;
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
for (XBreakpointCustomPropertiesPanel<B> customPanel : myCustomPanels) {
|
||||
@@ -255,23 +169,4 @@ public class XBreakpointPropertiesPanel<B extends XBreakpoint<?>> {
|
||||
}
|
||||
}
|
||||
|
||||
private static class BreakpointsListCellRenderer<B extends XBreakpoint<?>> extends DefaultListCellRenderer {
|
||||
public Component getListCellRendererComponent(final JList list,
|
||||
final Object value,
|
||||
final int index,
|
||||
final boolean isSelected,
|
||||
final boolean cellHasFocus) {
|
||||
Component component = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
if (value != null) {
|
||||
B breakpoint = (B)value;
|
||||
setText(XBreakpointUtil.getDisplayText(breakpoint));
|
||||
setIcon(breakpoint.getType().getEnabledIcon());
|
||||
}
|
||||
else {
|
||||
setText(XDebuggerBundle.message("xbreakpoint.master.breakpoint.none"));
|
||||
setIcon(null);
|
||||
}
|
||||
return component;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright 2000-2011 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.xdebugger.impl.breakpoints.ui;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpoint;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpointManager;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpointProperties;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpointType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: zajac
|
||||
* Date: 16.06.11
|
||||
* Time: 19:21
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public abstract class XBreakpointPropertiesSubPanel<B extends XBreakpoint<?>> {
|
||||
|
||||
protected Project myProject;
|
||||
protected XBreakpointManager myBreakpointManager;
|
||||
protected B myBreakpoint;
|
||||
protected XBreakpointType<?, ? extends XBreakpointProperties> myBreakpointType;
|
||||
|
||||
public void init(Project project, final XBreakpointManager breakpointManager, @NotNull B breakpoint) {
|
||||
myProject = project;
|
||||
myBreakpointManager = breakpointManager;
|
||||
myBreakpoint = breakpoint;
|
||||
myBreakpointType = breakpoint.getType();
|
||||
}
|
||||
|
||||
abstract void loadProperties();
|
||||
|
||||
abstract void saveProperties();
|
||||
|
||||
public boolean lightVariant(boolean showAllOptions) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
<?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="7" 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="500" height="400"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<vspacer id="71127">
|
||||
<constraints>
|
||||
<grid row="6" 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"/>
|
||||
<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>
|
||||
<component id="76b8d" 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>
|
||||
<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="3" anchor="0" fill="3" indent="1" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children/>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
<nested-form id="11152" form-file="com/intellij/xdebugger/impl/breakpoints/ui/XSuspendPolicyPanel.form" binding="mySuspendPolicyPanel">
|
||||
<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>
|
||||
</nested-form>
|
||||
<nested-form id="e13dc" form-file="com/intellij/xdebugger/impl/breakpoints/ui/XBreakpointActionsPanel.form" binding="myActionsPanel">
|
||||
<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"/>
|
||||
</constraints>
|
||||
</nested-form>
|
||||
<nested-form id="26e47" form-file="com/intellij/xdebugger/impl/breakpoints/ui/XMasterBreakpointPanel.form" binding="myMasterBreakpointPanel">
|
||||
<constraints>
|
||||
<grid row="3" 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>
|
||||
<component id="a1fd9" class="com.intellij.ui.components.labels.LinkLabel" binding="myShowMoreOptionsLink" custom-create="true">
|
||||
<constraints>
|
||||
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<grid id="24056" binding="myCustomPropertiesPanelWrapper" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
<constraints>
|
||||
<grid row="4" 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>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
+166
@@ -0,0 +1,166 @@
|
||||
/*
|
||||
* Copyright 2000-2011 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.xdebugger.impl.breakpoints.ui;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.ui.components.labels.LinkLabel;
|
||||
import com.intellij.ui.components.labels.LinkListener;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpoint;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpointManager;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpointType;
|
||||
import com.intellij.xdebugger.breakpoints.ui.XBreakpointCustomPropertiesPanel;
|
||||
import com.intellij.xdebugger.evaluation.XDebuggerEditorsProvider;
|
||||
import com.intellij.xdebugger.impl.breakpoints.XBreakpointBase;
|
||||
import com.intellij.xdebugger.impl.breakpoints.XBreakpointUtil;
|
||||
import com.intellij.xdebugger.impl.ui.XDebuggerExpressionComboBox;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: zajac
|
||||
* Date: 16.06.11
|
||||
* Time: 15:46
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public class XLightBreakpointPropertiesPanel<B extends XBreakpoint<?>> {
|
||||
|
||||
private LinkLabel myShowMoreOptionsLink;
|
||||
|
||||
private void createUIComponents() {
|
||||
myShowMoreOptionsLink = new LinkLabel("More Options", null, new LinkListener() {
|
||||
@Override
|
||||
public void linkSelected(LinkLabel aSource, Object aLinkData) {
|
||||
if (myDelegate != null) {
|
||||
myDelegate.showMoreOptions();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public interface Delegate {
|
||||
void showMoreOptions();
|
||||
}
|
||||
|
||||
private JPanel myConditionExpressionPanel;
|
||||
private JPanel myConditionPanel;
|
||||
private JPanel myMainPanel;
|
||||
|
||||
public Delegate getDelegate() {
|
||||
return myDelegate;
|
||||
}
|
||||
|
||||
public void setDelegate(Delegate delegate) {
|
||||
myDelegate = delegate;
|
||||
}
|
||||
|
||||
private Delegate myDelegate;
|
||||
|
||||
private XSuspendPolicyPanel<B> mySuspendPolicyPanel;
|
||||
private XBreakpointActionsPanel<B> myActionsPanel;
|
||||
private XMasterBreakpointPanel<B> myMasterBreakpointPanel;
|
||||
private JPanel myCustomPropertiesPanelWrapper;
|
||||
private final List<XBreakpointCustomPropertiesPanel<B>> myCustomPanels;
|
||||
|
||||
private List<XBreakpointPropertiesSubPanel<B>> mySubPanels = new ArrayList<XBreakpointPropertiesSubPanel<B>>();
|
||||
|
||||
private XDebuggerExpressionComboBox myConditionComboBox;
|
||||
|
||||
private B myBreakpoint;
|
||||
|
||||
public XLightBreakpointPropertiesPanel(Project project, XBreakpointManager breakpointManager, B breakpoint, boolean showAllOptions) {
|
||||
myBreakpoint = breakpoint;
|
||||
XBreakpointType<B, ?> breakpointType = XBreakpointUtil.getType(breakpoint);
|
||||
|
||||
mySuspendPolicyPanel.init(project, breakpointManager, breakpoint);
|
||||
mySubPanels.add(mySuspendPolicyPanel);
|
||||
myMasterBreakpointPanel.init(project, breakpointManager, breakpoint);
|
||||
mySubPanels.add(myMasterBreakpointPanel);
|
||||
XDebuggerEditorsProvider debuggerEditorsProvider = breakpointType.getEditorsProvider();
|
||||
|
||||
myActionsPanel.init(project, breakpointManager, breakpoint, debuggerEditorsProvider);
|
||||
mySubPanels.add(myActionsPanel);
|
||||
|
||||
if (debuggerEditorsProvider != null) {
|
||||
myConditionComboBox = new XDebuggerExpressionComboBox(project, debuggerEditorsProvider, "breakpointCondition", myBreakpoint.getSourcePosition());
|
||||
JComponent conditionComponent = myConditionComboBox.getComponent();
|
||||
myConditionExpressionPanel.add(conditionComponent, BorderLayout.CENTER);
|
||||
} else {
|
||||
myConditionPanel.setVisible(false);
|
||||
}
|
||||
|
||||
boolean showMoreOptions = false;
|
||||
for (XBreakpointPropertiesSubPanel<B> panel : mySubPanels) {
|
||||
if (panel.lightVariant(showAllOptions)) {
|
||||
showMoreOptions = true;
|
||||
}
|
||||
}
|
||||
|
||||
myShowMoreOptionsLink.setVisible(showMoreOptions);
|
||||
|
||||
myCustomPanels = new ArrayList<XBreakpointCustomPropertiesPanel<B>>();
|
||||
XBreakpointCustomPropertiesPanel<B> customPropertiesPanel = breakpointType.createCustomPropertiesPanel();
|
||||
if (customPropertiesPanel != null) {
|
||||
myCustomPropertiesPanelWrapper.add(customPropertiesPanel.getComponent(), BorderLayout.CENTER);
|
||||
myCustomPanels.add(customPropertiesPanel);
|
||||
}
|
||||
|
||||
loadProperties();
|
||||
}
|
||||
|
||||
public void saveProperties() {
|
||||
for (XBreakpointPropertiesSubPanel<B> panel : mySubPanels) {
|
||||
panel.saveProperties();
|
||||
}
|
||||
|
||||
if (myConditionComboBox != null) {
|
||||
final String text = myConditionComboBox.getText();
|
||||
final String condition = StringUtil.isEmptyOrSpaces(text) ? null : text;
|
||||
myBreakpoint.setCondition(condition);
|
||||
myConditionComboBox.saveTextInHistory();
|
||||
}
|
||||
|
||||
for (XBreakpointCustomPropertiesPanel<B> customPanel : myCustomPanels) {
|
||||
customPanel.saveTo(myBreakpoint);
|
||||
}
|
||||
if (!myCustomPanels.isEmpty()) {
|
||||
((XBreakpointBase)myBreakpoint).fireBreakpointChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void loadProperties() {
|
||||
for (XBreakpointPropertiesSubPanel<B> panel : mySubPanels) {
|
||||
panel.loadProperties();
|
||||
}
|
||||
|
||||
if (myConditionComboBox != null) {
|
||||
String condition = myBreakpoint.getCondition();
|
||||
myConditionComboBox.setText(condition != null ? condition : "");
|
||||
}
|
||||
|
||||
for (XBreakpointCustomPropertiesPanel<B> customPanel : myCustomPanels) {
|
||||
customPanel.loadFrom(myBreakpoint);
|
||||
}
|
||||
}
|
||||
|
||||
public JComponent getMainPanel() {
|
||||
return myMainPanel;
|
||||
}
|
||||
}
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
<?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.XMasterBreakpointPanel">
|
||||
<grid id="27dc6" binding="myContentPane" 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="470" height="85"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="8350" binding="myMainPanel" layout-manager="GridLayoutManager" row-count="2" 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="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="etched" title-resource-bundle="messages/XDebuggerBundle" title-key="xbreakpoint.group.depends.on"/>
|
||||
<children>
|
||||
<grid id="a3556" binding="myMasterBreakpointComboBoxPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="3" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children/>
|
||||
</grid>
|
||||
<grid id="a87ff" binding="myAfterBreakpointHitPanel" layout-manager="GridLayoutManager" row-count="1" 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="1" column="0" row-span="1" col-span="3" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="87b6a" 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 resource-bundle="messages/XDebuggerBundle" key="xbreakpoint.label.after.breakpoint.was.hit"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="8b5ce" class="javax.swing.JRadioButton">
|
||||
<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"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<selected value="true"/>
|
||||
<text resource-bundle="messages/XDebuggerBundle" key="xbreakpoint.radio.disable.again"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="44673" class="javax.swing.JRadioButton" binding="myLeaveEnabledRadioButton" default-binding="true">
|
||||
<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/XDebuggerBundle" key="xbreakpoint.radio.leave.enabled"/>
|
||||
</properties>
|
||||
</component>
|
||||
<hspacer id="2c916">
|
||||
<constraints>
|
||||
<grid row="0" column="3" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</hspacer>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
+133
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
* Copyright 2000-2011 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.xdebugger.impl.breakpoints.ui;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.ComboBox;
|
||||
import com.intellij.ui.GuiUtils;
|
||||
import com.intellij.xdebugger.XDebuggerBundle;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpoint;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpointManager;
|
||||
import com.intellij.xdebugger.impl.breakpoints.XBreakpointManagerImpl;
|
||||
import com.intellij.xdebugger.impl.breakpoints.XBreakpointUtil;
|
||||
import com.intellij.xdebugger.impl.breakpoints.XDependentBreakpointManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: zajac
|
||||
* Date: 16.06.11
|
||||
* Time: 21:26
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public class XMasterBreakpointPanel<B extends XBreakpoint<?>> extends XBreakpointPropertiesSubPanel<B> {
|
||||
private JPanel myMasterBreakpointComboBoxPanel;
|
||||
private JPanel myAfterBreakpointHitPanel;
|
||||
private JRadioButton myLeaveEnabledRadioButton;
|
||||
private JPanel myContentPane;
|
||||
private JPanel myMainPanel;
|
||||
|
||||
private ComboBox myMasterBreakpointComboBox;
|
||||
private XDependentBreakpointManager myDependentBreakpointManager;
|
||||
|
||||
private static class BreakpointsListCellRenderer<B extends XBreakpoint<?>> extends DefaultListCellRenderer {
|
||||
public Component getListCellRendererComponent(final JList list,
|
||||
final Object value,
|
||||
final int index,
|
||||
final boolean isSelected,
|
||||
final boolean cellHasFocus) {
|
||||
Component component = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
if (value != null) {
|
||||
B breakpoint = (B)value;
|
||||
setText(XBreakpointUtil.getDisplayText(breakpoint));
|
||||
setIcon(breakpoint.getType().getEnabledIcon());
|
||||
}
|
||||
else {
|
||||
setText(XDebuggerBundle.message("xbreakpoint.master.breakpoint.none"));
|
||||
setIcon(null);
|
||||
}
|
||||
return component;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Project project, XBreakpointManager breakpointManager, @NotNull B breakpoint) {
|
||||
super.init(project, breakpointManager, breakpoint);
|
||||
myDependentBreakpointManager = ((XBreakpointManagerImpl)breakpointManager).getDependentBreakpointManager();
|
||||
myMasterBreakpointComboBox = new ComboBox(300);
|
||||
myMasterBreakpointComboBoxPanel.add(myMasterBreakpointComboBox, BorderLayout.CENTER);
|
||||
myMasterBreakpointComboBox.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
updateAfterBreakpointHitPanel();
|
||||
}
|
||||
});
|
||||
myMasterBreakpointComboBox.setRenderer(new BreakpointsListCellRenderer<B>());
|
||||
fillMasterBreakpointComboBox();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean lightVariant(boolean showAllOptions) {
|
||||
XBreakpoint<?> masterBreakpoint = myDependentBreakpointManager.getMasterBreakpoint(myBreakpoint);
|
||||
if (!showAllOptions && masterBreakpoint == null) {
|
||||
myMainPanel.setVisible(false);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void fillMasterBreakpointComboBox() {
|
||||
myMasterBreakpointComboBox.removeAllItems();
|
||||
myMasterBreakpointComboBox.addItem(null);
|
||||
for (B breakpoint : myBreakpointManager.getBreakpoints(XBreakpointUtil.getType(myBreakpoint))) {
|
||||
if (breakpoint != myBreakpoint) {
|
||||
myMasterBreakpointComboBox.addItem(breakpoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void updateAfterBreakpointHitPanel() {
|
||||
boolean enable = myMasterBreakpointComboBox.getSelectedItem() != null;
|
||||
GuiUtils.enableChildren(enable, myAfterBreakpointHitPanel);
|
||||
}
|
||||
|
||||
@Override
|
||||
void loadProperties() {
|
||||
XBreakpoint<?> masterBreakpoint = myDependentBreakpointManager.getMasterBreakpoint(myBreakpoint);
|
||||
if (masterBreakpoint != null) {
|
||||
myMasterBreakpointComboBox.setSelectedItem(masterBreakpoint);
|
||||
myLeaveEnabledRadioButton.setSelected(myDependentBreakpointManager.isLeaveEnabled(myBreakpoint));
|
||||
}
|
||||
updateAfterBreakpointHitPanel();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
void saveProperties() {
|
||||
XBreakpoint<?> masterBreakpoint = (XBreakpoint<?>)myMasterBreakpointComboBox.getSelectedItem();
|
||||
if (masterBreakpoint == null) {
|
||||
myDependentBreakpointManager.clearMasterBreakpoint(myBreakpoint);
|
||||
}
|
||||
else {
|
||||
myDependentBreakpointManager.setMasterBreakpoint(myBreakpoint, masterBreakpoint, myLeaveEnabledRadioButton.isSelected());
|
||||
}
|
||||
}
|
||||
}
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
<?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.XSuspendPolicyPanel">
|
||||
<grid id="27dc6" binding="myContentPane" 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="537" height="56"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="e69ea" binding="mySuspendPolicyPanel" layout-manager="CardLayout" 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="etched" title-resource-bundle="messages/XDebuggerBundle" title-key="xbreakpoints.suspend.group.title"/>
|
||||
<children>
|
||||
<grid id="190d5" 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="checkbox"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="ac150" class="javax.swing.JCheckBox" binding="mySuspendCheckBox" default-binding="true">
|
||||
<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 resource-bundle="messages/XDebuggerBundle" key="xbreakpoints.suspend.checkbox"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="f5e5" layout-manager="GridLayoutManager" row-count="1" 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>
|
||||
<card name="radioButtons"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="aba21" class="javax.swing.JRadioButton" binding="mySuspendAllRadioButton">
|
||||
<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 resource-bundle="messages/XDebuggerBundle" key="xbreakpoints.suspend.all.radio"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="91d9b" class="javax.swing.JRadioButton" binding="mySuspendThreadRadioButton">
|
||||
<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"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text resource-bundle="messages/XDebuggerBundle" key="xbreakpoints.suspend.thread.radio"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="fbfd7" class="javax.swing.JRadioButton" binding="mySuspendNoneRadioButton">
|
||||
<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/XDebuggerBundle" key="xbreakpoints.suspend.none.radio"/>
|
||||
</properties>
|
||||
</component>
|
||||
<hspacer id="d9eab">
|
||||
<constraints>
|
||||
<grid row="0" column="3" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</hspacer>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright 2000-2011 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.xdebugger.impl.breakpoints.ui;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.xdebugger.breakpoints.SuspendPolicy;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpoint;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpointManager;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: zajac
|
||||
* Date: 16.06.11
|
||||
* Time: 17:40
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public class XSuspendPolicyPanel<B extends XBreakpoint<?>> extends XBreakpointPropertiesSubPanel<B> {
|
||||
|
||||
private JPanel mySuspendPolicyPanel;
|
||||
private JCheckBox mySuspendCheckBox;
|
||||
private JRadioButton mySuspendAllRadioButton;
|
||||
private JRadioButton mySuspendThreadRadioButton;
|
||||
private JRadioButton mySuspendNoneRadioButton;
|
||||
private JPanel myContentPane;
|
||||
private Map<SuspendPolicy, JRadioButton> mySuspendRadioButtons;
|
||||
|
||||
public void init(Project project, final XBreakpointManager breakpointManager, @NotNull B breakpoint) {
|
||||
super.init(project, breakpointManager, breakpoint);
|
||||
mySuspendRadioButtons = new HashMap<SuspendPolicy, JRadioButton>();
|
||||
mySuspendRadioButtons.put(SuspendPolicy.ALL, mySuspendAllRadioButton);
|
||||
mySuspendRadioButtons.put(SuspendPolicy.THREAD, mySuspendThreadRadioButton);
|
||||
mySuspendRadioButtons.put(SuspendPolicy.NONE, mySuspendNoneRadioButton);
|
||||
@NonNls String card = myBreakpointType.isSuspendThreadSupported() ? "radioButtons" : "checkbox";
|
||||
((CardLayout)mySuspendPolicyPanel.getLayout()).show(mySuspendPolicyPanel, card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean lightVariant(boolean showAllOptions) {
|
||||
mySuspendPolicyPanel.setBorder(null);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
void loadProperties() {
|
||||
SuspendPolicy suspendPolicy = myBreakpoint.getSuspendPolicy();
|
||||
mySuspendRadioButtons.get(suspendPolicy).setSelected(true);
|
||||
mySuspendCheckBox.setSelected(suspendPolicy != SuspendPolicy.NONE);
|
||||
}
|
||||
|
||||
private SuspendPolicy getConfiguredSuspendPolicy() {
|
||||
if (!myBreakpoint.getType().isSuspendThreadSupported()) {
|
||||
return mySuspendCheckBox.isSelected() ? SuspendPolicy.ALL : SuspendPolicy.NONE;
|
||||
}
|
||||
|
||||
for (SuspendPolicy policy : mySuspendRadioButtons.keySet()) {
|
||||
if (mySuspendRadioButtons.get(policy).isSelected()) {
|
||||
return policy;
|
||||
}
|
||||
}
|
||||
return SuspendPolicy.ALL;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
void saveProperties() {
|
||||
myBreakpoint.setSuspendPolicy(getConfiguredSuspendPolicy());
|
||||
}
|
||||
}
|
||||
@@ -20,14 +20,16 @@ import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.LogicalPosition;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.popup.JBPopup;
|
||||
import com.intellij.openapi.ui.popup.JBPopupFactory;
|
||||
import com.intellij.openapi.ui.popup.*;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.DimensionService;
|
||||
import com.intellij.openapi.wm.WindowManager;
|
||||
import com.intellij.ui.ScrollPaneFactory;
|
||||
import com.intellij.ui.awt.RelativePoint;
|
||||
import com.intellij.xdebugger.XDebuggerManager;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpoint;
|
||||
import com.intellij.xdebugger.frame.XFullValueEvaluator;
|
||||
import com.intellij.xdebugger.impl.breakpoints.ui.XLightBreakpointPropertiesPanel;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -133,6 +135,48 @@ public class DebuggerUIUtil {
|
||||
popup.show(point);
|
||||
}
|
||||
|
||||
public static void showBreakpointEditorBalloon(final Project project,
|
||||
@Nullable final Point point, final JComponent gutterComponent,
|
||||
final boolean showAllOptions,
|
||||
final XBreakpoint breakpoint) {
|
||||
final XLightBreakpointPropertiesPanel propertiesPanel =
|
||||
new XLightBreakpointPropertiesPanel(project, XDebuggerManager.getInstance(project).getBreakpointManager(),
|
||||
breakpoint, showAllOptions);
|
||||
|
||||
final Balloon balloon = JBPopupFactory.getInstance().createBalloonBuilder(propertiesPanel.getMainPanel()).
|
||||
setHideOnAction(false).
|
||||
setHideOnClickOutside(false).
|
||||
setHideOnKeyOutside(false).
|
||||
setCloseButtonEnabled(true).
|
||||
setDialogMode(true).
|
||||
setFillColor(propertiesPanel.getMainPanel().getBackground()).
|
||||
setTitle(breakpoint.getType().getDisplayText(breakpoint)).
|
||||
setHideOnFrameResize(false).createBalloon();
|
||||
balloon.addListener(new JBPopupListener() {
|
||||
@Override
|
||||
public void beforeShown(LightweightWindowEvent event) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClosed(LightweightWindowEvent event) {
|
||||
propertiesPanel.saveProperties();
|
||||
}
|
||||
});
|
||||
propertiesPanel.setDelegate(new XLightBreakpointPropertiesPanel.Delegate() {
|
||||
@Override
|
||||
public void showMoreOptions() {
|
||||
balloon.hide();
|
||||
showBreakpointEditorBalloon(project, point, gutterComponent, true, breakpoint);
|
||||
}
|
||||
});
|
||||
|
||||
if (point == null) {
|
||||
balloon.showInCenterOf(gutterComponent);
|
||||
} else {
|
||||
balloon.show(new RelativePoint(gutterComponent, point), Balloon.Position.atRight);
|
||||
}
|
||||
}
|
||||
|
||||
private static class FullValueEvaluationCallbackImpl implements XFullValueEvaluator.XFullValueEvaluationCallback {
|
||||
private final AtomicBoolean myObsolete = new AtomicBoolean(false);
|
||||
private final JTextArea myTextArea;
|
||||
|
||||
Reference in New Issue
Block a user