Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 263855 - [Import/Export] [Wizards] Request Project Import Wizard allow for an initial / pre-populated path
Summary: [Import/Export] [Wizards] Request Project Import Wizard allow for an initial ...
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.5   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 3.5 M6   Edit
Assignee: Prakash Rangaraj CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-05 15:05 EST by Chris Austin CLA
Modified: 2009-06-03 13:47 EDT (History)
1 user (show)

See Also:


Attachments
Initial implementation idea (4.67 KB, patch)
2009-02-05 15:05 EST, Chris Austin CLA
no flags Details | Diff
Test for the Patch (2.93 KB, patch)
2009-02-13 01:51 EST, Prakash Rangaraj CLA
no flags Details | Diff
Second generation implementation (8.08 KB, patch)
2009-02-13 16:31 EST, Chris Austin CLA
pwebster: iplog+
Details | Diff
Patch v03 + tests (9.86 KB, patch)
2009-02-24 05:18 EST, Prakash Rangaraj CLA
pwebster: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Austin CLA 2009-02-05 15:05:22 EST
Created attachment 124863 [details]
Initial implementation idea

Currently, there is no way to specify an initial path to the project import wizard.  We would like to bring up the Import Wizard, with a specific archive file pre-populated in the archive path field.  

Since 'Select archive file' is not the default action, this initial path would also select the 'Select archive file' radio button - it would determine which radio to select simply with: new File(initialPath).isDirectory().

I have drafted up a patch (based off the latest from HEAD) of what this would look like.
Comment 1 Rich Watts CLA 2009-02-05 15:28:54 EST
We are looking to replace what is essentially the same project import code with the eclipse version, but we need to be able to call it programmatically, seeding the file/zip path for the user.
Comment 2 Prakash Rangaraj CLA 2009-02-13 01:51:27 EST
Created attachment 125608 [details]
Test for the Patch

Patch looks good to me. Thanks Chris.

Attaching the test for the patch.
Comment 3 Paul Webster CLA 2009-02-13 08:08:05 EST
I looks OK, but restoreWidgetValues() will have to be restructured so that only the restored values that need to be overridden when the initialPath is there are.  The Copy check box will need to be persisted (in some but not all cases)

PW
Comment 4 Chris Austin CLA 2009-02-13 10:13:20 EST
Yes, I can add some logic to whether the copy check box is selected - however, I am not certain what logic needs to go into place there - this is what I think:

If there is an initial path, and it is an archive, the checkbox should be selected.  If there is an initial path, and its a directory, the checkbox should default to the saved settings.  If there is no initial path - just do what we did before.

Also, I noticed that when you specify a long initial path, it stretches out the entire dialog to fit the whole path as viewable text, which I don't think is great.  If anyone has an idea how to force the dialog to stay at its original size that would be helpful as well.
Comment 5 Chris Austin CLA 2009-02-13 16:31:04 EST
Created attachment 125691 [details]
Second generation implementation

I added a few changes to take care of the resizing problem I had mentioned.  Instead of using Fill options with the GridData, I give the offending controls some static constants so they are generated an appropriate size - if this doesn't seem like the best fit I am certainly open to suggestions.

The restoreWidgetValues seems to be filling in the appropriate value for the 'Copy projects into workspace' checkbox.
Comment 6 Paul Webster CLA 2009-02-23 13:48:38 EST
(In reply to comment #5)
> Created an attachment (id=125691) [details]
> Second generation implementation

Chris, the rework  looks good, but I'm not sure what TextContentAdapter is doing in there ... what purpose does it serve, as these are file paths?

Prakash, the test needs to be updated to use ProjectRecords.

PW
Comment 7 Chris Austin CLA 2009-02-23 14:03:19 EST
(In reply to comment #6)
> (In reply to comment #5)
> > Created an attachment (id=125691) [details] [details]
> > Second generation implementation
> 
> Chris, the rework  looks good, but I'm not sure what TextContentAdapter is
> doing in there ... what purpose does it serve, as these are file paths?

Paul - I am using the TextContentAdapter as merely a way to set the cursor position to the end of the text for the path field - so instead of seeing "C:\Documents and settings\user\", you would see something like "\user\workspace\temparchive.zip" in the text box.  The premise is that the archive name or end of the path would be more useful to see without scrolling through the whole textbox.

This however may be a moot point, as I have noticed that the File -> Import -> Plugins and Fragments wizard actually expands the window based on an initial path as well.  If you import a plugin using the Plugins and Fragments wizard that has a very long path, and then reopen the Plugins and Fragments wizard, you will see it has expanded out to fit the whole path used during the last successful import.

All of this to say, perhaps we can let the dialog size be altered after all, since there is another case of it here.

Comment 8 Prakash Rangaraj CLA 2009-02-24 05:18:55 EST
Created attachment 126531 [details]
Patch v03 + tests

I've updated the patch & test to reflect the latest code in the head.

Chris,

    I've also removed the TextContentAdapter, and used the setSelection trick to move the cursor to the end. Hope its fine.
Comment 9 Paul Webster CLA 2009-02-24 08:56:39 EST
(In reply to comment #8)
> Created an attachment (id=126531) [details]
> Patch v03 + tests
> 

Released to HEAD (with @since tag) >20090224
Thanx, Prakash, Chris.

PW
Comment 10 Chris Austin CLA 2009-02-24 08:59:12 EST
Great - thanks guys!
Comment 11 Prakash Rangaraj CLA 2009-03-11 02:23:41 EDT
Verified in I20090310-0100