use of org.intellij.plugins.xsltDebugger.rt.engine.Breakpoint 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 org.intellij.plugins.xsltDebugger.rt.engine.Breakpoint in project intellij-community by JetBrains.
the class XsltBreakpointHandler method unregisterBreakpoint.
@Override
public void unregisterBreakpoint(@NotNull XLineBreakpoint<XBreakpointProperties> breakpoint, final boolean temporary) {
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);
try {
final BreakpointManager manager = myXsltDebugProcess.getBreakpointManager();
if (temporary) {
final Breakpoint bp = manager.getBreakpoint(fileURL, lineNumber);
if (bp != null) {
bp.setEnabled(false);
}
} else {
manager.removeBreakpoint(fileURL, lineNumber);
}
} catch (DebuggerStoppedException ignore) {
} catch (VMPausedException e) {
myXsltDebugProcess.getSession().reportMessage("Target VM is not responding. Breakpoint can not be removed", MessageType.ERROR);
}
}
use of org.intellij.plugins.xsltDebugger.rt.engine.Breakpoint in project intellij-community by JetBrains.
the class XsltDebugProcess method init.
public void init(Debugger client) {
myDebuggerSession = XsltDebuggerSession.getInstance(myProcessHandler);
myDebuggerSession.addListener(new XsltDebuggerSession.Listener() {
@Override
public void debuggerSuspended() {
final Debugger c = myDebuggerSession.getClient();
getSession().positionReached(new MySuspendContext(myDebuggerSession, c.getCurrentFrame(), c.getSourceFrame()));
}
@Override
public void debuggerResumed() {
}
@Override
public void debuggerStopped() {
myBreakpointManager = new BreakpointManagerImpl();
}
});
final BreakpointManager mgr = client.getBreakpointManager();
if (myBreakpointManager != mgr) {
final List<Breakpoint> breakpoints = myBreakpointManager.getBreakpoints();
for (Breakpoint breakpoint : breakpoints) {
final Breakpoint bp = mgr.setBreakpoint(breakpoint.getUri(), breakpoint.getLine());
bp.setEnabled(breakpoint.isEnabled());
bp.setLogMessage(breakpoint.getLogMessage());
bp.setTraceMessage(breakpoint.getTraceMessage());
bp.setCondition(breakpoint.getCondition());
bp.setSuspend(breakpoint.isSuspend());
}
myBreakpointManager = mgr;
}
}
Aggregations