mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
test breakpoints code cleanup
This commit is contained in:
@@ -245,7 +245,7 @@ public class BreakpointManager {
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nullable
|
||||
public ExceptionBreakpoint addExceptionBreakpoint(@NotNull final String exceptionClassName, final String packageName) {
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
final JavaExceptionBreakpointType type = XDebuggerUtil.getInstance().findBreakpointType(JavaExceptionBreakpointType.class);
|
||||
|
||||
+13
-9
@@ -21,7 +21,6 @@ import com.intellij.debugger.engine.evaluation.EvaluateException;
|
||||
import com.intellij.debugger.engine.evaluation.TextWithImportsImpl;
|
||||
import com.intellij.debugger.engine.events.DebuggerCommandImpl;
|
||||
import com.intellij.debugger.engine.events.SuspendContextCommandImpl;
|
||||
import com.intellij.debugger.impl.DebuggerManagerImpl;
|
||||
import com.intellij.debugger.impl.PositionUtil;
|
||||
import com.intellij.debugger.impl.PrioritizedTask;
|
||||
import com.intellij.debugger.impl.SynchronizationBasedSemaphore;
|
||||
@@ -47,7 +46,6 @@ import com.intellij.util.SmartList;
|
||||
import com.intellij.util.TimeoutUtil;
|
||||
import com.intellij.util.lang.CompoundRuntimeException;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpoint;
|
||||
import com.sun.jdi.Method;
|
||||
import com.sun.jdi.ThreadReference;
|
||||
|
||||
@@ -379,33 +377,34 @@ public abstract class ExecutionWithDebuggerToolsTestCase extends ExecutionTestCa
|
||||
|
||||
public void createBreakpoints(final PsiFile file) {
|
||||
Runnable runnable = () -> {
|
||||
BreakpointManager breakpointManager = DebuggerManagerImpl.getInstanceEx(myProject).getBreakpointManager();
|
||||
BreakpointManager breakpointManager = DebuggerManagerEx.getInstanceEx(myProject).getBreakpointManager();
|
||||
Document document = PsiDocumentManager.getInstance(myProject).getDocument(file);
|
||||
String text = document.getText();
|
||||
int offset = -1;
|
||||
for (; ;) {
|
||||
offset = document.getText().indexOf("Breakpoint!", offset + 1);
|
||||
while (true) {
|
||||
offset = text.indexOf("Breakpoint!", offset + 1);
|
||||
if (offset == -1) break;
|
||||
|
||||
int commentLine = document.getLineNumber(offset);
|
||||
|
||||
String comment = document.getText().substring(document.getLineStartOffset(commentLine), document.getLineEndOffset(commentLine));
|
||||
String comment = text.substring(document.getLineStartOffset(commentLine), document.getLineEndOffset(commentLine));
|
||||
|
||||
Breakpoint breakpoint;
|
||||
|
||||
if (comment.indexOf("Method") != -1) {
|
||||
if (comment.contains("Method")) {
|
||||
breakpoint = breakpointManager.addMethodBreakpoint(document, commentLine + 1);
|
||||
if (breakpoint != null) {
|
||||
println("MethodBreakpoint created at " + file.getVirtualFile().getName() + ":" + (commentLine + 2),
|
||||
ProcessOutputTypes.SYSTEM);
|
||||
}
|
||||
}
|
||||
else if (comment.indexOf("Field") != -1) {
|
||||
else if (comment.contains("Field")) {
|
||||
breakpoint = breakpointManager.addFieldBreakpoint(document, commentLine + 1, readValue(comment, "Field"));
|
||||
if (breakpoint != null) {
|
||||
println("FieldBreakpoint created at " + file.getVirtualFile().getName() + ":" + (commentLine + 2), ProcessOutputTypes.SYSTEM);
|
||||
}
|
||||
}
|
||||
else if (comment.indexOf("Exception") != -1) {
|
||||
else if (comment.contains("Exception")) {
|
||||
breakpoint = breakpointManager.addExceptionBreakpoint(readValue(comment, "Exception"), "");
|
||||
if (breakpoint != null) {
|
||||
println("ExceptionBreakpoint created at " + file.getVirtualFile().getName() + ":" + (commentLine + 2),
|
||||
@@ -419,6 +418,11 @@ public abstract class ExecutionWithDebuggerToolsTestCase extends ExecutionTestCa
|
||||
}
|
||||
}
|
||||
|
||||
if (breakpoint == null) {
|
||||
LOG.error("Unable to set a breakpoint at line " + (commentLine + 1));
|
||||
continue;
|
||||
}
|
||||
|
||||
String suspendPolicy = readValue(comment, "suspendPolicy");
|
||||
if (suspendPolicy != null) {
|
||||
//breakpoint.setSuspend(!DebuggerSettings.SUSPEND_NONE.equals(suspendPolicy));
|
||||
|
||||
Reference in New Issue
Block a user