use of com.nextgenactionscript.vscode.debug.requests.SourceBreakpoint in project vscode-nextgenas by BowlerHatLLC.
the class SWFDebugSession method setBreakpoints.
public void setBreakpoints(Response response, SetBreakpointsRequest.SetBreakpointsArguments arguments) {
String path = arguments.source.path;
Path pathAsPath = Paths.get(path);
List<Breakpoint> breakpoints = new ArrayList<>();
for (int i = 0, count = arguments.breakpoints.length; i < count; i++) {
SourceBreakpoint sourceBreakpoint = arguments.breakpoints[i];
int sourceLine = sourceBreakpoint.line;
Breakpoint responseBreakpoint = new Breakpoint();
responseBreakpoint.line = sourceLine;
int fileId = -1;
try {
SwfInfo[] swfs = swfSession.getSwfs();
for (SwfInfo swf : swfs) {
SourceFile[] sourceFiles = swf.getSourceList(swfSession);
for (SourceFile sourceFile : sourceFiles) {
//file system case sensitivity.
if (pathAsPath.equals(Paths.get(sourceFile.getFullPath())) && (path.endsWith(FILE_EXTENSION_AS) || path.endsWith(FILE_EXTENSION_MXML))) {
fileId = sourceFile.getId();
break;
}
}
if (fileId != -1) {
break;
}
}
if (fileId == -1) {
//either the file was not found, or it has an unsupported
//extension
responseBreakpoint.verified = false;
} else {
Location breakpointLocation = swfSession.setBreakpoint(fileId, sourceLine);
if (breakpointLocation != null) {
//I don't know if the line could change, but might as well
//use the one returned by the location
responseBreakpoint.line = breakpointLocation.getLine();
responseBreakpoint.verified = true;
} else {
//setBreakpoint() may return null if the breakpoint could
//not be set. that's fine. the user will see that the
//breakpoint is not verified, so it's fine.
responseBreakpoint.verified = false;
}
}
} catch (InProgressException e) {
e.printStackTrace(System.err);
responseBreakpoint.verified = false;
} catch (NoResponseException e) {
e.printStackTrace(System.err);
responseBreakpoint.verified = false;
} catch (NotConnectedException e) {
e.printStackTrace(System.err);
responseBreakpoint.verified = false;
}
breakpoints.add(responseBreakpoint);
}
sendResponse(response, new SetBreakpointsResponseBody(breakpoints));
}
Aggregations