Search in sources :

Example 1 with DebuggerManagerEx

use of com.intellij.debugger.DebuggerManagerEx in project intellij-community by JetBrains.

the class BreakpointsContextProvider method clearContext.

public void clearContext() {
    final BreakpointManager breakpointManager = ((DebuggerManagerEx) myDebuggerManager).getBreakpointManager();
    List<Breakpoint> breakpoints = breakpointManager.getBreakpoints();
    for (final Breakpoint breakpoint : breakpoints) {
        ApplicationManager.getApplication().runWriteAction(() -> breakpointManager.removeBreakpoint(breakpoint));
    }
}
Also used : Breakpoint(com.intellij.debugger.ui.breakpoints.Breakpoint) DebuggerManagerEx(com.intellij.debugger.DebuggerManagerEx) BreakpointManager(com.intellij.debugger.ui.breakpoints.BreakpointManager)

Example 2 with DebuggerManagerEx

use of com.intellij.debugger.DebuggerManagerEx in project intellij-community by JetBrains.

the class ToggleFieldBreakpointAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    Project project = e.getData(CommonDataKeys.PROJECT);
    if (project == null) {
        return;
    }
    final SourcePosition place = getPlace(e);
    if (place != null) {
        Document document = PsiDocumentManager.getInstance(project).getDocument(place.getFile());
        if (document != null) {
            DebuggerManagerEx debuggerManager = DebuggerManagerEx.getInstanceEx(project);
            BreakpointManager manager = debuggerManager.getBreakpointManager();
            final int offset = place.getOffset();
            final Breakpoint breakpoint = offset >= 0 ? manager.findBreakpoint(document, offset, FieldBreakpoint.CATEGORY) : null;
            if (breakpoint == null) {
                FieldBreakpoint fieldBreakpoint = manager.addFieldBreakpoint(document, offset);
                if (fieldBreakpoint != null) {
                    if (DebuggerAction.isContextView(e)) {
                        final DebuggerTreeNodeImpl selectedNode = DebuggerAction.getSelectedNode(e.getDataContext());
                        if (selectedNode != null && selectedNode.getDescriptor() instanceof FieldDescriptorImpl) {
                            ObjectReference object = ((FieldDescriptorImpl) selectedNode.getDescriptor()).getObject();
                            if (object != null) {
                                long id = object.uniqueID();
                                InstanceFilter[] instanceFilters = new InstanceFilter[] { InstanceFilter.create(Long.toString(id)) };
                                fieldBreakpoint.setInstanceFilters(instanceFilters);
                                fieldBreakpoint.setInstanceFiltersEnabled(true);
                            }
                        }
                    }
                    final Editor editor = CommonDataKeys.EDITOR.getData(e.getDataContext());
                    if (editor != null) {
                        manager.editBreakpoint(fieldBreakpoint, editor);
                    }
                }
            } else {
                manager.removeBreakpoint(breakpoint);
            }
        }
    }
}
Also used : FieldBreakpoint(com.intellij.debugger.ui.breakpoints.FieldBreakpoint) Breakpoint(com.intellij.debugger.ui.breakpoints.Breakpoint) InstanceFilter(com.intellij.debugger.InstanceFilter) DebuggerManagerEx(com.intellij.debugger.DebuggerManagerEx) DebuggerTreeNodeImpl(com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl) FieldBreakpoint(com.intellij.debugger.ui.breakpoints.FieldBreakpoint) Document(com.intellij.openapi.editor.Document) BreakpointManager(com.intellij.debugger.ui.breakpoints.BreakpointManager) FieldBreakpoint(com.intellij.debugger.ui.breakpoints.FieldBreakpoint) Breakpoint(com.intellij.debugger.ui.breakpoints.Breakpoint) FieldDescriptorImpl(com.intellij.debugger.ui.impl.watch.FieldDescriptorImpl) Project(com.intellij.openapi.project.Project) ObjectReference(com.sun.jdi.ObjectReference) SourcePosition(com.intellij.debugger.SourcePosition) Editor(com.intellij.openapi.editor.Editor)

Example 3 with DebuggerManagerEx

use of com.intellij.debugger.DebuggerManagerEx in project intellij-community by JetBrains.

the class JavaAwareTestConsoleProperties method getDebugSession.

@Nullable
public DebuggerSession getDebugSession() {
    final DebuggerManagerEx debuggerManager = DebuggerManagerEx.getInstanceEx(getProject());
    if (debuggerManager == null)
        return null;
    final Collection<DebuggerSession> sessions = debuggerManager.getSessions();
    for (final DebuggerSession debuggerSession : sessions) {
        if (getConsole() == debuggerSession.getProcess().getExecutionResult().getExecutionConsole())
            return debuggerSession;
    }
    return null;
}
Also used : DebuggerManagerEx(com.intellij.debugger.DebuggerManagerEx) DebuggerSession(com.intellij.debugger.impl.DebuggerSession) Nullable(org.jetbrains.annotations.Nullable)

Example 4 with DebuggerManagerEx

use of com.intellij.debugger.DebuggerManagerEx in project intellij-community by JetBrains.

the class HotSwapAction method update.

public void update(AnActionEvent e) {
    Project project = e.getProject();
    if (project == null) {
        e.getPresentation().setEnabled(false);
        return;
    }
    DebuggerManagerEx debuggerManager = DebuggerManagerEx.getInstanceEx(project);
    DebuggerSession session = debuggerManager.getContext().getDebuggerSession();
    e.getPresentation().setEnabled(session != null && HotSwapUIImpl.canHotSwap(session));
}
Also used : Project(com.intellij.openapi.project.Project) DebuggerManagerEx(com.intellij.debugger.DebuggerManagerEx) DebuggerSession(com.intellij.debugger.impl.DebuggerSession)

Example 5 with DebuggerManagerEx

use of com.intellij.debugger.DebuggerManagerEx in project intellij-community by JetBrains.

the class HotSwapAction method actionPerformed.

public void actionPerformed(AnActionEvent e) {
    Project project = e.getProject();
    DebuggerManagerEx debuggerManager = DebuggerManagerEx.getInstanceEx(project);
    DebuggerSession session = debuggerManager.getContext().getDebuggerSession();
    if (session != null && session.isAttached()) {
        HotSwapUI.getInstance(project).reloadChangedClasses(session, DebuggerSettings.getInstance().COMPILE_BEFORE_HOTSWAP);
    }
}
Also used : Project(com.intellij.openapi.project.Project) DebuggerManagerEx(com.intellij.debugger.DebuggerManagerEx) DebuggerSession(com.intellij.debugger.impl.DebuggerSession)

Aggregations

DebuggerManagerEx (com.intellij.debugger.DebuggerManagerEx)7 DebuggerSession (com.intellij.debugger.impl.DebuggerSession)4 Breakpoint (com.intellij.debugger.ui.breakpoints.Breakpoint)4 Project (com.intellij.openapi.project.Project)4 BreakpointManager (com.intellij.debugger.ui.breakpoints.BreakpointManager)3 Client (com.android.ddmlib.Client)1 InstantRunClient (com.android.tools.fd.client.InstantRunClient)1 InstantRunPushFailedException (com.android.tools.fd.client.InstantRunPushFailedException)1 InstanceFilter (com.intellij.debugger.InstanceFilter)1 SourcePosition (com.intellij.debugger.SourcePosition)1 SuspendContextImpl (com.intellij.debugger.engine.SuspendContextImpl)1 DebuggerCommandImpl (com.intellij.debugger.engine.events.DebuggerCommandImpl)1 DebuggerContextImpl (com.intellij.debugger.impl.DebuggerContextImpl)1 FieldBreakpoint (com.intellij.debugger.ui.breakpoints.FieldBreakpoint)1 MethodBreakpoint (com.intellij.debugger.ui.breakpoints.MethodBreakpoint)1 DebuggerTreeNodeImpl (com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl)1 FieldDescriptorImpl (com.intellij.debugger.ui.impl.watch.FieldDescriptorImpl)1 Document (com.intellij.openapi.editor.Document)1 Editor (com.intellij.openapi.editor.Editor)1 XDebugSession (com.intellij.xdebugger.XDebugSession)1