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(); }