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