IDEA-139980 Custom breakpoints should be able to fully provide the main panel clion/142.1901
authorEgor.Ushakov <egor.ushakov@jetbrains.com>
Wed, 20 May 2015 16:17:28 +0000 (19:17 +0300)
committerEgor.Ushakov <egor.ushakov@jetbrains.com>
Wed, 20 May 2015 16:19:31 +0000 (19:19 +0300)
platform/xdebugger-api/src/com/intellij/xdebugger/breakpoints/XBreakpointType.java
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XBreakpointActionsPanel.java
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XLightBreakpointPropertiesPanel.java
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XMasterBreakpointPanel.java
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XSuspendPolicyPanel.java

index 4f9ff38d65836aa982d3805df751dc6fd447b344..65ccdb14c21b587cf9b84ab6aaeb989390d49a53 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2015 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.
@@ -31,6 +31,7 @@ import org.jetbrains.annotations.Nullable;
 import javax.swing.*;
 import java.util.Collections;
 import java.util.Comparator;
+import java.util.EnumSet;
 import java.util.List;
 
 /**
@@ -83,6 +84,12 @@ public abstract class XBreakpointType<B extends XBreakpoint<P>, P extends XBreak
     return mySuspendThreadSupported;
   }
 
+  public enum StandardPanels {SUSPEND_POLICY, ACTIONS, DEPENDENCY}
+
+  public EnumSet<StandardPanels> getVisibleStandardPanels() {
+    return EnumSet.allOf(StandardPanels.class);
+  }
+
   @NotNull
   public final String getId() {
     return myId;
index de4d45f483bfd122c4f137043b606607a69c378a..4edcb9b1aa5e5617d2fdb837b13215556f834021 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2011 JetBrains s.r.o.
+ * Copyright 2000-2015 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.
@@ -131,4 +131,8 @@ public class XBreakpointActionsPanel<B extends XBreakpointBase<?,?,?>> extends X
 
   public void dispose() {
   }
+
+  public void hide() {
+    myContentPane.setVisible(false);
+  }
 }
index 8de83136846e3e5e7fcf61d0ded1c5ff6c13ad6a..b76bac76156c8ec7e8434f4982132bb6e738d6a2 100644 (file)
@@ -108,18 +108,34 @@ public class XLightBreakpointPropertiesPanel<B extends XBreakpointBase<?,?,?>> i
   public XLightBreakpointPropertiesPanel(Project project, XBreakpointManager breakpointManager, B breakpoint, boolean showAllOptions) {
     myBreakpoint = breakpoint;
     myShowAllOptions = showAllOptions;
-    XBreakpointType<B, ?> breakpointType = XBreakpointUtil.getType(breakpoint);
+    final XBreakpointType<B, ?> breakpointType = XBreakpointUtil.getType(breakpoint);
 
-    mySuspendPolicyPanel.init(project, breakpointManager, breakpoint);
-    mySuspendPolicyPanel.setDelegate(this);
+    if (breakpointType.getVisibleStandardPanels().contains(XBreakpointType.StandardPanels.SUSPEND_POLICY)) {
+      mySuspendPolicyPanel.init(project, breakpointManager, breakpoint);
+      mySuspendPolicyPanel.setDelegate(this);
+      mySubPanels.add(mySuspendPolicyPanel);
+    }
+    else {
+      mySuspendPolicyPanel.hide();
+    }
+
+    if (breakpointType.getVisibleStandardPanels().contains(XBreakpointType.StandardPanels.DEPENDENCY)) {
+      myMasterBreakpointPanel.init(project, breakpointManager, breakpoint);
+      mySubPanels.add(myMasterBreakpointPanel);
+    }
+    else {
+      myMasterBreakpointPanel.hide();
+    }
 
-    mySubPanels.add(mySuspendPolicyPanel);
-    myMasterBreakpointPanel.init(project, breakpointManager, breakpoint);
-    mySubPanels.add(myMasterBreakpointPanel);
     XDebuggerEditorsProvider debuggerEditorsProvider = breakpointType.getEditorsProvider(breakpoint, project);
 
-    myActionsPanel.init(project, breakpointManager, breakpoint, debuggerEditorsProvider);
-    mySubPanels.add(myActionsPanel);
+    if (breakpointType.getVisibleStandardPanels().contains(XBreakpointType.StandardPanels.ACTIONS)) {
+      myActionsPanel.init(project, breakpointManager, breakpoint, debuggerEditorsProvider);
+      mySubPanels.add(myActionsPanel);
+    }
+    else {
+      myActionsPanel.hide();
+    }
 
     myCustomPanels = new ArrayList<XBreakpointCustomPropertiesPanel<B>>();
     if (debuggerEditorsProvider != null) {
@@ -180,11 +196,11 @@ public class XLightBreakpointPropertiesPanel<B extends XBreakpointBase<?,?,?>> i
     myMainPanel.addFocusListener(new FocusAdapter() {
       @Override
       public void focusGained(FocusEvent event) {
-        JComponent compToFocus;
+        JComponent compToFocus = null;
         if (myConditionComboBox != null && myConditionComboBox.getComboBox().isEnabled()) {
           compToFocus = myConditionComboBox.getEditorComponent();
         }
-        else {
+        else if (breakpointType.getVisibleStandardPanels().contains(XBreakpointType.StandardPanels.ACTIONS)) {
           compToFocus = myActionsPanel.getDefaultFocusComponent();
         }
         if (compToFocus != null) {
index 4e41620fe8b218fbf6784cefcf8d563b2cd1c279..b2e3bab65713be3132b0946358576a6547a507a3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2011 JetBrains s.r.o.
+ * Copyright 2000-2015 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.
@@ -106,6 +106,12 @@ public class XMasterBreakpointPanel<B extends XBreakpoint<?>> extends XBreakpoin
   }
 
   public void setDetailView(DetailView detailView) {
-    myMasterBreakpointChooser.setDetailView(detailView);
+    if (myMasterBreakpointChooser != null) {
+      myMasterBreakpointChooser.setDetailView(detailView);
+    }
+  }
+
+  public void hide() {
+    myContentPane.setVisible(false);
   }
 }
index 0f18fd1bcd6057e73121296b94556692f7f23f53..b83cfa4d3193c7bbda81c60aebcc495ccc6416f4 100644 (file)
@@ -134,6 +134,10 @@ public class XSuspendPolicyPanel<B extends XBreakpoint<?>> extends XBreakpointPr
     return false;
   }
 
+  public void hide() {
+    myContentPane.setVisible(false);
+  }
+
   @Override
   void loadProperties() {
     SuspendPolicy suspendPolicy = myBreakpoint.getSuspendPolicy();