mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
method breakpoint emulation - added checkbox for switching
This commit is contained in:
+7
-2
@@ -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.
|
||||
@@ -19,6 +19,7 @@ import com.intellij.debugger.DebuggerBundle;
|
||||
import com.intellij.debugger.HelpID;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.StringBuilderSpinAllocator;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpoint;
|
||||
@@ -120,7 +121,11 @@ public class JavaMethodBreakpointType extends JavaLineBreakpointTypeBase<JavaMet
|
||||
@Nullable
|
||||
@Override
|
||||
public JavaMethodBreakpointProperties createBreakpointProperties(@NotNull VirtualFile file, int line) {
|
||||
return new JavaMethodBreakpointProperties();
|
||||
JavaMethodBreakpointProperties properties = new JavaMethodBreakpointProperties();
|
||||
if (Registry.is("debugger.emulate.method.breakpoints")) {
|
||||
properties.EMULATED = true; // create all new emulated
|
||||
}
|
||||
return properties;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -199,7 +199,7 @@ public class MethodBreakpoint extends BreakpointWithHighlighter<JavaMethodBreakp
|
||||
|
||||
|
||||
protected void createRequestForPreparedClass(@NotNull DebugProcessImpl debugProcess, @NotNull ReferenceType classType) {
|
||||
if (Registry.is("debugger.emulate.method.breakpoints")) {
|
||||
if (isEmulated()) {
|
||||
createRequestForPreparedClassEmulated(debugProcess, classType, true);
|
||||
}
|
||||
else {
|
||||
@@ -460,6 +460,10 @@ public class MethodBreakpoint extends BreakpointWithHighlighter<JavaMethodBreakp
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isEmulated() {
|
||||
return getProperties().EMULATED && Registry.is("debugger.emulate.method.breakpoints");
|
||||
}
|
||||
|
||||
private boolean isWatchEntry() {
|
||||
return getProperties().WATCH_ENTRY;
|
||||
}
|
||||
|
||||
+14
-1
@@ -17,8 +17,10 @@
|
||||
package com.intellij.debugger.ui.breakpoints;
|
||||
|
||||
import com.intellij.debugger.DebuggerBundle;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.ui.IdeBorderFactory;
|
||||
import com.intellij.util.ui.DialogUtil;
|
||||
import com.intellij.util.ui.JBUI;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpoint;
|
||||
import com.intellij.xdebugger.breakpoints.ui.XBreakpointCustomPropertiesPanel;
|
||||
import com.intellij.xdebugger.impl.breakpoints.XBreakpointBase;
|
||||
@@ -31,6 +33,7 @@ import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
public class MethodBreakpointPropertiesPanel extends XBreakpointCustomPropertiesPanel<XBreakpoint<JavaMethodBreakpointProperties>> {
|
||||
private JCheckBox myEmulatedCheckBox;
|
||||
private JCheckBox myWatchEntryCheckBox;
|
||||
private JCheckBox myWatchExitCheckBox;
|
||||
|
||||
@@ -44,6 +47,7 @@ public class MethodBreakpointPropertiesPanel extends XBreakpointCustomProperties
|
||||
public JComponent getComponent() {
|
||||
JPanel _panel, _panel0;
|
||||
|
||||
myEmulatedCheckBox = new JCheckBox("Emulated");
|
||||
myWatchEntryCheckBox = new JCheckBox(DebuggerBundle.message("label.method.breakpoint.properties.panel.method.entry"));
|
||||
myWatchExitCheckBox = new JCheckBox(DebuggerBundle.message("label.method.breakpoint.properties.panel.method.exit"));
|
||||
DialogUtil.registerMnemonic(myWatchEntryCheckBox);
|
||||
@@ -51,6 +55,9 @@ public class MethodBreakpointPropertiesPanel extends XBreakpointCustomProperties
|
||||
|
||||
|
||||
Box watchBox = Box.createVerticalBox();
|
||||
_panel = JBUI.Panels.simplePanel();
|
||||
_panel.add(myEmulatedCheckBox, BorderLayout.NORTH);
|
||||
watchBox.add(_panel);
|
||||
_panel = new JPanel(new BorderLayout());
|
||||
_panel.add(myWatchEntryCheckBox, BorderLayout.NORTH);
|
||||
watchBox.add(_panel);
|
||||
@@ -91,13 +98,19 @@ public class MethodBreakpointPropertiesPanel extends XBreakpointCustomProperties
|
||||
|
||||
@Override
|
||||
public void loadFrom(@NotNull XBreakpoint<JavaMethodBreakpointProperties> breakpoint) {
|
||||
myEmulatedCheckBox.setVisible(
|
||||
Registry.is("debugger.emulate.method.breakpoints") && breakpoint.getType() instanceof JavaMethodBreakpointType);
|
||||
myEmulatedCheckBox.setSelected(breakpoint.getProperties().EMULATED);
|
||||
|
||||
myWatchEntryCheckBox.setSelected(breakpoint.getProperties().WATCH_ENTRY);
|
||||
myWatchExitCheckBox.setSelected(breakpoint.getProperties().WATCH_EXIT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveTo(@NotNull XBreakpoint<JavaMethodBreakpointProperties> breakpoint) {
|
||||
boolean changed = breakpoint.getProperties().WATCH_ENTRY != myWatchEntryCheckBox.isSelected();
|
||||
boolean changed = breakpoint.getProperties().EMULATED != myEmulatedCheckBox.isSelected();
|
||||
breakpoint.getProperties().EMULATED = myEmulatedCheckBox.isSelected();
|
||||
changed = breakpoint.getProperties().WATCH_ENTRY != myWatchEntryCheckBox.isSelected() || changed;
|
||||
breakpoint.getProperties().WATCH_ENTRY = myWatchEntryCheckBox.isSelected();
|
||||
changed = breakpoint.getProperties().WATCH_EXIT != myWatchExitCheckBox.isSelected() || changed;
|
||||
breakpoint.getProperties().WATCH_EXIT = myWatchExitCheckBox.isSelected();
|
||||
|
||||
+3
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -28,6 +28,7 @@ public class JavaMethodBreakpointProperties extends JavaBreakpointProperties<Jav
|
||||
@Attribute("method")
|
||||
public String myMethodName;
|
||||
|
||||
public boolean EMULATED = false;
|
||||
public boolean WATCH_ENTRY = true;
|
||||
public boolean WATCH_EXIT = true;
|
||||
|
||||
@@ -52,6 +53,7 @@ public class JavaMethodBreakpointProperties extends JavaBreakpointProperties<Jav
|
||||
myClassPattern = state.myClassPattern;
|
||||
myMethodName = state.myMethodName;
|
||||
|
||||
EMULATED = state.EMULATED;
|
||||
WATCH_ENTRY = state.WATCH_ENTRY;
|
||||
WATCH_EXIT = state.WATCH_EXIT;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user