use of com.intellij.xdebugger.impl.breakpoints.XLineBreakpointImpl in project intellij-community by JetBrains.
the class XDebuggerTestUtil method assertBreakpointValidity.
public static <B extends XBreakpoint<?>> void assertBreakpointValidity(Project project, VirtualFile file, int line, boolean validity, String errorMessage, Class<? extends XBreakpointType<B, ?>> breakpointType) {
XLineBreakpointType type = (XLineBreakpointType) XDebuggerUtil.getInstance().findBreakpointType(breakpointType);
XBreakpointManager manager = XDebuggerManager.getInstance(project).getBreakpointManager();
XLineBreakpointImpl breakpoint = (XLineBreakpointImpl) manager.findBreakpointAtLine(type, file, line);
assertNotNull(breakpoint);
assertEquals(validity ? AllIcons.Debugger.Db_verified_breakpoint : AllIcons.Debugger.Db_invalid_breakpoint, breakpoint.getIcon());
assertEquals(errorMessage, breakpoint.getErrorMessage());
}
use of com.intellij.xdebugger.impl.breakpoints.XLineBreakpointImpl in project intellij-community by JetBrains.
the class ToggleBreakpointEnabledAction method findLineBreakpoints.
@NotNull
private static Set<XLineBreakpoint> findLineBreakpoints(AnActionEvent e) {
Project project = e.getProject();
Editor editor = e.getData(CommonDataKeys.EDITOR);
if (project == null || editor == null)
return Collections.emptySet();
XBreakpointManagerImpl breakpointManager = (XBreakpointManagerImpl) XDebuggerManager.getInstance(project).getBreakpointManager();
XLineBreakpointManager lineBreakpointManager = breakpointManager.getLineBreakpointManager();
Document document = editor.getDocument();
Collection<Range<Integer>> lineRanges = new ArrayList<>();
for (Caret caret : editor.getCaretModel().getAllCarets()) {
lineRanges.add(new Range<>(document.getLineNumber(caret.getSelectionStart()), document.getLineNumber(caret.getSelectionEnd())));
}
Collection<XLineBreakpointImpl> breakpoints = lineBreakpointManager.getDocumentBreakpoints(document);
HashSet<XLineBreakpoint> res = new HashSet<>();
for (XLineBreakpointImpl breakpoint : breakpoints) {
int line = breakpoint.getLine();
for (Range<Integer> range : lineRanges) {
if (range.isWithin(line)) {
res.add(breakpoint);
}
}
}
return res;
}
use of com.intellij.xdebugger.impl.breakpoints.XLineBreakpointImpl in project intellij-community by JetBrains.
the class XDebuggerEditBreakpointActionHandler method isEnabled.
@Override
public boolean isEnabled(@NotNull Project project, AnActionEvent event) {
DataContext dataContext = event.getDataContext();
Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
if (editor == null)
return false;
final Pair<GutterIconRenderer, Object> pair = XBreakpointUtil.findSelectedBreakpoint(project, editor);
return pair.first != null && pair.second instanceof XLineBreakpointImpl;
}
use of com.intellij.xdebugger.impl.breakpoints.XLineBreakpointImpl in project intellij-community by JetBrains.
the class ContextTest method testXDebugger.
public void testXDebugger() throws Exception {
final WorkingContextManager manager = getContextManager();
final XBreakpointManager breakpointManager = XDebuggerManager.getInstance(getProject()).getBreakpointManager();
final XsltBreakpointType type = XBreakpointType.EXTENSION_POINT_NAME.findExtension(XsltBreakpointType.class);
ApplicationManager.getApplication().runWriteAction(() -> {
XLineBreakpointImpl<XBreakpointProperties> breakpoint = (XLineBreakpointImpl<XBreakpointProperties>) breakpointManager.addLineBreakpoint(type, "foo", 0, null);
final String name = "foo";
manager.saveContext(name, null);
breakpointManager.removeBreakpoint(breakpoint);
});
manager.loadContext("foo");
Collection<? extends XLineBreakpoint<XBreakpointProperties>> breakpoints = breakpointManager.getBreakpoints(type);
assertEquals(1, breakpoints.size());
manager.clearContext();
}
Aggregations