Bug 500388 - passing directory to launcher should open SmartImport wizard, or select existing project
Summary: passing directory to launcher should open SmartImport wizard, or select exist...
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.6   Edit
Hardware: All All
: P3 enhancement with 1 vote (vote)
Target Milestone: 4.12 M1   Edit
Assignee: Mickael Istria CLA
QA Contact:
URL:
Whiteboard:
Keywords: noteworthy, usability
Depends on:
Blocks: 500427 546929
  Show dependency tree
 
Reported: 2016-08-29 03:25 EDT by Mickael Istria CLA
Modified: 2019-05-30 04:19 EDT (History)
7 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 2016-08-29 03:25:35 EDT
the use case is the if some user tries `./eclipse /path/to/folder` in CLI, they get Eclipse IDE as ready as possible to work with the folder. That can be either by putting selection on this folder (if available as project or as folder under existing project) in the various navigator, or show the Smart Import wizard so user only has to apply to get started with their project in Eclipse IDE.
Comment 1 Mickael Istria CLA 2016-08-29 03:26:53 EDT
I'd like to target it for 4.7. I'll try to do it, but since I'm currently working on other topics and don't have time for it right now, I leave it unassigned so anyone interested can feel free to implement that.
Comment 2 Ian Pun CLA 2016-11-28 16:11:05 EST
Mickael, I have something implemented, but I haven't figured out a way to test it. Reason being, when I run a test child eclipse, I haven't found a way to add the path when running the eclipse application. There's no real other way for me to trigger this method (openFile() in DelayedEventsProcessor) without calling "./eclipse /some/path" as the "open file" menu option only allows actual file selections.

Is there some way you know how I can test my build of eclipse like this?
Comment 3 Mickael Istria CLA 2016-11-29 02:22:55 EST
I've never touched that part, so I'm not sure about my answer.
However, for the application part, it seems like you could try to send an "SWT.OpenDocument" event to the display once started, with the right parameters for the path, and to get it caught by DelayedEventsProcessor.
For the launcher part, I don't know how to properly test it. You should ask this on the mailing-list.
Comment 4 Mickael Istria CLA 2016-11-29 11:09:33 EST
To test, you can try the following to build an IDE locally with your change (success not guaranteed)
$ cd ~/git/eclipse.platform.ui
$ mvn clean install -Pbuild-individual
$ cd ~/git/eclipse.platform/platform/org.eclipse.sdk
$ mvn clean verify -Pbuild-individual-bundles
Then in the org.eclipse.sdk/target/products folder, you should get the IDE to try. Check it does contain the bundle you're expecting with the right timestamp, and try it.
Comment 5 Mickael Istria CLA 2016-11-29 11:10:10 EST
(In reply to Mickael Istria from comment #4)
> $ mvn clean install -Pbuild-individual

'-Pbuild-individual-bundles'
Comment 6 Greg Amerson CLA 2018-09-07 03:18:56 EDT
One additional item I would like to add for consideration and would be willing to help develop it as well. 

If no existing .project is found or if the smart-importers can't handle it, we should just generate a .project that is a basic general project so that this folder can be opened in Eclipse.   Combine this with the new Generic Text Editor and LSP4E and you have a very similar workflow that is available with editors like sublime and atom.
Comment 7 Mickael Istria CLA 2018-09-07 03:21:54 EDT
(In reply to Greg Amerson from comment #6)
> If no existing .project is found or if the smart-importers can't handle it,
> we should just generate a .project that is a basic general project so that
> this folder can be opened in Eclipse. 

It seems like it's what smart-importer is already doing. Try File > Open Project from Folder... to see it in action.
Comment 8 Greg Amerson CLA 2018-09-07 04:37:45 EDT
(In reply to Mickael Istria from comment #7)
> (In reply to Greg Amerson from comment #6)
> > If no existing .project is found or if the smart-importers can't handle it,
> > we should just generate a .project that is a basic general project so that
> > this folder can be opened in Eclipse. 
> 
> It seems like it's what smart-importer is already doing. Try File > Open
> Project from Folder... to see it in action.

Would the `eclipse /path/to/folder` always open a wizard?  Could it just "do what makes the most sense" automatically?
Comment 9 Mickael Istria CLA 2018-09-07 04:42:14 EDT
(In reply to Greg Amerson from comment #8)
> Would the `eclipse /path/to/folder` always open a wizard?  Could it just "do
> what makes the most sense" automatically?

The real issue with doing "what makes the most sense" is that for different projects and different users, there is not an obvious answer of what that means, so we cannot automate the resolution of this question at the moment ;)
I think we first need to include the change to open the wizard, start gathering feedback on it, and then we may be able to identify some obvious cases when we can skip the wizard. But it's IMO to early to consider this, first is to have `./eclipse /path/to/folder` doing something safe -like showing the wizard-.
Comment 10 Mickael Istria CLA 2019-03-07 16:50:58 EST
Tentative for 4.12.
Seems to be a matter of adding a bit of smartness to the DelayedEventProcessor so case of SWT.OpenUrl with URL being an existing local directly would open the SmartImportWizard with directory pre-set.
Comment 11 Mickael Istria CLA 2019-03-08 04:19:45 EST
A process to develop this feature (as typical Debug As > Eclipse application won't work here)
1. Start your usual "dev" IDE from a workspace that has the DelayedEventProcessor class accessible for work in workspace. It's best if the PDE Target Platform is the current running IDE, but other ones may work.
2. Start this same "target" IDE from CLI with the debug arguments: `./eclipse -vmargs -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1044 &` and chose whichever workspace that you can discard later
3. From dev IDE, start remote debug the target IDE, monitoring org.eclipse.ui.ide.application project and port 1044
4. From dev IDE, put a breakpoint on `DelayedEventProcessor.openFile(...)`
5. Then from CLI, try `./eclipse /path/to/dir` or `./eclipse .`.

Fortunately, the last started instance of the executable (which is the target IDE) seems to be chosen to receive the event, so the breakpoints hits the dev IDE and allows to follow and modify with hot-reload what's happening in the target IDE.
Comment 12 Eclipse Genie CLA 2019-03-08 04:50:54 EST
New Gerrit change created: https://git.eclipse.org/r/138366
Comment 14 Lakshmi P Shanmugam CLA 2019-05-30 04:07:30 EDT
The import wizard is not showing up for me on Mac (10.13.6). Has anyone tried this on Mac?
Comment 15 Lakshmi P Shanmugam CLA 2019-05-30 04:19:39 EDT
(In reply to Lakshmi Shanmugam from comment #14)
> The import wizard is not showing up for me on Mac (10.13.6). Has anyone
> tried this on Mac?

On Mac, this doesn't work with ./eclipse <folder name>. Works with open -a Eclipse.app <folder name>.