mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
Merge-request: IJ-MR-115088 Merged-by: Egor Ushakov <Egor.Ushakov@jetbrains.com> GitOrigin-RevId: d081ae2ad13cb9afe17844e4407c0c68187e32db
103 lines
3.7 KiB
Java
103 lines
3.7 KiB
Java
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
|
package com.intellij.xdebugger;
|
|
|
|
import com.intellij.openapi.extensions.ExtensionPoint;
|
|
import com.intellij.openapi.vfs.VirtualFile;
|
|
import com.intellij.testFramework.HeavyPlatformTestCase;
|
|
import com.intellij.util.xmlb.annotations.Attribute;
|
|
import com.intellij.xdebugger.breakpoints.*;
|
|
import com.intellij.xdebugger.impl.breakpoints.XBreakpointManagerImpl;
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
public abstract class XDebuggerTestCase extends HeavyPlatformTestCase {
|
|
public static final MyLineBreakpointType MY_LINE_BREAKPOINT_TYPE = new MyLineBreakpointType();
|
|
protected static final MySimpleBreakpointType MY_SIMPLE_BREAKPOINT_TYPE = new MySimpleBreakpointType();
|
|
|
|
@NotNull
|
|
static XBreakpoint<MyBreakpointProperties> addBreakpoint(XBreakpointManagerImpl breakpointManager, MyBreakpointProperties abc) {
|
|
return breakpointManager.addBreakpoint(MY_SIMPLE_BREAKPOINT_TYPE, abc);
|
|
}
|
|
|
|
@NotNull
|
|
static XLineBreakpoint<MyBreakpointProperties> addLineBreakpoint(XBreakpointManagerImpl breakpointManager,
|
|
String url,
|
|
int line,
|
|
MyBreakpointProperties properties) {
|
|
return breakpointManager.addLineBreakpoint(MY_LINE_BREAKPOINT_TYPE, url, line, properties);
|
|
}
|
|
|
|
static void removeBreakPoint(XBreakpointManagerImpl breakpointManager, XBreakpoint<?> breakpoint) {
|
|
breakpointManager.removeBreakpoint(breakpoint);
|
|
}
|
|
|
|
@Override
|
|
protected void initApplication() throws Exception {
|
|
super.initApplication();
|
|
|
|
final ExtensionPoint<XBreakpointType> point = XBreakpointType.EXTENSION_POINT_NAME.getPoint();
|
|
point.registerExtension(MY_LINE_BREAKPOINT_TYPE, getTestRootDisposable());
|
|
point.registerExtension(MY_SIMPLE_BREAKPOINT_TYPE, getTestRootDisposable());
|
|
}
|
|
|
|
public static class MyLineBreakpointType extends XLineBreakpointType<MyBreakpointProperties> {
|
|
public MyLineBreakpointType() {
|
|
super("testLine", "239");
|
|
}
|
|
|
|
@Override
|
|
public MyBreakpointProperties createBreakpointProperties(@NotNull final VirtualFile file, final int line) {
|
|
return null;
|
|
}
|
|
|
|
@Override
|
|
public MyBreakpointProperties createProperties() {
|
|
return new MyBreakpointProperties();
|
|
}
|
|
}
|
|
|
|
public static class MySimpleBreakpointType extends XBreakpointType<XBreakpoint<MyBreakpointProperties>,MyBreakpointProperties> {
|
|
public MySimpleBreakpointType() {
|
|
super("test", "239");
|
|
}
|
|
|
|
@Override
|
|
public String getDisplayText(final XBreakpoint<MyBreakpointProperties> breakpoint) {
|
|
return "";
|
|
}
|
|
|
|
@Override
|
|
public MyBreakpointProperties createProperties() {
|
|
return new MyBreakpointProperties();
|
|
}
|
|
|
|
@Override
|
|
public XBreakpoint<MyBreakpointProperties> createDefaultBreakpoint(@NotNull XBreakpointCreator<MyBreakpointProperties> creator) {
|
|
final XBreakpoint<MyBreakpointProperties> breakpoint = creator.createBreakpoint(new MyBreakpointProperties("default"));
|
|
breakpoint.setEnabled(true);
|
|
return breakpoint;
|
|
}
|
|
}
|
|
|
|
protected static class MyBreakpointProperties extends XBreakpointProperties<MyBreakpointProperties> {
|
|
@Attribute("option")
|
|
public String myOption;
|
|
|
|
public MyBreakpointProperties() {
|
|
}
|
|
|
|
public MyBreakpointProperties(final String option) {
|
|
myOption = option;
|
|
}
|
|
|
|
@Override
|
|
public MyBreakpointProperties getState() {
|
|
return this;
|
|
}
|
|
|
|
@Override
|
|
public void loadState(@NotNull final MyBreakpointProperties state) {
|
|
myOption = state.myOption;
|
|
}
|
|
}
|
|
}
|