diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/Breakpoint.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/Breakpoint.java
index 94b2f09b6cba..470890d7aa09 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/Breakpoint.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/Breakpoint.java
@@ -562,7 +562,7 @@ public abstract class Breakpoint
implements
}
}
- private static SuspendPolicy transformSuspendPolicy(String policy) {
+ static SuspendPolicy transformSuspendPolicy(String policy) {
if (DebuggerSettings.SUSPEND_ALL.equals(policy)) {
return SuspendPolicy.ALL;
} else if (DebuggerSettings.SUSPEND_THREAD.equals(policy)) {
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointManager.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointManager.java
index 9ff5dee71e91..d832501571ce 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointManager.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointManager.java
@@ -54,6 +54,7 @@ import com.intellij.xdebugger.XDebuggerUtil;
import com.intellij.xdebugger.breakpoints.*;
import com.intellij.xdebugger.impl.DebuggerSupport;
import com.intellij.xdebugger.impl.XDebugSessionImpl;
+import com.intellij.xdebugger.impl.breakpoints.BreakpointState;
import com.intellij.xdebugger.impl.breakpoints.XBreakpointManagerImpl;
import com.intellij.xdebugger.impl.breakpoints.XDependentBreakpointManager;
import com.sun.jdi.InternalException;
@@ -85,7 +86,7 @@ public class BreakpointManager {
private final Map myBreakpoints = new HashMap(); // breakpoints storage, access should be synchronized
@Nullable private List myBreakpointsListForIteration = null; // another list for breakpoints iteration, unsynchronized access ok
private final Map myUIProperties = new LinkedHashMap();
- private final Map, BreakpointDefaults> myBreakpointDefaults = new LinkedHashMap, BreakpointDefaults>();
+ //private final Map, BreakpointDefaults> myBreakpointDefaults = new LinkedHashMap, BreakpointDefaults>();
private final EventDispatcher myDispatcher = EventDispatcher.create(BreakpointManagerListener.class);
@@ -190,17 +191,34 @@ public class BreakpointManager {
});
}
- @NotNull
- public BreakpointDefaults getBreakpointDefaults(Key extends Breakpoint> category) {
- BreakpointDefaults defaults = myBreakpointDefaults.get(category);
- if (defaults == null) {
- defaults = new BreakpointDefaults();
- }
- return defaults;
- }
+ //@NotNull
+ //public BreakpointDefaults getBreakpointDefaults(Key extends Breakpoint> category) {
+ // BreakpointDefaults defaults = myBreakpointDefaults.get(category);
+ // if (defaults == null) {
+ // defaults = new BreakpointDefaults();
+ // }
+ // return defaults;
+ //}
public void setBreakpointDefaults(Key extends Breakpoint> category, BreakpointDefaults defaults) {
- myBreakpointDefaults.put(category, defaults);
+ Class typeCls = null;
+ if (LineBreakpoint.CATEGORY.toString().equals(category.toString())) {
+ typeCls = JavaLineBreakpointType.class;
+ }
+ else if (MethodBreakpoint.CATEGORY.toString().equals(category.toString())) {
+ typeCls = JavaMethodBreakpointType.class;
+ }
+ else if (FieldBreakpoint.CATEGORY.toString().equals(category.toString())) {
+ typeCls = JavaFieldBreakpointType.class;
+ }
+ else if (ExceptionBreakpoint.CATEGORY.toString().equals(category.toString())) {
+ typeCls = JavaExceptionBreakpointType.class;
+ }
+ if (typeCls != null) {
+ XBreakpointType, ?> type = XDebuggerUtil.getInstance().findBreakpointType(typeCls);
+ BreakpointState.setDefaultSuspendPolicy(type.getId(), Breakpoint.transformSuspendPolicy(defaults.getSuspendPolicy()));
+ }
+ //myBreakpointDefaults.put(category, defaults);
}
@@ -421,6 +439,10 @@ public class BreakpointManager {
if (group.getName().equals(RULES_GROUP_NAME)) {
continue;
}
+ // skip already converted
+ if (group.getAttribute(CONVERTED_PARAM) != null) {
+ continue;
+ }
final String categoryName = group.getName();
final Key breakpointCategory = BreakpointCategory.lookup(categoryName);
final String defaultPolicy = group.getAttributeValue(DEFAULT_SUSPEND_POLICY_ATTRIBUTE_NAME);
@@ -433,10 +455,6 @@ public class BreakpointManager {
//final BreakpointFactory factory = BreakpointFactory.getInstance(breakpointCategory);
//if (factory != null) {
for (Element breakpointNode : group.getChildren("breakpoint")) {
- // skip already converted
- if (breakpointNode.getAttribute(CONVERTED_PARAM) != null) {
- continue;
- }
//Breakpoint breakpoint = factory.createBreakpoint(myProject, breakpointNode);
Breakpoint breakpoint = createBreakpoint(categoryName, breakpointNode);
breakpoint.readExternal(breakpointNode);
@@ -624,20 +642,10 @@ public class BreakpointManager {
public void writeExternal(@NotNull final Element parentNode) {
// restore old breakpoints
for (Element group : myOriginalBreakpointsNodes) {
+ if (group.getAttribute(CONVERTED_PARAM) == null) {
+ group.setAttribute(CONVERTED_PARAM, "true");
+ }
group.detach();
- for (Element breakpoint : group.getChildren("breakpoint")) {
- if (breakpoint.getAttribute(CONVERTED_PARAM) == null) {
- breakpoint.setAttribute(CONVERTED_PARAM, "true");
- }
- }
- if (RULES_GROUP_NAME.equals(group.getName())) {
- List rules = group.getChildren("rule");
- for (Element rule : rules) {
- if (rule.getAttribute(CONVERTED_PARAM) == null) {
- rule.setAttribute(CONVERTED_PARAM, "true");
- }
- }
- }
}
parentNode.addContent(myOriginalBreakpointsNodes);
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointPropertiesPanel.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointPropertiesPanel.java
index ad9d5c93a47a..afeeb13aeb10 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointPropertiesPanel.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointPropertiesPanel.java
@@ -211,8 +211,8 @@ public abstract class BreakpointPropertiesPanel {
final ItemListener suspendPolicyChangeListener = new ItemListener() {
@Override
public void itemStateChanged(final ItemEvent e) {
- final BreakpointDefaults defaults = getBreakpointManager(myProject).getBreakpointDefaults(breakpointCategory);
- myMakeDefaultButton.setEnabled(!defaults.getSuspendPolicy().equals(getSelectedSuspendPolicy()) || defaults.isConditionEnabled() != myConditionCheckbox.isSelected());
+ //final BreakpointDefaults defaults = getBreakpointManager(myProject).getBreakpointDefaults(breakpointCategory);
+ //myMakeDefaultButton.setEnabled(!defaults.getSuspendPolicy().equals(getSelectedSuspendPolicy()) || defaults.isConditionEnabled() != myConditionCheckbox.isSelected());
}
};
@@ -429,13 +429,13 @@ public abstract class BreakpointPropertiesPanel {
}
private void updateSuspendPolicyRbFont() {
- final String defPolicy = getBreakpointManager(myProject).getBreakpointDefaults(myBreakpointCategory).getSuspendPolicy();
+ //final String defPolicy = getBreakpointManager(myProject).getBreakpointDefaults(myBreakpointCategory).getSuspendPolicy();
final Font font = myRbSuspendAll.getFont().deriveFont(Font.PLAIN);
final Font boldFont = font.deriveFont(Font.BOLD);
- myRbSuspendAll.setFont(DebuggerSettings.SUSPEND_ALL.equals(defPolicy)? boldFont : font);
- myRbSuspendThread.setFont(DebuggerSettings.SUSPEND_THREAD.equals(defPolicy)? boldFont : font);
+ //myRbSuspendAll.setFont(DebuggerSettings.SUSPEND_ALL.equals(defPolicy)? boldFont : font);
+ //myRbSuspendThread.setFont(DebuggerSettings.SUSPEND_THREAD.equals(defPolicy)? boldFont : font);
}
protected ClassFilter createClassConditionFilter() {
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/BreakpointState.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/BreakpointState.java
index 530fb995aae9..39bdb0971a95 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/BreakpointState.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/BreakpointState.java
@@ -15,6 +15,7 @@
*/
package com.intellij.xdebugger.impl.breakpoints;
+import com.intellij.ide.util.PropertiesComponent;
import com.intellij.util.xmlb.annotations.Attribute;
import com.intellij.util.xmlb.annotations.Property;
import com.intellij.util.xmlb.annotations.Tag;
@@ -48,6 +49,7 @@ public class BreakpointState, P extends XBreakpointProp
myEnabled = enabled;
myTypeId = typeId;
myTimeStamp = timeStamp;
+ mySuspendPolicy = getDefaultSuspendPolicy(myTypeId); // apply default
}
@Attribute("enabled")
@@ -142,4 +144,17 @@ public class BreakpointState, P extends XBreakpointProp
public void setTimeStamp(long timeStamp) {
myTimeStamp = timeStamp;
}
+
+ public static SuspendPolicy getDefaultSuspendPolicy(String typeId) {
+ String defaultPolicy = PropertiesComponent.getInstance().getValue(getDefaultSuspendPolicyKey(typeId));
+ return defaultPolicy != null ? SuspendPolicy.valueOf(defaultPolicy) : SuspendPolicy.ALL;
+ }
+
+ public static void setDefaultSuspendPolicy(String typeId, SuspendPolicy suspendPolicy) {
+ PropertiesComponent.getInstance().setValue(getDefaultSuspendPolicyKey(typeId), suspendPolicy.name());
+ }
+
+ private static String getDefaultSuspendPolicyKey(String typeId) {
+ return "debugger.suspend.policy-" + typeId;
+ }
}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XSuspendPolicyPanel.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XSuspendPolicyPanel.java
index c46914fa06b8..1325687fc8f5 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XSuspendPolicyPanel.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XSuspendPolicyPanel.java
@@ -15,11 +15,11 @@
*/
package com.intellij.xdebugger.impl.breakpoints.ui;
-import com.intellij.ide.util.PropertiesComponent;
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 com.intellij.xdebugger.impl.breakpoints.BreakpointState;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
@@ -72,7 +72,7 @@ public class XSuspendPolicyPanel> extends XBreakpointPr
mySuspendPolicyGroup.add(mySuspendAll);
mySuspendPolicyGroup.add(mySuspendThread);
- updateSuspendPolicyFont(createSettingsKey());
+ updateSuspendPolicyFont();
ItemListener suspendPolicyChangeListener = new ItemListener() {
@Override
@@ -89,9 +89,8 @@ public class XSuspendPolicyPanel> extends XBreakpointPr
@Override
public void actionPerformed(ActionEvent e) {
SuspendPolicy suspendPolicy = getSelectedSuspendPolicy();
- String settingsKey = createSettingsKey();
- PropertiesComponent.getInstance().setValue(settingsKey, suspendPolicy.name());
- updateSuspendPolicyFont(settingsKey);
+ BreakpointState.setDefaultSuspendPolicy(myBreakpointType.getId(), suspendPolicy);
+ updateSuspendPolicyFont();
if (SuspendPolicy.THREAD == suspendPolicy) {
mySuspendThread.requestFocus();
}
@@ -104,20 +103,16 @@ public class XSuspendPolicyPanel> extends XBreakpointPr
}
private void updateMakeDefaultEnableState() {
- myMakeDefaultButton.setEnabled(!getSelectedSuspendPolicy().name().equalsIgnoreCase(PropertiesComponent.getInstance().getValue(createSettingsKey(), SuspendPolicy.ALL.name())));
+ myMakeDefaultButton.setEnabled(!getSelectedSuspendPolicy().equals(BreakpointState.getDefaultSuspendPolicy(myBreakpointType.getId())));
}
- private String createSettingsKey() {
- return "debugger.suspend.policy-" + myBreakpointType.getId();
- }
-
- private void updateSuspendPolicyFont(String settingsKey) {
- String defaultPolicy = PropertiesComponent.getInstance().getValue(settingsKey, SuspendPolicy.ALL.name());
+ private void updateSuspendPolicyFont() {
+ SuspendPolicy defaultPolicy = BreakpointState.getDefaultSuspendPolicy(myBreakpointType.getId());
Font font = mySuspendAll.getFont().deriveFont(Font.PLAIN);
Font boldFont = font.deriveFont(Font.BOLD);
- mySuspendAll.setFont(SuspendPolicy.ALL.name().equalsIgnoreCase(defaultPolicy) ? boldFont : font);
- mySuspendThread.setFont(SuspendPolicy.THREAD.name().equalsIgnoreCase(defaultPolicy) ? boldFont : font);
+ mySuspendAll.setFont(SuspendPolicy.ALL.equals(defaultPolicy) ? boldFont : font);
+ mySuspendThread.setFont(SuspendPolicy.THREAD.equals(defaultPolicy) ? boldFont : font);
}
private void changeEnableState(boolean selected) {