protected void startDebugger(final DebugSessionDto debugSessionDto) { List<BreakpointDto> breakpoints = breakpointManager.getAll().stream().map(this::toDto).collect(Collectors.toList()); StartActionDto action = dtoFactory.createDto(StartActionDto.class); action.setType(Action.TYPE.START); action.setBreakpoints(breakpoints); service.start(debugSessionDto.getId(), action); }
@Override public void addNode(String path, int kind) { if (categories.containsKey(path)) { return; } dirty = true; delegate.onDirtyChanged(); categories.put(path, dtoFactory.createDto(ClasspathEntry.class).withEntryKind(kind)); view.setData(categories); view.renderLibraries(); }
@Override public void addNode(String path, int kind) { if (categories.containsKey(path)) { return; } dirty = true; delegate.onDirtyChanged(); categories.put(path, dtoFactory.createDto(ClasspathEntry.class).withEntryKind(kind)); view.setData(categories); view.renderNodes(); }
@Override public Promise<Void> add(Path project, boolean update, Path[] paths) { AddRequest addRequest = dtoFactory.createDto(AddRequest.class).withUpdate(update); addRequest.setFilePattern( paths == null ? DEFAULT_PATTERN : stream(paths).map(path -> path.isEmpty() ? "." : path.toString()).collect(toList())); String url = getWsAgentBaseUrl() + ADD + "?projectPath=" + encodePath(project); return asyncRequestFactory.createPostRequest(url, addRequest).loader(loader).send(); }
@Override public JsonRpcPromise<ProcessKillResponseDto> killProcess(String endpointId, final int pid) { Log.debug(getClass(), "Killing a process. PID: " + pid); ProcessKillRequestDto dto = dtoFactory.createDto(ProcessKillRequestDto.class).withPid(pid); return transmitter .newRequest() .endpointId(endpointId) .methodName(PROCESS_KILL) .paramsAsDto(dto) .sendAndReceiveResultAsDto(ProcessKillResponseDto.class); }
@Override public JsonRpcPromise<List<GetProcessesResponseDto>> getProcesses( String endpointId, boolean all) { Log.debug(getClass(), "Getting processes info. All: " + all); GetProcessesRequestDto dto = dtoFactory.createDto(GetProcessesRequestDto.class).withAll(all); return transmitter .newRequest() .endpointId(endpointId) .methodName(PROCESS_GET_PROCESSES) .paramsAsDto(dto) .sendAndReceiveResultAsListOfDto(GetProcessesResponseDto.class); }
@Override public JsonRpcPromise<GetProcessResponseDto> getProcess(String endpointId, int pid) { Log.debug(getClass(), "Getting process info. PID: " + pid); GetProcessRequestDto dto = dtoFactory.createDto(GetProcessRequestDto.class).withPid(pid); return transmitter .newRequest() .endpointId(endpointId) .methodName(PROCESS_GET_PROCESS) .paramsAsDto(dto) .sendAndReceiveResultAsDto(GetProcessResponseDto.class); }
private void sendCloseEvent() { TextDocumentIdentifier documentId = dtoHelper.createTDI(textEditor.getEditorInput().getFile()); DidCloseTextDocumentParams closeEvent = dtoFactory.createDto(DidCloseTextDocumentParams.class); closeEvent.setTextDocument(documentId); textDocumentServiceClient.didClose(closeEvent); }
@Override public Promise<RevertResult> revert(Path project, String commit) { RevertRequest revertRequest = dtoFactory.createDto(RevertRequest.class).withCommit(commit); String url = getWsAgentBaseUrl() + REVERT + "?projectPath=" + project; return asyncRequestFactory .createPostRequest(url, revertRequest) .loader(loader) .send(dtoUnmarshallerFactory.newUnmarshaller(RevertResult.class)); } }
@Override public Promise<SshPairDto> generatePair(String service, String name) { return asyncRequestFactory .createPostRequest( sshApi + "/generate", dtoFactory.createDto(GenerateSshPairRequest.class).withService(service).withName(name)) .header(HTTPHeader.ACCEPT, MimeType.APPLICATION_JSON) .send(unmarshallerFactory.newUnmarshaller(SshPairDto.class)); }
@Override public Promise<Void> remoteAdd(Path project, String name, String url) { RemoteAddRequest remoteAddRequest = dtoFactory.createDto(RemoteAddRequest.class).withName(name).withUrl(url); String requestUrl = getWsAgentBaseUrl() + REMOTE + "?projectPath=" + encodePath(project); return asyncRequestFactory.createPutRequest(requestUrl, remoteAddRequest).loader(loader).send(); }
private void subscribe() { ProjectTreeTrackingOperationDto params = dtoFactory.createDto(ProjectTreeTrackingOperationDto.class).withPath("/").withType(START); requestTransmitter .newRequest() .endpointId(WS_AGENT_JSON_RPC_ENDPOINT_ID) .methodName("track/project-tree") .paramsAsDto(params) .sendAndSkipResult(); } }
public void subscribe(String endpointId, String method, Map<String, String> scope) { requestTransmitter .newRequest() .endpointId(endpointId) .methodName("subscribe") .paramsAsDto( dtoFactory.createDto(EventSubscription.class).withMethod(method).withScope(scope)) .sendAndSkipResult(); }
public void unSubscribe(String endpointId, String method, Map<String, String> scope) { requestTransmitter .newRequest() .endpointId(endpointId) .methodName("unSubscribe") .paramsAsDto( dtoFactory.createDto(EventSubscription.class).withMethod(method).withScope(scope)) .sendAndSkipResult(); } }
@Override public Promise<MergeResult> merge(Path project, String commit) { MergeRequest mergeRequest = dtoFactory.createDto(MergeRequest.class).withCommit(commit); String url = getWsAgentBaseUrl() + MERGE + "?projectPath=" + encodePath(project); return asyncRequestFactory .createPostRequest(url, mergeRequest) .loader(loader) .header(ACCEPT, APPLICATION_JSON) .send(dtoUnmarshallerFactory.newUnmarshaller(MergeResult.class)); }
protected BreakpointDto toDto(Breakpoint breakpoint) { return dtoFactory .createDto(BreakpointDto.class) .withLocation(toDto(breakpoint.getLocation())) .withEnabled(true) .withBreakpointConfiguration( breakpoint.getBreakpointConfiguration() == null ? null : toDto(breakpoint.getBreakpointConfiguration())); }
@Override public Promise<Void> clone(Path project, String remoteUri, String remoteName) { CloneRequest cloneRequest = dtoFactory .createDto(CloneRequest.class) .withRemoteName(remoteName) .withRemoteUri(remoteUri) .withWorkingDir(project.toString()); String params = "?projectPath=" + encodePath(project); String url = CLONE + params; return asyncRequestFactory.createPostRequest(url, cloneRequest).loader(loader).send(); }
/** {@inheritDoc} */ @Override public Promise<String> getContent() { ExternalLibrariesParameters params = dtoFactory.createDto(ExternalLibrariesParameters.class); params.setProjectUri(project.toString()); params.setNodePath(getData().getPath()); params.setNodeId(libId); return service .getFileContent(getData().getUri()) .then((Function<String, String>) result -> result); }
protected BreakpointConfigurationDto toDto(BreakpointConfiguration breakpointConfiguration) { return dtoFactory .createDto(BreakpointConfigurationDto.class) .withSuspendPolicy(breakpointConfiguration.getSuspendPolicy()) .withHitCount(breakpointConfiguration.getHitCount()) .withCondition(breakpointConfiguration.getCondition()) .withConditionEnabled(breakpointConfiguration.isConditionEnabled()) .withHitCountEnabled(breakpointConfiguration.isHitCountEnabled()); }
private MoveSettings createMoveSettings() { MoveSettings moveSettings = dtoFactory.createDto(MoveSettings.class); moveSettings.setDestination(destinationPath); moveSettings.setElements(moveParameters.getResources()); moveSettings.setUpdateReferences(view.isUpdateReferences()); moveSettings.setUpdateQualifiedNames(view.isUpdateQualifiedNames()); if (moveSettings.isUpdateQualifiedNames()) { moveSettings.setFilePatterns(view.getFilePatterns()); } return moveSettings; }