Add ability to set default suspend policy for breakpoint type

This commit is contained in:
Elizaveta Shashkova
2016-08-31 16:06:51 +03:00
parent 575878c57a
commit e701a2585c
4 changed files with 15 additions and 6 deletions
@@ -49,6 +49,7 @@ import java.util.List;
*/
public abstract class XBreakpointType<B extends XBreakpoint<P>, P extends XBreakpointProperties> {
public static final ExtensionPointName<XBreakpointType> EXTENSION_POINT_NAME = ExtensionPointName.create("com.intellij.xdebugger.breakpointType");
public static final SuspendPolicy DEFAULT_SUSPEND_POLICY = SuspendPolicy.ALL;
private final @NonNls @NotNull String myId;
private final @Nls @NotNull String myTitle;
private final boolean mySuspendThreadSupported;
@@ -84,6 +85,10 @@ public abstract class XBreakpointType<B extends XBreakpoint<P>, P extends XBreak
return mySuspendThreadSupported;
}
public SuspendPolicy getDefaultSuspendPolicy() {
return DEFAULT_SUSPEND_POLICY;
}
public enum StandardPanels {SUSPEND_POLICY, ACTIONS, DEPENDENCY}
public EnumSet<StandardPanels> getVisibleStandardPanels() {
@@ -37,7 +37,7 @@ public class BreakpointState<B extends XBreakpoint<P>, P extends XBreakpointProp
private String myTypeId;
private boolean myEnabled;
private Element myPropertiesElement;
private SuspendPolicy mySuspendPolicy = SuspendPolicy.ALL;
private SuspendPolicy mySuspendPolicy = XBreakpointType.DEFAULT_SUSPEND_POLICY;
private boolean myLogMessage;
private LogExpression myLogExpression;
private Condition myCondition;
@@ -53,10 +53,11 @@ public class BreakpointState<B extends XBreakpoint<P>, P extends XBreakpointProp
public BreakpointState() {
}
public BreakpointState(final boolean enabled, final String typeId, final long timeStamp) {
public BreakpointState(final boolean enabled, final String typeId, final long timeStamp, final SuspendPolicy suspendPolicy) {
myEnabled = enabled;
myTypeId = typeId;
myTimeStamp = timeStamp;
mySuspendPolicy = suspendPolicy;
}
@Attribute("enabled")
@@ -16,6 +16,7 @@
package com.intellij.xdebugger.impl.breakpoints;
import com.intellij.util.xmlb.annotations.Tag;
import com.intellij.xdebugger.breakpoints.SuspendPolicy;
import com.intellij.xdebugger.breakpoints.XBreakpointProperties;
import com.intellij.xdebugger.breakpoints.XLineBreakpoint;
import com.intellij.xdebugger.breakpoints.XLineBreakpointType;
@@ -33,8 +34,9 @@ public class LineBreakpointState<P extends XBreakpointProperties> extends Breakp
public LineBreakpointState() {
}
public LineBreakpointState(final boolean enabled, final String typeId, final String fileUrl, final int line, boolean temporary, final long timeStamp) {
super(enabled, typeId, timeStamp);
public LineBreakpointState(final boolean enabled, final String typeId, final String fileUrl, final int line, boolean temporary,
final long timeStamp, final SuspendPolicy suspendPolicy) {
super(enabled, typeId, timeStamp, suspendPolicy);
myFileUrl = fileUrl;
myLine = line;
myTemporary = temporary;
@@ -121,7 +121,7 @@ public class XBreakpointManagerImpl implements XBreakpointManager, PersistentSta
boolean defaultBreakpoint) {
BreakpointState<?,T,?> state = new BreakpointState<>(enabled,
type.getId(),
defaultBreakpoint ? 0 : myTime++);
defaultBreakpoint ? 0 : myTime++, type.getDefaultSuspendPolicy());
getBreakpointDefaults(type).applyDefaults(state);
state.setGroup(myDefaultGroup);
return new XBreakpointBase<XBreakpoint<T>,T, BreakpointState<?,T,?>>(type, this, properties, state);
@@ -217,7 +217,7 @@ public class XBreakpointManagerImpl implements XBreakpointManager, PersistentSta
boolean temporary) {
ApplicationManager.getApplication().assertWriteAccessAllowed();
LineBreakpointState<T> state = new LineBreakpointState<>(true, type.getId(), fileUrl, line, temporary,
myTime++);
myTime++, type.getDefaultSuspendPolicy());
getBreakpointDefaults(type).applyDefaults(state);
state.setGroup(myDefaultGroup);
XLineBreakpointImpl<T> breakpoint = new XLineBreakpointImpl<>(type, this, properties,
@@ -508,6 +508,7 @@ public class XBreakpointManagerImpl implements XBreakpointManager, PersistentSta
private static BreakpointState createBreakpointDefaults(@NotNull XBreakpointType type) {
BreakpointState state = new BreakpointState();
state.setTypeId(type.getId());
state.setSuspendPolicy(type.getDefaultSuspendPolicy());
return state;
}