Search in sources :

Example 1 with XDebugSessionTab

use of com.intellij.xdebugger.impl.ui.XDebugSessionTab 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 XDebugSessionTab

use of com.intellij.xdebugger.impl.ui.XDebugSessionTab 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 3 with XDebugSessionTab

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

the class XDebuggerEvaluationDialog method addToWatches.

private void addToWatches() {
    if (myMode == EvaluationMode.EXPRESSION) {
        XExpression expression = getInputEditor().getExpression();
        if (!XDebuggerUtilImpl.isEmptyExpression(expression)) {
            XDebugSessionTab tab = ((XDebugSessionImpl) mySession).getSessionTab();
            if (tab != null) {
                tab.getWatchesView().addWatchExpression(expression, -1, true);
                getInputEditor().requestFocusInEditor();
            }
        }
    }
}
Also used : XDebugSessionTab(com.intellij.xdebugger.impl.ui.XDebugSessionTab) XDebugSessionImpl(com.intellij.xdebugger.impl.XDebugSessionImpl)

Example 4 with XDebugSessionTab

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

the class XDebuggerManagerImpl method removeSession.

public void removeSession(@NotNull final XDebugSessionImpl session) {
    XDebugSessionTab sessionTab = session.getSessionTab();
    mySessions.remove(session.getDebugProcess().getProcessHandler());
    if (sessionTab != null) {
        RunContentDescriptor descriptor = sessionTab.getRunContentDescriptor();
        if (descriptor != null) {
            // in test-mode RunContentWithExecutorListener.contentRemoved events are not sent (see RunContentManagerImpl.showRunContent)
            // so we make sure the mySessions and mySessionData are cleared correctly when session is disposed
            Disposer.register(descriptor, () -> mySessions.remove(session.getDebugProcess().getProcessHandler()));
        }
        if (!myProject.isDisposed() && !ApplicationManager.getApplication().isUnitTestMode() && XDebuggerSettingManagerImpl.getInstanceImpl().getGeneralSettings().isHideDebuggerOnProcessTermination()) {
            ExecutionManager.getInstance(myProject).getContentManager().hideRunContent(DefaultDebugExecutor.getDebugExecutorInstance(), descriptor);
        }
    }
    if (myActiveSession.compareAndSet(session, null)) {
        onActiveSessionChanged();
    }
}
Also used : XDebugSessionTab(com.intellij.xdebugger.impl.ui.XDebugSessionTab) RunContentDescriptor(com.intellij.execution.ui.RunContentDescriptor)

Example 5 with XDebugSessionTab

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

the class XAddToWatchesAction method getWatchesView.

private static XWatchesView getWatchesView(@NotNull AnActionEvent e) {
    XWatchesView view = e.getData(XWatchesView.DATA_KEY);
    Project project = e.getProject();
    if (view == null && project != null) {
        XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession();
        if (session != null) {
            XDebugSessionTab tab = ((XDebugSessionImpl) session).getSessionTab();
            if (tab != null) {
                return tab.getWatchesView();
            }
        }
    }
    return view;
}
Also used : Project(com.intellij.openapi.project.Project) XDebugSession(com.intellij.xdebugger.XDebugSession) XDebugSessionTab(com.intellij.xdebugger.impl.ui.XDebugSessionTab) XWatchesView(com.intellij.xdebugger.impl.frame.XWatchesView) XDebugSessionImpl(com.intellij.xdebugger.impl.XDebugSessionImpl)

Aggregations

XDebugSessionTab (com.intellij.xdebugger.impl.ui.XDebugSessionTab)5 XDebugSessionImpl (com.intellij.xdebugger.impl.XDebugSessionImpl)4 XDebugSession (com.intellij.xdebugger.XDebugSession)2 EnumerationChildrenRenderer (com.intellij.debugger.ui.tree.render.EnumerationChildrenRenderer)1 ExecutionConsole (com.intellij.execution.ui.ExecutionConsole)1 RunContentDescriptor (com.intellij.execution.ui.RunContentDescriptor)1 RunnerLayoutUi (com.intellij.execution.ui.RunnerLayoutUi)1 Project (com.intellij.openapi.project.Project)1 Content (com.intellij.ui.content.Content)1 ContentManager (com.intellij.ui.content.ContentManager)1 XWatchesView (com.intellij.xdebugger.impl.frame.XWatchesView)1 PythonDebugLanguageConsoleView (com.jetbrains.python.console.PythonDebugLanguageConsoleView)1