mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
XSuspendPolicyPanel — "Make default" (requires for new JavaBreakpointType)
remove unused methods
This commit is contained in:
-12
@@ -15,13 +15,10 @@
|
||||
*/
|
||||
package com.intellij.debugger.ui.breakpoints;
|
||||
|
||||
import com.intellij.debugger.ui.breakpoints.actions.BreakpointPanelAction;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
@@ -57,20 +54,11 @@ public class AnyExceptionBreakpointFactory extends BreakpointFactory{
|
||||
return new ExceptionBreakpointPropertiesPanel(project, compact);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BreakpointPanelAction[] createBreakpointPanelActions(Project project, DialogWrapper parentDialog) {
|
||||
return new BreakpointPanelAction[0]; //To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean breakpointCanBeRemoved(Breakpoint breakpoint) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public @Nullable BreakpointPanel createBreakpointPanel(Project project, DialogWrapper parentDialog) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Key<AnyExceptionBreakpoint> getBreakpointCategory() {
|
||||
return AnyExceptionBreakpoint.ANY_EXCEPTION_BREAKPOINT;
|
||||
}
|
||||
|
||||
@@ -15,11 +15,9 @@
|
||||
*/
|
||||
package com.intellij.debugger.ui.breakpoints;
|
||||
|
||||
import com.intellij.debugger.ui.breakpoints.actions.BreakpointPanelAction;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.xdebugger.impl.breakpoints.ui.BreakpointItem;
|
||||
import org.jdom.Element;
|
||||
@@ -42,14 +40,6 @@ public abstract class BreakpointFactory {
|
||||
|
||||
public abstract Key<? extends Breakpoint> getBreakpointCategory();
|
||||
|
||||
public BreakpointPanel createBreakpointPanel(final Project project, final DialogWrapper parentDialog) {
|
||||
BreakpointPanel panel =
|
||||
new BreakpointPanel(project, createBreakpointPropertiesPanel(project, false), createBreakpointPanelActions(project, parentDialog),
|
||||
getBreakpointCategory(), getDisplayName(), getHelpID());
|
||||
configureBreakpointPanel(panel);
|
||||
return panel;
|
||||
}
|
||||
|
||||
public abstract Icon getIcon();
|
||||
|
||||
public abstract Icon getDisabledIcon();
|
||||
@@ -75,8 +65,6 @@ public abstract class BreakpointFactory {
|
||||
@Nullable
|
||||
public abstract BreakpointPropertiesPanel createBreakpointPropertiesPanel(Project project, boolean compact);
|
||||
|
||||
protected abstract BreakpointPanelAction[] createBreakpointPanelActions(Project project, DialogWrapper parentDialog);
|
||||
|
||||
@Nullable
|
||||
public Breakpoint addBreakpoint(Project project) {
|
||||
return null;
|
||||
|
||||
-47
@@ -19,12 +19,10 @@ import com.intellij.debugger.DebuggerBundle;
|
||||
import com.intellij.debugger.DebuggerManagerEx;
|
||||
import com.intellij.debugger.HelpID;
|
||||
import com.intellij.debugger.engine.JVMNameUtil;
|
||||
import com.intellij.debugger.ui.breakpoints.actions.*;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.ide.util.TreeClassChooser;
|
||||
import com.intellij.ide.util.TreeClassChooserFactory;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.psi.JavaPsiFacade;
|
||||
import com.intellij.psi.PsiClass;
|
||||
@@ -72,51 +70,6 @@ public class ExceptionBreakpointFactory extends BreakpointFactory {
|
||||
return new ExceptionBreakpointPropertiesPanel(project, compact);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BreakpointPanelAction[] createBreakpointPanelActions(final Project project, DialogWrapper parentDialog) {
|
||||
return new BreakpointPanelAction[]{
|
||||
new SwitchViewAction(),
|
||||
new AddAction(this, project),
|
||||
new RemoveAction(project) {
|
||||
public void update() {
|
||||
super.update();
|
||||
if (getButton().isEnabled()) {
|
||||
Breakpoint[] selectedBreakpoints = getPanel().getSelectedBreakpoints();
|
||||
for (Breakpoint bp : selectedBreakpoints) {
|
||||
if (bp instanceof AnyExceptionBreakpoint) {
|
||||
getButton().setEnabled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}, new ToggleGroupByClassesAction(), new ToggleFlattenPackagesAction(),};
|
||||
}
|
||||
|
||||
public BreakpointPanel createBreakpointPanel(final Project project, final DialogWrapper parentDialog) {
|
||||
BreakpointPanel panel =
|
||||
new BreakpointPanel(project, createBreakpointPropertiesPanel(project, false), createBreakpointPanelActions(project, parentDialog),
|
||||
getBreakpointCategory(), getDisplayName(), getHelpID()) {
|
||||
public void resetBreakpoints() {
|
||||
super.resetBreakpoints();
|
||||
Breakpoint[] breakpoints = getBreakpointManager().getBreakpoints(getBreakpointCategory());
|
||||
final AnyExceptionBreakpoint anyExceptionBreakpoint =
|
||||
DebuggerManagerEx.getInstanceEx(project).getBreakpointManager().getAnyExceptionBreakpoint();
|
||||
boolean found = false;
|
||||
for (Breakpoint breakpoint : breakpoints) {
|
||||
if (breakpoint.equals(anyExceptionBreakpoint)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
insertBreakpointAt(anyExceptionBreakpoint, 0);
|
||||
}
|
||||
}
|
||||
};
|
||||
configureBreakpointPanel(panel);
|
||||
return panel;
|
||||
}
|
||||
|
||||
public Key<ExceptionBreakpoint> getBreakpointCategory() {
|
||||
return ExceptionBreakpoint.CATEGORY;
|
||||
}
|
||||
|
||||
-21
@@ -19,11 +19,9 @@ import com.intellij.CommonBundle;
|
||||
import com.intellij.debugger.DebuggerBundle;
|
||||
import com.intellij.debugger.DebuggerManagerEx;
|
||||
import com.intellij.debugger.HelpID;
|
||||
import com.intellij.debugger.ui.breakpoints.actions.*;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
@@ -32,7 +30,6 @@ import com.intellij.psi.search.GlobalSearchScope;
|
||||
import org.jdom.Element;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
@@ -71,24 +68,6 @@ public class FieldBreakpointFactory extends BreakpointFactory{
|
||||
return new FieldBreakpointPropertiesPanel(project, compact);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BreakpointPanelAction[] createBreakpointPanelActions(final Project project, final DialogWrapper parentDialog) {
|
||||
return new BreakpointPanelAction[] {
|
||||
new SwitchViewAction(),
|
||||
new AddAction(this, project),
|
||||
new GotoSourceAction(project) {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
super.actionPerformed(e);
|
||||
parentDialog.close(DialogWrapper.OK_EXIT_CODE);
|
||||
}
|
||||
},
|
||||
new ViewSourceAction(project),
|
||||
new RemoveAction(project),
|
||||
new ToggleGroupByClassesAction(),
|
||||
new ToggleFlattenPackagesAction(),
|
||||
};
|
||||
}
|
||||
|
||||
public Key<FieldBreakpoint> getBreakpointCategory() {
|
||||
return FieldBreakpoint.CATEGORY;
|
||||
}
|
||||
|
||||
+3
-19
@@ -17,29 +17,29 @@ package com.intellij.debugger.ui.breakpoints;
|
||||
|
||||
import com.intellij.debugger.DebuggerBundle;
|
||||
import com.intellij.debugger.HelpID;
|
||||
import com.intellij.debugger.ui.breakpoints.actions.*;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import org.jdom.Element;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
* Date: Apr 26, 2005
|
||||
*/
|
||||
public class LineBreakpointFactory extends BreakpointFactory {
|
||||
@Override
|
||||
public Breakpoint createBreakpoint(Project project, final Element element) {
|
||||
return new LineBreakpoint(project);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getIcon() {
|
||||
return AllIcons.Debugger.Db_set_breakpoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getDisabledIcon() {
|
||||
return AllIcons.Debugger.Db_disabled_breakpoint;
|
||||
}
|
||||
@@ -60,22 +60,6 @@ public class LineBreakpointFactory extends BreakpointFactory {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BreakpointPanelAction[] createBreakpointPanelActions(Project project, final DialogWrapper parentDialog) {
|
||||
return new BreakpointPanelAction[]{new SwitchViewAction(),
|
||||
new GotoSourceAction(project) {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
super.actionPerformed(e);
|
||||
parentDialog.close(DialogWrapper.OK_EXIT_CODE);
|
||||
}
|
||||
},
|
||||
new ViewSourceAction(project),
|
||||
new RemoveAction(project),
|
||||
new ToggleGroupByMethodsAction(),
|
||||
new ToggleGroupByClassesAction(),
|
||||
new ToggleFlattenPackagesAction(),
|
||||
};
|
||||
}
|
||||
|
||||
public Key<LineBreakpoint> getBreakpointCategory() {
|
||||
return LineBreakpoint.CATEGORY;
|
||||
}
|
||||
|
||||
+5
-21
@@ -18,29 +18,29 @@ package com.intellij.debugger.ui.breakpoints;
|
||||
import com.intellij.debugger.DebuggerBundle;
|
||||
import com.intellij.debugger.DebuggerManagerEx;
|
||||
import com.intellij.debugger.HelpID;
|
||||
import com.intellij.debugger.ui.breakpoints.actions.*;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import org.jdom.Element;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
* Date: Apr 26, 2005
|
||||
*/
|
||||
public class MethodBreakpointFactory extends BreakpointFactory{
|
||||
@Override
|
||||
public Breakpoint createBreakpoint(Project project, final Element element) {
|
||||
return element.getAttributeValue(WildcardMethodBreakpoint.JDOM_LABEL) != null? new WildcardMethodBreakpoint(project) : new MethodBreakpoint(project);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getIcon() {
|
||||
return AllIcons.Debugger.Db_method_breakpoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getDisabledIcon() {
|
||||
return AllIcons.Debugger.Db_disabled_method_breakpoint;
|
||||
}
|
||||
@@ -60,30 +60,13 @@ public class MethodBreakpointFactory extends BreakpointFactory{
|
||||
return new MethodBreakpointPropertiesPanel(project, compact);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BreakpointPanelAction[] createBreakpointPanelActions(Project project, final DialogWrapper parentDialog) {
|
||||
return new BreakpointPanelAction[]{
|
||||
new SwitchViewAction(),
|
||||
new AddAction(this, project),
|
||||
new GotoSourceAction(project) {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
super.actionPerformed(e);
|
||||
parentDialog.close(DialogWrapper.OK_EXIT_CODE);
|
||||
}
|
||||
},
|
||||
new ViewSourceAction(project),
|
||||
new RemoveAction(project),
|
||||
new ToggleGroupByClassesAction(),
|
||||
new ToggleFlattenPackagesAction(),
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configureBreakpointPanel(BreakpointPanel panel) {
|
||||
super.configureBreakpointPanel(panel);
|
||||
panel.getTree().setGroupByMethods(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Key<MethodBreakpoint> getBreakpointCategory() {
|
||||
return MethodBreakpoint.CATEGORY;
|
||||
}
|
||||
@@ -93,6 +76,7 @@ public class MethodBreakpointFactory extends BreakpointFactory{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WildcardMethodBreakpoint addBreakpoint(Project project) {
|
||||
AddWildcardBreakpointDialog dialog = new AddWildcardBreakpointDialog(project);
|
||||
dialog.show();
|
||||
|
||||
@@ -35,6 +35,11 @@ public abstract class PropertiesComponent {
|
||||
|
||||
public abstract void setValue(@NonNls String name, String value);
|
||||
|
||||
/**
|
||||
* Set value or unset if equals to default value
|
||||
*/
|
||||
public abstract void setValue(@NotNull String name, @NotNull String value, @NotNull String defaultValue);
|
||||
|
||||
public abstract String[] getValues(@NonNls String name);
|
||||
|
||||
public abstract void setValues(@NonNls String name, String[] values);
|
||||
|
||||
@@ -74,6 +74,16 @@ public class PropertiesComponentImpl extends PropertiesComponent implements Pers
|
||||
myMap.put(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(@NotNull String name, @NotNull String value, @NotNull String defaultValue) {
|
||||
if (value.equals(defaultValue)) {
|
||||
myMap.remove(name);
|
||||
}
|
||||
else {
|
||||
myMap.put(name, value);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unsetValue(String name) {
|
||||
myMap.remove(name);
|
||||
|
||||
@@ -25,11 +25,13 @@ xbreakpoints.dialog.button.view.source=&View Source
|
||||
xbreakpoints.dialog.button.remove=&Remove
|
||||
xbreakpoints.dialog.button.add=&Add...
|
||||
xbreakpoints.conditions.group.title=Conditions
|
||||
xbreakpoints.suspend.group.title=Suspend policy
|
||||
xbreakpoints.suspend.checkbox=&Suspend
|
||||
xbreakpoints.suspend.all.radio=All
|
||||
xbreakpoints.suspend.thread.radio=Thread
|
||||
xbreakpoints.suspend.none.radio=None
|
||||
|
||||
suspend.policy.panel.title=Suspend policy
|
||||
suspend.policy.panel.suspend=&Suspend
|
||||
suspend.policy.panel.all=All
|
||||
suspend.policy.panel.thread=Thread
|
||||
suspend.policy.panel.makeDefault=Make De&fault
|
||||
|
||||
xbreakpoints.properties.actions.group.title=Actions
|
||||
xbreakpoints.log.message.checkbox=Log &message to console
|
||||
xbreakpoints.log.expression.checkbox=Log evaluated &expression
|
||||
|
||||
+16
-8
@@ -1,33 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.xdebugger.impl.breakpoints.ui.XSuspendPolicyPanel">
|
||||
<grid id="27dc6" binding="myContentPane" layout-manager="GridLayoutManager" row-count="1" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="27dc6" binding="myContentPane" layout-manager="GridLayoutManager" row-count="1" column-count="5" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="537" height="51"/>
|
||||
<xy x="20" y="20" width="537" height="57"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="etched" title-resource-bundle="messages/XDebuggerBundle" title-key="xbreakpoints.suspend.group.title"/>
|
||||
<border type="etched" title-resource-bundle="messages/XDebuggerBundle" title-key="suspend.policy.panel.title"/>
|
||||
<children>
|
||||
<hspacer id="d9eab">
|
||||
<constraints>
|
||||
<grid row="0" column="3" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</hspacer>
|
||||
<component id="aba21" class="javax.swing.JRadioButton" binding="mySuspendAllRadioButton">
|
||||
<component id="aba21" class="javax.swing.JRadioButton" binding="mySuspendAll">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<selected value="true"/>
|
||||
<text resource-bundle="messages/XDebuggerBundle" key="xbreakpoints.suspend.all.radio"/>
|
||||
<text resource-bundle="messages/XDebuggerBundle" key="suspend.policy.panel.all"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="91d9b" class="javax.swing.JRadioButton" binding="mySuspendThreadRadioButton">
|
||||
<component id="91d9b" class="javax.swing.JRadioButton" binding="mySuspendThread">
|
||||
<constraints>
|
||||
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text resource-bundle="messages/XDebuggerBundle" key="xbreakpoints.suspend.thread.radio"/>
|
||||
<text resource-bundle="messages/XDebuggerBundle" key="suspend.policy.panel.thread"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="ac150" class="javax.swing.JCheckBox" binding="mySuspendCheckBox" default-binding="true">
|
||||
@@ -36,7 +36,15 @@
|
||||
</constraints>
|
||||
<properties>
|
||||
<selected value="true"/>
|
||||
<text resource-bundle="messages/XDebuggerBundle" key="xbreakpoints.suspend.checkbox"/>
|
||||
<text resource-bundle="messages/XDebuggerBundle" key="suspend.policy.panel.suspend"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="ac069" class="javax.swing.JButton" binding="myMakeDefaultButton" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="0" column="4" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text resource-bundle="messages/XDebuggerBundle" key="suspend.policy.panel.makeDefault"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
|
||||
+79
-11
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.xdebugger.impl.breakpoints.ui;
|
||||
|
||||
import com.intellij.ide.util.PropertiesComponent;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.xdebugger.breakpoints.SuspendPolicy;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpoint;
|
||||
@@ -22,15 +23,21 @@ import com.intellij.xdebugger.breakpoints.XBreakpointManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ItemEvent;
|
||||
import java.awt.event.ItemListener;
|
||||
|
||||
public class XSuspendPolicyPanel<B extends XBreakpoint<?>> extends XBreakpointPropertiesSubPanel<B> {
|
||||
private JCheckBox mySuspendCheckBox;
|
||||
private JRadioButton mySuspendAllRadioButton;
|
||||
private JRadioButton mySuspendThreadRadioButton;
|
||||
private JRadioButton mySuspendAll;
|
||||
private JRadioButton mySuspendThread;
|
||||
|
||||
private JPanel myContentPane;
|
||||
private JButton myMakeDefaultButton;
|
||||
|
||||
private ButtonGroup mySuspendPolicyGroup;
|
||||
|
||||
public interface Delegate {
|
||||
void showMoreOptionsIfNeeded();
|
||||
@@ -56,16 +63,78 @@ public class XSuspendPolicyPanel<B extends XBreakpoint<?>> extends XBreakpointPr
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (!myBreakpoint.getType().isSuspendThreadSupported()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mySuspendPolicyGroup = new ButtonGroup();
|
||||
mySuspendPolicyGroup.add(mySuspendAll);
|
||||
mySuspendPolicyGroup.add(mySuspendThread);
|
||||
|
||||
updateSuspendPolicyFont(createSettingsKey());
|
||||
|
||||
ItemListener suspendPolicyChangeListener = new ItemListener() {
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
updateMakeDefaultEnableState();
|
||||
}
|
||||
};
|
||||
updateMakeDefaultEnableState();
|
||||
|
||||
mySuspendAll.addItemListener(suspendPolicyChangeListener);
|
||||
mySuspendThread.addItemListener(suspendPolicyChangeListener);
|
||||
|
||||
myMakeDefaultButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
SuspendPolicy suspendPolicy = getSelectedSuspendPolicy();
|
||||
String settingsKey = createSettingsKey();
|
||||
PropertiesComponent.getInstance().setValue(settingsKey, suspendPolicy.name());
|
||||
updateSuspendPolicyFont(settingsKey);
|
||||
if (SuspendPolicy.THREAD == suspendPolicy) {
|
||||
mySuspendThread.requestFocus();
|
||||
}
|
||||
else {
|
||||
mySuspendAll.requestFocus();
|
||||
}
|
||||
myMakeDefaultButton.setEnabled(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void updateMakeDefaultEnableState() {
|
||||
myMakeDefaultButton.setEnabled(!getSelectedSuspendPolicy().name().equalsIgnoreCase(PropertiesComponent.getInstance().getValue(createSettingsKey(), SuspendPolicy.ALL.name())));
|
||||
}
|
||||
|
||||
private String createSettingsKey() {
|
||||
return "debugger.suspend.policy-" + myBreakpointType.getId();
|
||||
}
|
||||
|
||||
private void updateSuspendPolicyFont(String settingsKey) {
|
||||
String defaultPolicy = PropertiesComponent.getInstance().getValue(settingsKey, SuspendPolicy.ALL.name());
|
||||
Font font = mySuspendAll.getFont().deriveFont(Font.PLAIN);
|
||||
Font boldFont = font.deriveFont(Font.BOLD);
|
||||
|
||||
mySuspendAll.setFont(SuspendPolicy.ALL.name().equalsIgnoreCase(defaultPolicy) ? boldFont : font);
|
||||
mySuspendThread.setFont(SuspendPolicy.THREAD.name().equalsIgnoreCase(defaultPolicy) ? boldFont : font);
|
||||
}
|
||||
|
||||
private void changeEnableState(boolean selected) {
|
||||
mySuspendAllRadioButton.setEnabled(selected);
|
||||
mySuspendThreadRadioButton.setEnabled(selected);
|
||||
mySuspendAll.setEnabled(selected);
|
||||
mySuspendThread.setEnabled(selected);
|
||||
if (selected) {
|
||||
updateMakeDefaultEnableState();
|
||||
}
|
||||
else {
|
||||
myMakeDefaultButton.setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void changeVisibleState(boolean suspendThreadSupported) {
|
||||
mySuspendAllRadioButton.setVisible(suspendThreadSupported);
|
||||
mySuspendThreadRadioButton.setVisible(suspendThreadSupported);
|
||||
mySuspendAll.setVisible(suspendThreadSupported);
|
||||
mySuspendThread.setVisible(suspendThreadSupported);
|
||||
myMakeDefaultButton.setVisible(suspendThreadSupported);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -82,8 +151,7 @@ public class XSuspendPolicyPanel<B extends XBreakpoint<?>> extends XBreakpointPr
|
||||
|
||||
changeVisibleState(suspendThreadSupported);
|
||||
if (suspendThreadSupported) {
|
||||
mySuspendAllRadioButton.setSelected(suspendPolicy == SuspendPolicy.ALL);
|
||||
mySuspendThreadRadioButton.setSelected(suspendPolicy == SuspendPolicy.THREAD);
|
||||
mySuspendPolicyGroup.setSelected(suspendPolicy == SuspendPolicy.THREAD ? mySuspendThread.getModel() : mySuspendAll.getModel(), true);
|
||||
changeEnableState(selected);
|
||||
}
|
||||
|
||||
@@ -93,12 +161,12 @@ public class XSuspendPolicyPanel<B extends XBreakpoint<?>> extends XBreakpointPr
|
||||
}
|
||||
}
|
||||
|
||||
private SuspendPolicy getConfiguredSuspendPolicy() {
|
||||
private SuspendPolicy getSelectedSuspendPolicy() {
|
||||
if (!mySuspendCheckBox.isSelected()) {
|
||||
return SuspendPolicy.NONE;
|
||||
}
|
||||
else if (myBreakpoint.getType().isSuspendThreadSupported()) {
|
||||
return mySuspendAllRadioButton.isSelected() ? SuspendPolicy.ALL : SuspendPolicy.THREAD;
|
||||
return mySuspendAll.isSelected() ? SuspendPolicy.ALL : SuspendPolicy.THREAD;
|
||||
}
|
||||
else {
|
||||
return SuspendPolicy.ALL;
|
||||
@@ -107,7 +175,7 @@ public class XSuspendPolicyPanel<B extends XBreakpoint<?>> extends XBreakpointPr
|
||||
|
||||
@Override
|
||||
void saveProperties() {
|
||||
myBreakpoint.setSuspendPolicy(getConfiguredSuspendPolicy());
|
||||
myBreakpoint.setSuspendPolicy(getSelectedSuspendPolicy());
|
||||
}
|
||||
|
||||
public Delegate getDelegate() {
|
||||
|
||||
Reference in New Issue
Block a user