IDEA-152214 Xcode like way to disable/remove breakpoints - registry option appcode/146.215 clion/146.214 phpstorm/146.212
authorEgor.Ushakov <egor.ushakov@jetbrains.com>
Fri, 26 Feb 2016 11:26:16 +0000 (14:26 +0300)
committerEgor.Ushakov <egor.ushakov@jetbrains.com>
Fri, 26 Feb 2016 11:28:41 +0000 (14:28 +0300)
platform/util/resources/misc/registry.properties
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerUtilImpl.java
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointBase.java

index aa40668a718646cf465b3d64e8ba86c624f2b6fa..0a477a3e9d12fc7ce5430293229d5dae03f3913a 100644 (file)
@@ -208,6 +208,8 @@ debugger.watch.return.speedup=true
 debugger.watch.return.speedup.description=Reduce watch return values overhead by applying extra filters
 debugger.check.source=true
 debugger.check.source.description=Check that source code matches the bytecode
+debugger.click.disable.breakpoints=false
+debugger.click.disable.breakpoints.description=Single click to disable a breakpoint, middle click to remove
 
 analyze.exceptions.on.the.fly=false
 analyze.exceptions.on.the.fly.description=Automatically analyze clipboard on frame activation,\
index 5bf1ef7d5401427aa0c5cef92df50085cc19824d..9b994764fbb30cebb5853440aaaefe7b9f28bc69 100644 (file)
@@ -39,6 +39,7 @@ import com.intellij.openapi.ui.popup.PopupStep;
 import com.intellij.openapi.ui.popup.util.BaseListPopupStep;
 import com.intellij.openapi.util.Computable;
 import com.intellij.openapi.util.TextRange;
+import com.intellij.openapi.util.registry.Registry;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.pom.Navigatable;
@@ -152,7 +153,12 @@ public class XDebuggerUtilImpl extends XDebuggerUtil {
         final XBreakpointManager breakpointManager = XDebuggerManager.getInstance(project).getBreakpointManager();
         XLineBreakpoint<P> breakpoint = breakpointManager.findBreakpointAtLine(type, file, line);
         if (breakpoint != null) {
-          breakpointManager.removeBreakpoint(breakpoint);
+          if (Registry.is("debugger.click.disable.breakpoints")) {
+            breakpoint.setEnabled(!breakpoint.isEnabled());
+          }
+          else {
+            breakpointManager.removeBreakpoint(breakpoint);
+          }
         }
         else {
           List<? extends XLineBreakpointType<P>.XLineBreakpointVariant> variants = type.computeVariants(project, position);
index 8a2c71ee2e33755348a0b1fb4e4d78337ba4b140..c6bed4e65eef39d2a29b953dba11a2dc7ff173ab 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2015 JetBrains s.r.o.
+ * Copyright 2000-2016 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.
@@ -24,6 +24,7 @@ import com.intellij.openapi.project.DumbAware;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Comparing;
 import com.intellij.openapi.util.UserDataHolderBase;
+import com.intellij.openapi.util.registry.Registry;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.pom.Navigatable;
 import com.intellij.ui.ColorUtil;
@@ -494,13 +495,21 @@ public class XBreakpointBase<Self extends XBreakpoint<P>, P extends XBreakpointP
     @Override
     @Nullable
     public AnAction getClickAction() {
-      return new RemoveBreakpointGutterIconAction(XBreakpointBase.this);
+      if (Registry.is("debugger.click.disable.breakpoints")) {
+        return new ToggleBreakpointGutterIconAction(XBreakpointBase.this);
+      } else {
+        return new RemoveBreakpointGutterIconAction(XBreakpointBase.this);
+      }
     }
 
     @Override
     @Nullable
     public AnAction getMiddleButtonClickAction() {
-      return new ToggleBreakpointGutterIconAction(XBreakpointBase.this);
+      if (!Registry.is("debugger.click.disable.breakpoints")) {
+        return new ToggleBreakpointGutterIconAction(XBreakpointBase.this);
+      } else {
+        return new RemoveBreakpointGutterIconAction(XBreakpointBase.this);
+      }
     }
 
     @Nullable