public EditorChangesDtoImpl(org.eclipse.che.api.project.shared.dto.EditorChangesDto origin) { this.type = origin.getType(); this.text = origin.getText(); this.projectPath = origin.getProjectPath(); this.offset = origin.getOffset(); this.removedCharCount = origin.getRemovedCharCount(); this.length = origin.getLength(); this.fileLocation = origin.getFileLocation(); }
public JsonRpcPromise<Boolean> synchronize( String filePath, String projectPath, DirtyRegion dirtyRegion) { Type type = dirtyRegion.getType().equals(DirtyRegion.INSERT) ? INSERT : REMOVE; EditorChangesDto changes = dtoFactory .createDto(EditorChangesDto.class) .withType(type) .withProjectPath(projectPath) .withFileLocation(filePath) .withOffset(dirtyRegion.getOffset()) .withText(dirtyRegion.getText()); int length = dirtyRegion.getLength(); if (DirtyRegion.REMOVE.equals(dirtyRegion.getType())) { changes.withRemovedCharCount(length); } else { changes.withLength(length); } return requestTransmitter .newRequest() .endpointId(WS_AGENT_JSON_RPC_ENDPOINT_ID) .methodName(EDITOR_CONTENT_CHANGES_METHOD) .paramsAsDto(changes) .sendAndReceiveResultAsBoolean(); }