From 7a64ec8adf62770e80018db355af3196b44e3d6b Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Wed, 20 May 2015 19:17:28 +0300 Subject: [PATCH] IDEA-139980 Custom breakpoints should be able to fully provide the main panel --- .../breakpoints/XBreakpointType.java | 9 ++++- .../ui/XBreakpointActionsPanel.java | 6 +++- .../ui/XLightBreakpointPropertiesPanel.java | 36 +++++++++++++------ .../ui/XMasterBreakpointPanel.java | 10 ++++-- .../breakpoints/ui/XSuspendPolicyPanel.java | 4 +++ 5 files changed, 51 insertions(+), 14 deletions(-) diff --git a/platform/xdebugger-api/src/com/intellij/xdebugger/breakpoints/XBreakpointType.java b/platform/xdebugger-api/src/com/intellij/xdebugger/breakpoints/XBreakpointType.java index 4f9ff38d6583..65ccdb14c21b 100644 --- a/platform/xdebugger-api/src/com/intellij/xdebugger/breakpoints/XBreakpointType.java +++ b/platform/xdebugger-api/src/com/intellij/xdebugger/breakpoints/XBreakpointType.java @@ -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, P extends XBreak return mySuspendThreadSupported; } + public enum StandardPanels {SUSPEND_POLICY, ACTIONS, DEPENDENCY} + + public EnumSet getVisibleStandardPanels() { + return EnumSet.allOf(StandardPanels.class); + } + @NotNull public final String getId() { return myId; diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XBreakpointActionsPanel.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XBreakpointActionsPanel.java index de4d45f483bf..4edcb9b1aa5e 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XBreakpointActionsPanel.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XBreakpointActionsPanel.java @@ -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> extends X public void dispose() { } + + public void hide() { + myContentPane.setVisible(false); + } } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XLightBreakpointPropertiesPanel.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XLightBreakpointPropertiesPanel.java index 8de83136846e..b76bac76156c 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XLightBreakpointPropertiesPanel.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XLightBreakpointPropertiesPanel.java @@ -108,18 +108,34 @@ public class XLightBreakpointPropertiesPanel> i public XLightBreakpointPropertiesPanel(Project project, XBreakpointManager breakpointManager, B breakpoint, boolean showAllOptions) { myBreakpoint = breakpoint; myShowAllOptions = showAllOptions; - XBreakpointType breakpointType = XBreakpointUtil.getType(breakpoint); + final XBreakpointType 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>(); if (debuggerEditorsProvider != null) { @@ -180,11 +196,11 @@ public class XLightBreakpointPropertiesPanel> 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) { diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XMasterBreakpointPanel.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XMasterBreakpointPanel.java index 4e41620fe8b2..b2e3bab65713 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XMasterBreakpointPanel.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/ui/XMasterBreakpointPanel.java @@ -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> extends XBreakpoin } public void setDetailView(DetailView detailView) { - myMasterBreakpointChooser.setDetailView(detailView); + if (myMasterBreakpointChooser != null) { + myMasterBreakpointChooser.setDetailView(detailView); + } + } + + public void hide() { + myContentPane.setVisible(false); } } 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 0f18fd1bcd60..b83cfa4d3193 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 @@ -134,6 +134,10 @@ public class XSuspendPolicyPanel> extends XBreakpointPr return false; } + public void hide() { + myContentPane.setVisible(false); + } + @Override void loadProperties() { SuspendPolicy suspendPolicy = myBreakpoint.getSuspendPolicy();