IDEA-139980 Custom breakpoints should be able to fully provide the main panel

This commit is contained in:
Egor.Ushakov
2015-05-20 19:19:31 +03:00
parent e1ab4118ca
commit 7a64ec8adf
5 changed files with 51 additions and 14 deletions
@@ -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;
@@ -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);
}
}
@@ -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) {
@@ -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);
}
}
@@ -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();