more on Breakpoint Editor. more options are visible if set. ESC/Ctrl-ENTER to end editing.

This commit is contained in:
andrey.zaytsev
2012-04-07 16:10:18 +04:00
parent 36db43a5ab
commit 010e06437d
8 changed files with 62 additions and 17 deletions
@@ -460,7 +460,7 @@ public class BreakpointPanel extends AbstractBreakpointPanel<Breakpoint> {
if (oldViewableBreakpoint == null) {
((CardLayout)myPropertiesPanelPlace.getLayout()).show(myPropertiesPanelPlace, PROPERTIES_DATA);
}
myPropertiesPanel.initFrom(myCurrentViewableBreakpoint);
myPropertiesPanel.initFrom(myCurrentViewableBreakpoint, true);
}
else {
((CardLayout)myPropertiesPanelPlace.getLayout()).show(myPropertiesPanelPlace, PROPERTIES_STUB);
@@ -108,6 +108,10 @@ public abstract class BreakpointPropertiesPanel {
private final FixedSizeButton myConditionMagnifierButton;
private boolean myMoreOptionsVisible = true;
public boolean isMoreOptionsVisible() {
return myMoreOptionsVisible;
}
public interface Delegate {
void showActionsPanel();
@@ -142,12 +146,12 @@ public abstract class BreakpointPropertiesPanel {
myMoreOptionsVisible = b;
myDependsOnPanel.setVisible(b);
myConditionsPanel.setVisible(b);
myActionsPanel.setVisible(b);
if (!b) {
myConditionPlaceholder.remove(myConditionPanel);
myCompactConditionsPanel.add(myConditionPanel, BorderLayout.CENTER);
}
else {
myActionsPanel.setVisible(true);
myCompactConditionsPanel.remove(myConditionPanel);
myConditionPlaceholder.add(myConditionPanel, BorderLayout.CENTER);
}
@@ -361,16 +365,25 @@ public abstract class BreakpointPropertiesPanel {
/**
* Init UI components with the values from Breakpoint
*/
public void initFrom(Breakpoint breakpoint) {
public void initFrom(Breakpoint breakpoint, boolean moreOptionsVisible1) {
boolean moreOptionsVisible = moreOptionsVisible1;
boolean actionsPanelVisible = moreOptionsVisible1;
myBreakpointComboboxHandler.initFrom(breakpoint);
myPassCountField.setText(breakpoint.COUNT_FILTER > 0 ? Integer.toString(breakpoint.COUNT_FILTER) : "");
if (breakpoint.COUNT_FILTER > 0) {
myPassCountField.setText(Integer.toString(breakpoint.COUNT_FILTER));
moreOptionsVisible = true;
}
else {
myPassCountField.setText("");
}
PsiElement context = breakpoint.getEvaluationElement();
myPassCountCheckbox.setSelected(breakpoint.COUNT_FILTER_ENABLED);
myConditionCheckbox.setSelected(breakpoint.CONDITION_ENABLED);
if(DebuggerSettings.SUSPEND_NONE.equals(breakpoint.SUSPEND_POLICY)) {
mySuspendPolicyGroup.setSelected(mySuspendNoneRadio.getModel(), true);
setActionsPanelVisible(true);
actionsPanelVisible = true;
}
else if(DebuggerSettings.SUSPEND_THREAD.equals(breakpoint.SUSPEND_POLICY)){
mySuspendPolicyGroup.setSelected(mySuspendThreadRadio.getModel(), true);
@@ -392,20 +405,35 @@ public abstract class BreakpointPropertiesPanel {
});
myLogMessageCheckBox.setSelected(breakpoint.LOG_ENABLED);
myLogExpressionCheckBox.setSelected(breakpoint.LOG_EXPRESSION_ENABLED);
if (breakpoint.LOG_ENABLED || breakpoint.LOG_EXPRESSION_ENABLED) {
actionsPanelVisible = true;
}
myConditionCombo.setContext(context);
myConditionCombo.setText(breakpoint.getCondition() != null ? breakpoint.getCondition() : new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, ""));
myLogExpressionCombo.setContext(context);
myLogExpressionCombo.setText(breakpoint.getLogMessage() != null? breakpoint.getLogMessage() : new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, ""));
if (breakpoint.getLogMessage() != null) {
myLogExpressionCombo.setText(breakpoint.getLogMessage());
}
else {
myLogExpressionCombo.setText(new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, ""));
}
myLogExpressionCombo.setEnabled(breakpoint.LOG_EXPRESSION_ENABLED);
if (breakpoint.LOG_EXPRESSION_ENABLED) {
actionsPanelVisible = true;
}
myInstanceFiltersCheckBox.setSelected(breakpoint.INSTANCE_FILTERS_ENABLED);
myInstanceFiltersField.setEnabled(breakpoint.INSTANCE_FILTERS_ENABLED);
myInstanceFiltersField.getTextField().setEditable(breakpoint.INSTANCE_FILTERS_ENABLED);
myInstanceFilters = breakpoint.getInstanceFilters();
updateInstanceFilterEditor(true);
if (breakpoint.INSTANCE_FILTERS_ENABLED) {
moreOptionsVisible = true;
}
myClassFiltersCheckBox.setSelected(breakpoint.CLASS_FILTERS_ENABLED);
myClassFiltersField.setEnabled(breakpoint.CLASS_FILTERS_ENABLED);
@@ -413,10 +441,16 @@ public abstract class BreakpointPropertiesPanel {
myClassFilters = breakpoint.getClassFilters();
myClassExclusionFilters = breakpoint.getClassExclusionFilters();
updateClassFilterEditor(true);
if (breakpoint.CLASS_FILTERS_ENABLED) {
moreOptionsVisible = true;
}
myBreakpointPsiClass = breakpoint.getPsiClass();
updateCheckboxes();
setActionsPanelVisible(actionsPanelVisible && !moreOptionsVisible1);
setMoreOptionsVisible(moreOptionsVisible);
}
/**
@@ -93,10 +93,10 @@ public class ExceptionBreakpointPropertiesPanel extends BreakpointPropertiesPane
myPassCountCheckbox.setEnabled(!(myExceptionBreakpoint instanceof AnyExceptionBreakpoint));
}
public void initFrom(Breakpoint breakpoint) {
public void initFrom(Breakpoint breakpoint, boolean moreOptionsVisible) {
ExceptionBreakpoint exceptionBreakpoint = (ExceptionBreakpoint)breakpoint;
myExceptionBreakpoint = exceptionBreakpoint;
super.initFrom(breakpoint);
super.initFrom(breakpoint, moreOptionsVisible);
myNotifyCaughtCheckBox.setSelected(exceptionBreakpoint.NOTIFY_CAUGHT);
myNotifyUncaughtCheckBox.setSelected(exceptionBreakpoint.NOTIFY_UNCAUGHT);
@@ -84,8 +84,8 @@ public class FieldBreakpointPropertiesPanel extends BreakpointPropertiesPanel {
return _panel;
}
public void initFrom(Breakpoint breakpoint) {
super.initFrom(breakpoint);
public void initFrom(Breakpoint breakpoint, boolean moreOptionsVisible) {
super.initFrom(breakpoint, moreOptionsVisible);
FieldBreakpoint fieldBreakpoint = (FieldBreakpoint)breakpoint;
myWatchAccessCheckBox.setSelected(fieldBreakpoint.WATCH_ACCESS);
@@ -83,8 +83,8 @@ public class MethodBreakpointPropertiesPanel extends BreakpointPropertiesPanel {
return _panel;
}
public void initFrom(Breakpoint breakpoint) {
super.initFrom(breakpoint);
public void initFrom(Breakpoint breakpoint, boolean moreOptionsVisible) {
super.initFrom(breakpoint, moreOptionsVisible);
if (breakpoint instanceof MethodBreakpoint) {
MethodBreakpoint methodBreakpoint = (MethodBreakpoint)breakpoint;
myWatchEntryCheckBox.setSelected(methodBreakpoint.WATCH_ENTRY);
@@ -55,8 +55,7 @@ public class JavaEditBreakpointAction extends EditBreakpointAction {
assert breakpointFactory != null : "can't find factory for breakpoint " + myBreakpointWithHighlighter;
final BreakpointPropertiesPanel propertiesPanel = breakpointFactory.createBreakpointPropertiesPanel(project);
propertiesPanel.setMoreOptionsVisible(false);
propertiesPanel.initFrom(myBreakpointWithHighlighter);
propertiesPanel.initFrom(myBreakpointWithHighlighter, false);
final JComponent mainPanel = propertiesPanel.getPanel();
final String displayName = myBreakpointWithHighlighter.getDisplayName();
@@ -84,7 +83,7 @@ public class JavaEditBreakpointAction extends EditBreakpointAction {
newBalloon.addListener(saveOnClose);
}
};
final Balloon balloon = DebuggerUIUtil.showBreakpointEditor(mainPanel, displayName, whereToShow, gutterComponent, showMoreOptions);
final Balloon balloon = DebuggerUIUtil.showBreakpointEditor(mainPanel, displayName, whereToShow, gutterComponent, propertiesPanel.isMoreOptionsVisible() ? null : showMoreOptions);
balloon.addListener(saveOnClose);
propertiesPanel.setDelegate(new BreakpointPropertiesPanel.Delegate() {
@@ -92,7 +91,8 @@ public class JavaEditBreakpointAction extends EditBreakpointAction {
public void showActionsPanel() {
propertiesPanel.setActionsPanelVisible(true);
balloon.hide();
final Balloon newBalloon = DebuggerUIUtil.showBreakpointEditor(mainPanel, displayName, whereToShow, gutterComponent, showMoreOptions);
final Balloon newBalloon =
DebuggerUIUtil.showBreakpointEditor(mainPanel, displayName, whereToShow, gutterComponent, showMoreOptions);
newBalloon.addListener(saveOnClose);
}
});
@@ -15,6 +15,10 @@
*/
package com.intellij.xdebugger.impl.ui;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CompositeShortcutSet;
import com.intellij.openapi.actionSystem.CustomShortcutSet;
import com.intellij.ui.components.labels.LinkLabel;
import com.intellij.ui.components.labels.LinkListener;
@@ -69,6 +73,13 @@ public class BreakpointEditor {
done();
}
});
final AnAction doneAction = new AnAction() {
public void actionPerformed(AnActionEvent e) {
done();
}
};
doneAction.registerCustomShortcutSet(new CompositeShortcutSet(CustomShortcutSet.fromString("ESCAPE"), CustomShortcutSet.fromString("control ENTER")), myMainPanel);
}
private void done() {
@@ -245,7 +245,7 @@ public class DebuggerUIUtil {
final Balloon balloon = JBPopupFactory.getInstance().
createDialogBalloonBuilder(editor.getMainPanel(), displayName).
setHideOnClickOutside(true).
setHideOnClickOutside(false).
setCloseButtonEnabled(false).
createBalloon();