use of com.intellij.xdebugger.XDebugSession 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;
}
use of com.intellij.xdebugger.XDebugSession in project intellij-community by JetBrains.
the class XsltBreakpointHandler method registerBreakpoint.
@Override
public void registerBreakpoint(@NotNull XLineBreakpoint<XBreakpointProperties> breakpoint) {
final XSourcePosition sourcePosition = breakpoint.getSourcePosition();
if (sourcePosition == null || !sourcePosition.getFile().exists() || !sourcePosition.getFile().isValid()) {
// ???
return;
}
final VirtualFile file = sourcePosition.getFile();
final Project project = myXsltDebugProcess.getSession().getProject();
final String fileURL = getFileURL(file);
final int lineNumber = getActualLineNumber(breakpoint, project);
if (lineNumber == -1) {
final XDebugSession session = myXsltDebugProcess.getSession();
session.updateBreakpointPresentation(breakpoint, AllIcons.Debugger.Db_invalid_breakpoint, "Unsupported breakpoint position");
return;
}
try {
final BreakpointManager manager = myXsltDebugProcess.getBreakpointManager();
Breakpoint bp;
if ((bp = manager.getBreakpoint(fileURL, lineNumber)) != null) {
bp.setEnabled(true);
} else {
manager.setBreakpoint(fileURL, lineNumber);
}
} catch (DebuggerStoppedException ignore) {
} catch (VMPausedException e) {
final XDebugSession session = myXsltDebugProcess.getSession();
session.reportMessage("Target VM is not responding. Breakpoint can not be set", MessageType.ERROR);
session.updateBreakpointPresentation(breakpoint, AllIcons.Debugger.Db_invalid_breakpoint, "Target VM is not responding. Breakpoint can not be set");
}
}
use of com.intellij.xdebugger.XDebugSession in project intellij-community by JetBrains.
the class PyExecuteSelectionAction method selectConsole.
private static void selectConsole(@NotNull DataContext dataContext, @NotNull Project project, final Consumer<PyCodeExecutor> consumer, Editor editor) {
Collection<RunContentDescriptor> consoles = getConsoles(project);
ExecutionHelper.selectContentDescriptor(dataContext, project, consoles, "Select console to execute in", descriptor -> {
if (descriptor != null && descriptor.getExecutionConsole() instanceof PyCodeExecutor) {
ExecutionConsole console = descriptor.getExecutionConsole();
consumer.consume((PyCodeExecutor) console);
if (console instanceof PythonDebugLanguageConsoleView) {
XDebugSession currentSession = XDebuggerManager.getInstance(project).getCurrentSession();
if (currentSession != null) {
ContentManager contentManager = currentSession.getUI().getContentManager();
Content content = contentManager.findContent("Console");
contentManager.setSelectedContent(content);
IdeFocusManager.findInstance().requestFocus(editor.getContentComponent(), true);
}
} else {
PythonConsoleToolWindow consoleToolWindow = PythonConsoleToolWindow.getInstance(project);
ToolWindow toolWindow = consoleToolWindow != null ? consoleToolWindow.getToolWindow() : null;
if (toolWindow != null && !toolWindow.isVisible()) {
toolWindow.show(null);
ContentManager contentManager = toolWindow.getContentManager();
Content content = contentManager.findContent(descriptor.getDisplayName());
if (content != null) {
contentManager.setSelectedContent(content);
}
}
}
}
});
}
use of com.intellij.xdebugger.XDebugSession in project android by JetBrains.
the class InstantRunManager method refreshDebugger.
private void refreshDebugger(@NotNull String packageName) {
// First we reapply the breakpoints on the new code, otherwise the breakpoints
// remain set on the old classes and will never be hit again.
ApplicationManager.getApplication().runReadAction(new Runnable() {
@Override
public void run() {
DebuggerManagerEx debugger = DebuggerManagerEx.getInstanceEx(myProject);
if (!debugger.getSessions().isEmpty()) {
List<Breakpoint> breakpoints = debugger.getBreakpointManager().getBreakpoints();
for (Breakpoint breakpoint : breakpoints) {
if (breakpoint.isEnabled()) {
breakpoint.setEnabled(false);
breakpoint.setEnabled(true);
}
}
}
}
});
// Now we refresh the call-stacks and the variable panes.
DebuggerManagerEx debugger = DebuggerManagerEx.getInstanceEx(myProject);
for (final DebuggerSession session : debugger.getSessions()) {
Client client = session.getProcess().getProcessHandler().getUserData(AndroidSessionInfo.ANDROID_DEBUG_CLIENT);
if (client != null && client.isValid() && StringUtil.equals(packageName, client.getClientData().getClientDescription())) {
session.getProcess().getManagerThread().invoke(new DebuggerCommandImpl() {
@Override
protected void action() throws Exception {
DebuggerContextImpl context = session.getContextManager().getContext();
SuspendContextImpl suspendContext = context.getSuspendContext();
if (suspendContext != null) {
XExecutionStack stack = suspendContext.getActiveExecutionStack();
if (stack != null) {
((JavaExecutionStack) stack).initTopFrame();
}
}
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
session.refresh(false);
XDebugSession xSession = session.getXDebugSession();
if (xSession != null) {
xSession.resume();
}
}
});
}
});
}
}
}
use of com.intellij.xdebugger.XDebugSession in project intellij-plugins by JetBrains.
the class FlexRunner method doExecute.
@Override
protected RunContentDescriptor doExecute(@NotNull final RunProfileState state, @NotNull ExecutionEnvironment env) throws ExecutionException {
final BCBasedRunnerParameters parameters = ((RemoteFlashRunConfiguration) env.getRunProfile()).getRunnerParameters();
RunContentDescriptor runContentDescriptor = XDebuggerManager.getInstance(env.getProject()).startSession(env, new XDebugProcessStarter() {
@Override
@NotNull
public XDebugProcess start(@NotNull final XDebugSession session) throws ExecutionException {
try {
return DebugPathManager.IS_DEV ? new MyFlexDebugProcessAbleToResolveFileDebugId(callback, session, buildConfiguration, parameters) : new MyFlexDebugProcess(callback, session, buildConfiguration, parameters);
} catch (IOException e) {
throw new ExecutionException(e.getMessage(), e);
} finally {
buildConfiguration = null;
}
}
}).getRunContentDescriptor();
ProcessHandler processHandler = runContentDescriptor.getProcessHandler();
assert processHandler != null;
//noinspection deprecation
processHandler.putUserData(ProcessHandler.SILENTLY_DESTROY_ON_CLOSE, true);
return runContentDescriptor;
}
Aggregations