use of org.eclipse.che.api.debug.shared.dto.BreakpointDto in project che by eclipse.
the class AbstractDebugger method startDebugger.
protected void startDebugger(final DebugSessionDto debugSessionDto) {
List<BreakpointDto> breakpoints = new ArrayList<>();
for (Breakpoint breakpoint : breakpointManager.getBreakpointList()) {
LocationDto locationDto = dtoFactory.createDto(LocationDto.class).withLineNumber(breakpoint.getLineNumber() + 1).withResourcePath(breakpoint.getPath()).withResourceProjectPath(getProject(breakpoint.getFile()).getPath());
String target = pathToFqn(breakpoint.getFile());
if (target != null) {
locationDto.setTarget(target);
BreakpointDto breakpointDto = dtoFactory.createDto(BreakpointDto.class);
breakpointDto.setLocation(locationDto);
breakpointDto.setEnabled(true);
breakpoints.add(breakpointDto);
}
}
StartActionDto action = dtoFactory.createDto(StartActionDto.class);
action.setType(Action.TYPE.START);
action.setBreakpoints(breakpoints);
service.start(debugSessionDto.getId(), action);
}
use of org.eclipse.che.api.debug.shared.dto.BreakpointDto in project che by eclipse.
the class AbstractDebugger method onEventListReceived.
private void onEventListReceived(@NotNull DebuggerEventDto event) {
LocationDto newLocationDto;
switch(event.getType()) {
case SUSPEND:
newLocationDto = ((SuspendEventDto) event).getLocation();
break;
case BREAKPOINT_ACTIVATED:
BreakpointDto breakpointDto = ((BreakpointActivatedEventDto) event).getBreakpoint();
onBreakpointActivated(breakpointDto.getLocation());
return;
case DISCONNECT:
disconnect();
return;
default:
Log.error(AbstractDebugger.class, "Unknown debuggerType of debugger event: " + event.getType());
return;
}
if (newLocationDto != null) {
currentLocation = newLocationDto;
openCurrentFile();
}
preserveDebuggerState();
}
use of org.eclipse.che.api.debug.shared.dto.BreakpointDto in project che by eclipse.
the class AbstractDebugger method addBreakpoint.
@Override
public void addBreakpoint(final VirtualFile file, final int lineNumber) {
if (isConnected()) {
String fqn = pathToFqn(file);
if (fqn == null) {
return;
}
final String filePath = file.getLocation().toString();
LocationDto locationDto = dtoFactory.createDto(LocationDto.class).withLineNumber(lineNumber + 1).withTarget(fqn).withResourcePath(filePath).withResourceProjectPath(getProject(file).getPath());
BreakpointDto breakpointDto = dtoFactory.createDto(BreakpointDto.class).withLocation(locationDto).withEnabled(true);
Promise<Void> promise = service.addBreakpoint(debugSessionDto.getId(), breakpointDto);
promise.then(new Operation<Void>() {
@Override
public void apply(Void arg) throws OperationException {
Breakpoint breakpoint = new Breakpoint(Breakpoint.Type.BREAKPOINT, lineNumber, filePath, file, true);
for (DebuggerObserver observer : observers) {
observer.onBreakpointAdded(breakpoint);
}
}
}).catchError(new Operation<PromiseError>() {
@Override
public void apply(PromiseError arg) throws OperationException {
Log.error(AbstractDebugger.class, arg.getMessage());
}
});
} else {
Breakpoint breakpoint = new Breakpoint(Breakpoint.Type.BREAKPOINT, lineNumber, file.getLocation().toString(), file, false);
for (DebuggerObserver observer : observers) {
observer.onBreakpointAdded(breakpoint);
}
}
}
Aggregations