Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 162608

Summary: [Project Sets] Be able to import a .psf file directly from a URL
Product: [Eclipse Project] Platform Reporter: Willian Mitsuda <wmitsuda>
Component: TeamAssignee: Malgorzata Janczarska <malgorzata.tomczyk>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P5 CC: b.muskalla, bradleyjames, brockj, christian.k.2510, danrubel, eclipse, elias, irbull, jeffmcaffer, karsten.thoms, Lars.Vogel, mark.melvin, mirko, mn, pawel.pogorzelski1, prakash, pwebster, remy.suen, robert.elves, ruediger.herrmann, tomasz.zarna, villane
Version: 3.2.1Keywords: helpwanted
Target Milestone: 3.7 M3   
Hardware: PC   
OS: Windows XP   
Whiteboard: 0.025
Attachments:
Description Flags
Patch
none
mylar/context/zip
none
Proposed patch
none
Corrected patch
none
mylyn/context/zip
none
Some more corrections
none
mylyn/context/zip none

Description Willian Mitsuda CLA 2006-10-27 14:22:24 EDT
Actually, to import a .psf file I have to download it, Import -> Team Project Set, and after that, I usually discard the file.

It would be very convenient to be able to just specify the .psf URL in the "Import Team Project Set" dialog, not having to download it.
Comment 1 Bogdan Gheorghe CLA 2006-11-03 16:42:03 EST
We agree, we just don't have the manpower to spare to put this in. Patches are welcome.
Comment 2 Willian Mitsuda CLA 2006-12-25 19:10:15 EST
Created attachment 56177 [details]
Patch
Comment 3 Willian Mitsuda CLA 2006-12-25 19:10:39 EST
Created attachment 56178 [details]
mylar/context/zip
Comment 4 Michael Valenta CLA 2007-01-02 10:57:44 EST
The main problem with this patch is that it is possible that reading from a remote stream will cause Eclipse to hang unless the proper precautions are taken. Have a look at bug 73683 comment 7 for a description of what is required when reading from remote streams. The Team/Core plug-in does have some classes to help with this. Have a look at the PollingInputStream class that can be used to provide progress and cancelation. They are not well documented but you can find some examples of their use in the CVS plug-ins. You will also need to wrap the socket creation in some defensive code since socket creation has no timeout. Have a ;look at the PServerConnection#ResponsiveSocketFacory class in the CVS/Core plug-in for an example of how to safely open a socket.
Comment 5 Mirko Raner CLA 2008-07-30 18:46:29 EDT
Is anybody currently working on this?

Wouldn't it be sufficient to open the URL connection in a different thread to prevent the workbench from hanging? Maybe there are some better utility classes for this sort of scenario available at this point?

Anyway, I run all the time into the problem that Willian originally described, and it would be really nice to have this addressed, especially, since it doesn't really appear to be that big of a deal to provide the suggested functionality.
Comment 6 Remy Suen CLA 2009-11-12 21:28:18 EST
*** Bug 295033 has been marked as a duplicate of this bug. ***
Comment 7 Tomasz Zarna CLA 2010-01-19 05:11:37 EST
*** Bug 299973 has been marked as a duplicate of this bug. ***
Comment 8 Tomasz Zarna CLA 2010-01-21 07:04:51 EST
I won't make it in 3.6M5, I'm too busy with blockers of bug 236169. Moving to 3.6M6.
Comment 9 Tomasz Zarna CLA 2010-02-19 05:51:52 EST
Deferring due to lack of cycles in 3.6M6.
Comment 10 Pawel Pogorzelski CLA 2010-04-19 07:31:48 EDT
Deferring to 3.7.
Comment 11 Malgorzata Janczarska CLA 2010-09-20 11:26:07 EDT
Created attachment 179256 [details]
Proposed patch
Comment 12 Malgorzata Janczarska CLA 2010-09-21 07:31:57 EDT
Created attachment 179298 [details]
Corrected patch
Comment 13 Malgorzata Janczarska CLA 2010-09-21 07:32:04 EDT
Created attachment 179300 [details]
mylyn/context/zip
Comment 14 Tomasz Zarna CLA 2010-09-22 08:35:05 EDT
The patch looks good, but I think it could be improved a little bit:
* to set timeout on a connection you could reuse the org.eclipse.compare.internal.Utilities.setReadTimeout(URLConnection, int). Don't worry about reaching internals of Compare for now, this will be fixed in bug 298460.
* I'm pretty sure there is an utility method you could use to replace ImportProjectSetMainPage.readPsfFromURL(InputStream, String, int, IProgressMonitor) you added
* Have you considered making org.eclipse.compare.internal.patch.InputPatchPage.getURLContents(String) public (and moving it to a utility class)? It does pretty much the same thing as org.eclipse.team.internal.ui.wizards.ImportProjectSetMainPage.getURLContents()
* double check all your comments, I've found few typos e.g. "Signleton"
* please format all blocks of code you added in patch
Comment 15 Malgorzata Janczarska CLA 2010-09-23 06:57:25 EDT
Created attachment 179444 [details]
Some more corrections
Comment 16 Malgorzata Janczarska CLA 2010-09-23 06:57:28 EDT
Created attachment 179445 [details]
mylyn/context/zip
Comment 17 Tomasz Zarna CLA 2010-09-24 06:42:17 EDT
The latest patch has been applied to HEAD. Available in builds >N20100922-2000. Thanks Gosia!

Could anyone from the CC list verify the fix?