Bug 421930 - [Import/Export] Import directory as project from File > Open... or Import wizard or DND...
Summary: [Import/Export] Import directory as project from File > Open... or Import wiz...
Status: CLOSED DUPLICATE of bug 457308
Alias: None
Product: e4
Classification: Eclipse Project
Component: UI (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Mickael Istria CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 37478
Blocks:
  Show dependency tree
 
Reported: 2013-11-18 02:27 EST by Mickael Istria CLA
Modified: 2015-02-05 03:57 EST (History)
13 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mickael Istria CLA 2013-11-18 02:27:22 EST
As per user request (especially those who come from NetBeans), it would make sense to ease creation of a new project from a directory.
The only current way to do it is: File > New > General > Project and set location of existing directly to import it as a project in workspace. It is not trivial to guess.

I suggest creating a new import wizard dedicated to the action of importing a folder as project, and add an entry in "Import > Directory as project" in Import wizard, and also to rename "File > Open File..." to "File > Open..." that would:
* Open File in case of a file
* Show Import Existing project wizard in case of a directory with a .project
* Show Import Directory as project wizard in case of a directory without a .project
Comment 1 Dani Megert CLA 2013-11-18 12:19:59 EST
(In reply to Mickael Istria from comment #0)
> As per user request (especially those who come from NetBeans), it would make
> sense to ease creation of a new project from a directory.
> The only current way to do it is: File > New > General > Project and set
> location of existing directly to import it as a project in workspace. It is
> not trivial to guess.
> 
> I suggest creating a new import wizard dedicated to the action of importing
> a folder as project, and add an entry in "Import > Directory as project" in
> Import wizard,

Do we really need a new wizard? Wouldn't it be better to rename the "Existing projects into Workspace" to something more generic and then have it handle the case where the selected directory doesn't have a .project file? We could allow to go to the next page where the user can select the project type/nature.


> and also to rename "File > Open File..." to "File > Open..."
> that would:
> * Open File in case of a file
> * Show Import Existing project wizard in case of a directory with a .project
> * Show Import Directory as project wizard in case of a directory without a
> .project

I don't like to overload "Open...". Besides that, you'd have to implement your own chooser, since there's either the FileDialog to choose a file or the DirectoryDialog to select a directory. 

I'd rather invoke the wizard when dragging a directory into the 'Project Explorer' or 'Package Explorer'. Currently one can (only) drag folders into an existing project or folder.
Comment 2 Dani Megert CLA 2013-11-18 12:28:48 EST
(In reply to Dani Megert from comment #1)
> I'd rather invoke the wizard when dragging a directory into the 'Project
> Explorer' or 'Package Explorer'.

This is bug 80969.
Comment 3 Mickael Istria CLA 2013-11-18 12:56:54 EST
(In reply to Dani Megert from comment #1)
> (In reply to Mickael Istria from comment #0)
> > As per user request (especially those who come from NetBeans), it would make
> > sense to ease creation of a new project from a directory.
> > The only current way to do it is: File > New > General > Project and set
> > location of existing directly to import it as a project in workspace. It is
> > not trivial to guess.
> > 
> > I suggest creating a new import wizard dedicated to the action of importing
> > a folder as project, and add an entry in "Import > Directory as project" in
> > Import wizard,
> 
> Do we really need a new wizard? Wouldn't it be better to rename the
> "Existing projects into Workspace" to something more generic and then have
> it handle the case where the selected directory doesn't have a .project
> file? We could allow to go to the next page where the user can select the
> project type/nature.

Yes, it would work. However, I tried to work on this wizard in context of bug #37478 and I found it quite difficult to handle this case, both from a user POV (there is much more stuff in the wizard that what's this use-case is about) and from a developer POV (I found the code a bit complicated).
That's why I suggest a new wizard, however, if we can rework the existing one to ease this use-case, it's probably better.

> I don't like to overload "Open...". Besides that, you'd have to implement
> your own chooser, since there's either the FileDialog to choose a file or
> the DirectoryDialog to select a directory. 

Ok, The menu entry is not the main pain of the import scenario, so it's fine to keep only "Open File..." for now, focus on the wizard, and then think again about the menu later if we feel it provides some value.

> I'd rather invoke the wizard when dragging a directory into the 'Project
> Explorer' or 'Package Explorer'. Currently one can (only) drag folders into
> an existing project or folder.

I don't use much drag'n'drop, but this scenario is indeed another good candidate for the same use-case of importing.
Comment 4 Markus Keller CLA 2013-11-18 13:26:45 EST
There's also bug 102659 and bug 102527 about configuring a project after importing it. The general project wizard is often not the right wizard.

At least CVS and Git team providers offer a "Use the New Project wizard", which allows the user to create a project using a specialized wizard. For CVS, the problem is that the repository content is not yet checked out at that stage. But for Git and for the Import/DND solution, it should be possible to open the user-chosen wizard with the right directory pre-selected, so that the concrete New Project wizard can actually detect the project layout using its domain knowledge.
Comment 5 Lars Vogel CLA 2013-11-19 04:52:23 EST
>  however, if we can rework the existing
> one to ease this use-case, it's probably better.

I think the distinction between "Select root directory" and "Select archive file" could be removed. I think a simpler solution would be: Only one selection and the user can either select an archive file or a directory and the wizard handles this automatically.
Comment 6 Mickael Istria CLA 2013-11-19 05:27:23 EST
What does it mean to have this bug assigned? Does it mean that this bug will get fixed by Daniel for next milestone?
If not, I guess I can give a shot on a new wizard within a few days.
Comment 7 Daniel Rolka CLA 2013-11-19 05:47:36 EST
(In reply to Mickael Istria from comment #6)
> What does it mean to have this bug assigned? Does it mean that this bug will
> get fixed by Daniel for next milestone?
> If not, I guess I can give a shot on a new wizard within a few days.

Sorry, I've subscribed to this bug to have it on my "observable" list (it seems to be quite interesting improvement). However maybe will be better to keep it in the inbox

Daniel
Comment 8 Mickael Istria CLA 2013-11-19 10:11:44 EST
I created a dedicated wizard for this use-case: https://git.eclipse.org/r/18566
So far, it's only available in Import Wizards, not linked to "Open File..." nor drag'n'drop.
Comment 9 Dani Megert CLA 2013-11-19 10:35:15 EST
(In reply to Lars Vogel from comment #5)
> I think the distinction between "Select root directory" and "Select archive
> file" could be removed. I think a simpler solution would be: Only one
> selection and the user can either select an archive file or a directory and
> the wizard handles this automatically.

See comment 1: there's an OS dialog to choose files and one to choose directories. You would have to write a custom dialog for what you suggest. This would be unexpected for most users.
Comment 10 Mickael Istria CLA 2013-11-19 12:02:39 EST
@Dani: When you're mentioning the existing wizard, are you talking about the Import ProjectS wizard? The issue I see with this one is that most of its UI is currently a CheckboxTree to select multiple projects, which doesn't make sense for the use-case of importing a directory as a workspace project.

Can you elaborate on the suggested usage of such wizard for this use-case (and the other ones already covered by the wizard) ? Screenshots sketches or UI mockups would be helpful.
Comment 11 Dani Megert CLA 2013-11-20 08:03:49 EST
I was thinking about this over night a bit more and come to the following conclusion: as a user, what I would simply expect to work is that I can choose 'File System' as import source. In that wizard we put the existing 'Into folder:' and the new 'Into workspace as: (preset with name of the chosen system directory)' as radio buttons in a group.

In a first version, we simply import the project as general project. In the second version we can invoke the New Project Wizard like the CVS Check Out As... does. The luxury version would integrate the New Project Wizard directly into the import wizard (on the next page(s)).
Comment 12 Mickael Istria CLA 2013-11-20 08:26:37 EST
That's what I've tried for bug 37478 (I've linked to a draft branch on github), but I found it complicated to have to deal with the resource selection tree and the option group for this use-case, whereas in case of importing as a new project, we should see working sets selection instead.
So maybe it can be the same wizard, but I don't think it's possible to have both on the same page.
Comment 13 Dani Megert CLA 2013-11-20 08:31:10 EST
(In reply to Mickael Istria from comment #12)
> That's what I've tried for bug 37478 (I've linked to a draft branch on
> github), but I found it complicated to have to deal with the resource
> selection tree and the option group for this use-case, whereas in case of
> importing as a new project, we should see working sets selection instead.
> So maybe it can be the same wizard, but I don't think it's possible to have
> both on the same page.

That's the cool thing: we don't have to add stuff for working sets (at least not in the first version). Once we invoke the New Project Wizard, you have all the things you need (depending on which project type you choose). I suggest you try the CVS Check Out As... to see how it will work.
Comment 14 Mickael Istria CLA 2013-11-20 08:51:34 EST
> That's the cool thing: we don't have to add stuff for working sets (at least
> not in the first version). Once we invoke the New Project Wizard, you have
> all the things you need (depending on which project type you choose). I
> suggest you try the CVS Check Out As... to see how it will work.

Ok, I think I get it, but what about the current resource selector and Options group of Import filesystem wizard? Should they move to another page in case "Into Folder" is selected? So first page would be just selecting:
1. Source location
2. Whether to import into workspace as folder or as a project
?
Comment 15 Dani Megert CLA 2013-11-20 09:31:51 EST
(In reply to Mickael Istria from comment #14)
> Ok, I think I get it, but what about the current resource selector

You mean where one can select only parts of the directory? I would leave it as is, but would probably select the folder (and its children) by default (currently the user has to select stuff, which is a bit unfriendly).


> Options group of Import filesystem wizard? Should they move to another page
> in case "Into Folder" is selected? So first page would be just selecting:
> 1. Source location
> 2. Whether to import into workspace as folder or as a project

I would do this:

Into
( ) Workspace as new project
(*) Folder
  Options go here, disabled if 'Workspace' is selected
Comment 16 John Arthorne CLA 2013-11-20 09:33:06 EST
The funny thing is this workflow is possible today but just not intuitive. What I always do for this kind of case is invoke the New Project wizard and then select the existing directory as the location. After the project is created I can invoke Move to change the location on disk if I want. 

As a user I agree I would expect the same as Dani: That Import > File System would let me do this but it is missing the ability to connect the New Project workflow into that wizard. The CVS Checkout Out As... approach sounds good here.
Comment 17 Mickael Istria CLA 2013-11-20 09:53:49 EST
Ok, that sounds like what I started to work with on bug 37478. However, how should the wizard handle the case where the selected FileSystem location is already an Eclipse project?
Should it put in project name the name in .project and disable the text, and then import directly the project?

Also, another issue with the wizard as Daniel describes it is that it wouldn't allow to copy folder into workspace location. But I don't think it's a big issue.
Comment 18 Dani Megert CLA 2013-11-20 09:58:46 EST
(In reply to Mickael Istria from comment #17)
> However, how
> should the wizard handle the case where the selected FileSystem location is
> already an Eclipse project?
> Should it put in project name the name in .project and disable the text, and
> then import directly the project?

For me that seems like the most expected behavior. We could even travel up the hierarchy and check whether the selected directory is inside an Eclipse project. In such cases, one would probably also expect the same nature(s).
Comment 19 Mickael Istria CLA 2013-11-20 10:13:45 EST
File System import wizard improvements regarding import directory as project can be tracked in bug #37478. Let's keep this bug open to handle a better integration in IDE (drag'n'drop for example)
Comment 20 Dani Megert CLA 2013-11-20 10:16:11 EST
(In reply to Mickael Istria from comment #19)
> File System import wizard improvements regarding import directory as project
> can be tracked in bug #37478. Let's keep this bug open to handle a better
> integration in IDE (drag'n'drop for example)

+1.
Comment 21 Mickael Istria CLA 2014-06-23 12:42:18 EDT
Just so you know, around EclipseCon NA, I started to work on a draft of what I believe is a way more efficient mechanism for imports. It's available here: https://github.com/mickaelistria/jbosstools-eclipse/tree/master/plugins/org.jboss.tools.eclipse

It introduces a simple "File > Open Folder/Project" menu that will show up a DirectoryDialog. User can then select any folder on his filesystem. If folder is already an Eclipse project (contains a .project), it gets opened regularly as an existing project. If user selects a folder that isn't a project, then folder gets imported as a new project, and some "projectConfigurators" will be triggered to look for meaningful content in the project and configure it accordingly.
For example, if there is a pom.xml, project enable m2e nature; if there is a META-INF/MANIFEST.MF with a Bundle-SymbolicName entry, it will be made a PDE plugin project, if there are some Java files, it will enable JDT...

I've been using it on my IDE for some time, and it's something very pleasant to use.
If there is some early interest from other platform contributors to get it in Eclipse, I'd be glad to contribute it as part of Mars.
Comment 22 Mickael Istria CLA 2014-10-13 13:24:31 EDT
In https://github.com/mickaelistria/jbosstools-eclipse , I added support for drag'n'drop of directories in workspace root and working set. This import the given folder as a project and import assistance comes to help in configuring the project (add natures).
Comment 23 Mickael Istria CLA 2014-10-21 13:02:27 EDT
I believe an "Import directory as project in workspace" wizard is the best approach. Indeed, the current "Import Filesystem" wizard is really too complicated and covers too many use-cases, it does not fit such a simple use-case of opening a directory in workspace. It's also quite difficult to tweak it in order to support this use-case.
Before I work on providing such a wizard, I'd like that one of current Platform committers support the idea so there are more chances of having a patch merged for Luna.
Comment 24 Matthias Sohn CLA 2014-11-12 05:31:24 EST
I guess you are targeting Mars ?
Comment 25 Mickael Istria CLA 2014-11-12 05:46:30 EST
(In reply to Matthias Sohn from comment #24)
> I guess you are targeting Mars ?

Yes. I hope the import framework and extensions for PDE, JDT, m2e, WTP, JSDT, THyM would make it into Mars.
Comment 26 Mickael Istria CLA 2015-02-05 03:57:20 EST
This has been contributed to e4 ui for incubation.

*** This bug has been marked as a duplicate of bug 457308 ***