[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [ecf-dev] Using ECF filetransfer with progress
|
Hi Thomas,
Thomas Hallgren wrote:
Hi Scott,
Thanks for the pointers. Yes, this approach might help. I do have two
issues with it. The first is that I miss a method that returns the
'fileLength'. getPercentageComplete() is probably OK though, so that's
not a biggie.
Wow...I had misremembered that this method was not there. And although
it's a convenience method, it can/probably should be added anyway:
long IFileTransfer.getFileLength();
I've created enhancement request for this here:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=220301
But then there's the Job and it's progress monitor. Either the code is
faulty or I miss something.
The GetFileHandler.execute() creates a new Job and schedules it. Once
it starts, it passes an IProgressMonitor to its run method. The
monitor is declared final so that it is accessible from within the
IFileTransferListener.handleTransferEvent() method. The run method
calls on adapter.sendRetrieveRequest(), then monitor.done(), and then
it exits.
AFAIK, the monitor is now no longer valid. So what happens the next
time the IFileTransferListener.handleTransferEvent() is called? Or is
the sendRetrieveRequest() used here synchronous somehow?
No the monitor is no longer valid, so the monitor.worked(1) call does
nothing. I had forgotten to remove this code as it was originally
contributed by Paul. The update info is presented in the UI, however,
in the FileTransfersView via the updateTransferInView(shell, incoming)
call and the completeTransferInView(shell,incoming) call.
Scott
Regards,
Thomas Hallgren
Scott Lewis wrote:
Hi Thomas,
Coincidently, just over the past few days Paul Webster has
contributed some UI code that uses ECF file transfer. And over this
past weekend I hooked this up to a relatively new FileTransfersView
(a view that shows pending and completed file transfers).
GetFileHandler (this is implemented as a command handler, so that it
can be used in multiple ui contexts):
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.ecf/plugins/org.eclipse.ecf.filetransfer.ui/src/org/eclipse/ecf/internal/filetransfer/ui/GetFileHandler.java?root=Technology_Project&view=log
Here's the FileTransfersView class:
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.ecf/plugins/org.eclipse.ecf.filetransfer.ui/src/org/eclipse/ecf/filetransfer/ui/FileTransfersView.java?root=Technology_Project&view=log
What this does is to access the FileTransfersView class and pass in
the IIncomingFileTransfer instance created on successfull call to
event.receive(outputstream)
This is not necessarily the only/best way, but it does work. I've
contemplated other ways (i.e. creating a separate shell/window just
for file transfer status [like FireFox], creating a separate one for
each transfer...etc)...but I've not produced them yet. Any
contributions in this area would be most welcome, of course.
Thanks,
Scott
Thomas Hallgren wrote:
Our current download mechanism uses a progress monitor that is
initialized using the URLConnection.getContentLength(). I can see
that the FileTransferJob started from the
AbstractTetrieveFileTransfer does the same thing. What I'm lacking
is some way to add a more elaborate progress reporting. Our reporter
will continuously set new subtasks with a text like
"Downloading <filename>: 845kB of 2.8MB at 130kB/s"
I don't seem to find the interfaces I need to implement this using
ECF. Any ideas on how to do this?
Regards,
Thomas Hallgren
_______________________________________________
ecf-dev mailing list
ecf-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ecf-dev
_______________________________________________
ecf-dev mailing list
ecf-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ecf-dev
_______________________________________________
ecf-dev mailing list
ecf-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ecf-dev