Search in sources :

Example 1 with XDebugSessionImpl

use of com.intellij.xdebugger.impl.XDebugSessionImpl in project intellij-community by JetBrains.

the class PyEduDebugRunner method initSession.

@Override
protected void initSession(XDebugSession session, RunProfileState state, Executor executor) {
    XDebugSessionTab tab = ((XDebugSessionImpl) session).getSessionTab();
    if (tab != null) {
        RunnerLayoutUi ui = tab.getUi();
        ContentManager contentManager = ui.getContentManager();
        Content content = findContent(contentManager, XDebuggerBundle.message("debugger.session.tab.console.content.name"));
        if (content != null) {
            ExecutionConsole console = session.getDebugProcess().createConsole();
            PythonDebugLanguageConsoleView view = (PythonDebugLanguageConsoleView) console;
            Presentation presentation = view.getSwitchConsoleActionPresentation();
            ToggleAction action = new ToggleAction(presentation.getText(), presentation.getDescription(), presentation.getIcon()) {

                @Override
                public boolean isSelected(AnActionEvent e) {
                    return !view.isPrimaryConsoleEnabled();
                }

                @Override
                public void setSelected(AnActionEvent e, boolean state) {
                    view.enableConsole(!state);
                }
            };
            content.setActions(new DefaultActionGroup(action), ActionPlaces.DEBUGGER_TOOLBAR, view.getPreferredFocusableComponent());
        }
        patchLeftToolbar(session, ui);
    }
}
Also used : RunnerLayoutUi(com.intellij.execution.ui.RunnerLayoutUi) XDebugSessionTab(com.intellij.xdebugger.impl.ui.XDebugSessionTab) PythonDebugLanguageConsoleView(com.jetbrains.python.console.PythonDebugLanguageConsoleView) Content(com.intellij.ui.content.Content) ContentManager(com.intellij.ui.content.ContentManager) ExecutionConsole(com.intellij.execution.ui.ExecutionConsole) XDebugSessionImpl(com.intellij.xdebugger.impl.XDebugSessionImpl)

Example 2 with XDebugSessionImpl

use of com.intellij.xdebugger.impl.XDebugSessionImpl in project intellij-community by JetBrains.

the class HotSwapProgressImpl method notifyUser.

private void notifyUser(String title, String message, NotificationType type) {
    NotificationListener notificationListener = null;
    if (SoftReference.dereference(mySessionRef) != null) {
        notificationListener = (notification, event) -> {
            if (event.getEventType() != HyperlinkEvent.EventType.ACTIVATED) {
                return;
            }
            XDebugSession session = SoftReference.dereference(mySessionRef);
            if (session == null) {
                return;
            }
            notification.expire();
            switch(event.getDescription()) {
                case "stop":
                    session.stop();
                    break;
                case "restart":
                    ExecutionEnvironment environment = ((XDebugSessionImpl) session).getExecutionEnvironment();
                    if (environment != null) {
                        ExecutionUtil.restart(environment);
                    }
                    break;
            }
        };
    }
    NOTIFICATION_GROUP.createNotification(title, message, type, notificationListener).setImportant(false).notify(getProject());
}
Also used : XDebugSession(com.intellij.xdebugger.XDebugSession) ExecutionEnvironment(com.intellij.execution.runners.ExecutionEnvironment) NotificationListener(com.intellij.notification.NotificationListener) XDebugSessionImpl(com.intellij.xdebugger.impl.XDebugSessionImpl)

Example 3 with XDebugSessionImpl

use of com.intellij.xdebugger.impl.XDebugSessionImpl in project intellij-community by JetBrains.

the class GenericDebuggerRunner method attachVirtualMachine.

@Nullable
protected RunContentDescriptor attachVirtualMachine(RunProfileState state, @NotNull ExecutionEnvironment env, RemoteConnection connection, long pollTimeout) throws ExecutionException {
    DebugEnvironment environment = new DefaultDebugEnvironment(env, state, connection, pollTimeout);
    final DebuggerSession debuggerSession = DebuggerManagerEx.getInstanceEx(env.getProject()).attachVirtualMachine(environment);
    if (debuggerSession == null) {
        return null;
    }
    final DebugProcessImpl debugProcess = debuggerSession.getProcess();
    return XDebuggerManager.getInstance(env.getProject()).startSession(env, new XDebugProcessStarter() {

        @Override
        @NotNull
        public XDebugProcess start(@NotNull XDebugSession session) {
            XDebugSessionImpl sessionImpl = (XDebugSessionImpl) session;
            ExecutionResult executionResult = debugProcess.getExecutionResult();
            sessionImpl.addExtraActions(executionResult.getActions());
            if (executionResult instanceof DefaultExecutionResult) {
                sessionImpl.addRestartActions(((DefaultExecutionResult) executionResult).getRestartActions());
            }
            return JavaDebugProcess.create(session, debuggerSession);
        }
    }).getRunContentDescriptor();
}
Also used : XDebugSession(com.intellij.xdebugger.XDebugSession) DefaultDebugEnvironment(com.intellij.debugger.DefaultDebugEnvironment) DefaultExecutionResult(com.intellij.execution.DefaultExecutionResult) DebugProcessImpl(com.intellij.debugger.engine.DebugProcessImpl) XDebugProcessStarter(com.intellij.xdebugger.XDebugProcessStarter) ExecutionResult(com.intellij.execution.ExecutionResult) DefaultExecutionResult(com.intellij.execution.DefaultExecutionResult) DefaultDebugEnvironment(com.intellij.debugger.DefaultDebugEnvironment) DebugEnvironment(com.intellij.debugger.DebugEnvironment) NotNull(org.jetbrains.annotations.NotNull) XDebugSessionImpl(com.intellij.xdebugger.impl.XDebugSessionImpl) Nullable(org.jetbrains.annotations.Nullable)

Example 4 with XDebugSessionImpl

use of com.intellij.xdebugger.impl.XDebugSessionImpl in project intellij-community by JetBrains.

the class DebuggerTreeRenderer method getValueIcon.

public static Icon getValueIcon(ValueDescriptorImpl valueDescriptor) {
    Icon nodeIcon;
    if (valueDescriptor instanceof FieldDescriptorImpl) {
        FieldDescriptorImpl fieldDescriptor = (FieldDescriptorImpl) valueDescriptor;
        nodeIcon = PlatformIcons.FIELD_ICON;
        if (fieldDescriptor.getField().isFinal()) {
            nodeIcon = new LayeredIcon(nodeIcon, AllIcons.Nodes.FinalMark);
        }
        if (fieldDescriptor.isStatic()) {
            nodeIcon = new LayeredIcon(nodeIcon, AllIcons.Nodes.StaticMark);
        }
    } else if (valueDescriptor instanceof ThrownExceptionValueDescriptorImpl) {
        nodeIcon = AllIcons.Nodes.ExceptionClass;
    } else if (valueDescriptor instanceof MethodReturnValueDescriptorImpl) {
        nodeIcon = AllIcons.Debugger.WatchLastReturnValue;
    } else if (isParameter(valueDescriptor)) {
        nodeIcon = PlatformIcons.PARAMETER_ICON;
    } else if (valueDescriptor.isEnumConstant()) {
        nodeIcon = PlatformIcons.ENUM_ICON;
    } else if (valueDescriptor.isArray()) {
        nodeIcon = AllIcons.Debugger.Db_array;
    } else if (valueDescriptor.isPrimitive()) {
        nodeIcon = AllIcons.Debugger.Db_primitive;
    } else if (valueDescriptor instanceof WatchItemDescriptor) {
        nodeIcon = AllIcons.Debugger.Watch;
    } else {
        nodeIcon = AllIcons.Debugger.Value;
    }
    if (valueDescriptor instanceof UserExpressionDescriptorImpl) {
        EnumerationChildrenRenderer enumerationChildrenRenderer = EnumerationChildrenRenderer.getCurrent(((UserExpressionDescriptorImpl) valueDescriptor).getParentDescriptor());
        if (enumerationChildrenRenderer != null && enumerationChildrenRenderer.isAppendDefaultChildren()) {
            nodeIcon = AllIcons.Debugger.Watch;
        }
    }
    // if watches in variables enabled, always use watch icon
    if (valueDescriptor instanceof WatchItemDescriptor && nodeIcon != AllIcons.Debugger.Watch) {
        XDebugSession session = XDebuggerManager.getInstance(valueDescriptor.getProject()).getCurrentSession();
        if (session != null) {
            XDebugSessionTab tab = ((XDebugSessionImpl) session).getSessionTab();
            if (tab != null && tab.isWatchesInVariables()) {
                nodeIcon = AllIcons.Debugger.Watch;
            }
        }
    }
    final Icon valueIcon = valueDescriptor.getValueIcon();
    if (nodeIcon != null && valueIcon != null) {
        nodeIcon = new RowIcon(nodeIcon, valueIcon);
    }
    return nodeIcon;
}
Also used : EnumerationChildrenRenderer(com.intellij.debugger.ui.tree.render.EnumerationChildrenRenderer) XDebugSession(com.intellij.xdebugger.XDebugSession) XDebugSessionTab(com.intellij.xdebugger.impl.ui.XDebugSessionTab) XDebugSessionImpl(com.intellij.xdebugger.impl.XDebugSessionImpl)

Example 5 with XDebugSessionImpl

use of com.intellij.xdebugger.impl.XDebugSessionImpl in project intellij-community by JetBrains.

the class XMarkObjectActionHandler method perform.

@Override
public void perform(@NotNull Project project, AnActionEvent event) {
    XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession();
    if (session == null)
        return;
    XValueMarkers<?, ?> markers = ((XDebugSessionImpl) session).getValueMarkers();
    XValueNodeImpl node = XDebuggerTreeActionBase.getSelectedNode(event.getDataContext());
    if (markers == null || node == null)
        return;
    XValue value = node.getValueContainer();
    boolean detachedView = DebuggerUIUtil.isInDetachedTree(event);
    XDebuggerTreeState treeState = XDebuggerTreeState.saveState(node.getTree());
    ValueMarkup existing = markers.getMarkup(value);
    if (existing != null) {
        markers.unmarkValue(value);
    } else {
        ValueMarkerPresentationDialog dialog = new ValueMarkerPresentationDialog(event.getData(CONTEXT_COMPONENT), node.getName());
        dialog.show();
        ValueMarkup markup = dialog.getConfiguredMarkup();
        if (dialog.isOK() && markup != null) {
            markers.markValue(value, markup);
        }
    }
    if (detachedView) {
        node.getTree().rebuildAndRestore(treeState);
    }
    session.rebuildViews();
}
Also used : XDebugSession(com.intellij.xdebugger.XDebugSession) XDebuggerTreeState(com.intellij.xdebugger.impl.ui.tree.XDebuggerTreeState) ValueMarkerPresentationDialog(com.intellij.xdebugger.impl.ui.tree.ValueMarkerPresentationDialog) XValueNodeImpl(com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl) XValue(com.intellij.xdebugger.frame.XValue) ValueMarkup(com.intellij.xdebugger.impl.ui.tree.ValueMarkup) XDebugSessionImpl(com.intellij.xdebugger.impl.XDebugSessionImpl)

Aggregations

XDebugSessionImpl (com.intellij.xdebugger.impl.XDebugSessionImpl)11 XDebugSession (com.intellij.xdebugger.XDebugSession)9 XDebugSessionTab (com.intellij.xdebugger.impl.ui.XDebugSessionTab)4 XExpression (com.intellij.xdebugger.XExpression)2 ValueMarkup (com.intellij.xdebugger.impl.ui.tree.ValueMarkup)2 XValueNodeImpl (com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl)2 NotNull (org.jetbrains.annotations.NotNull)2 DebugEnvironment (com.intellij.debugger.DebugEnvironment)1 DefaultDebugEnvironment (com.intellij.debugger.DefaultDebugEnvironment)1 DebugProcessImpl (com.intellij.debugger.engine.DebugProcessImpl)1 EnumerationChildrenRenderer (com.intellij.debugger.ui.tree.render.EnumerationChildrenRenderer)1 DefaultExecutionResult (com.intellij.execution.DefaultExecutionResult)1 ExecutionResult (com.intellij.execution.ExecutionResult)1 ExecutionEnvironment (com.intellij.execution.runners.ExecutionEnvironment)1 ExecutionConsole (com.intellij.execution.ui.ExecutionConsole)1 RunnerLayoutUi (com.intellij.execution.ui.RunnerLayoutUi)1 NotificationListener (com.intellij.notification.NotificationListener)1 Document (com.intellij.openapi.editor.Document)1 LineExtensionInfo (com.intellij.openapi.editor.LineExtensionInfo)1 TextAttributes (com.intellij.openapi.editor.markup.TextAttributes)1