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);
}
}
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;
}
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();
}
}
}
}
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();
}
}
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;
}
Aggregations