Bug 358152 - "Import Projects..." should appear in "Git Repositories" view's context menu for multiple projects
Summary: "Import Projects..." should appear in "Git Repositories" view's context menu ...
Status: RESOLVED FIXED
Alias: None
Product: EGit
Classification: Technology
Component: UI (show other bugs)
Version: 1.1   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 4.7   Edit
Assignee: Wim Jongman CLA
QA Contact:
URL: https://www.youtube.com/watch?v=aorw7...
Whiteboard:
Keywords:
Depends on: 510932
Blocks:
  Show dependency tree
 
Reported: 2011-09-19 14:30 EDT by Markus Keller CLA
Modified: 2017-02-12 03:37 EST (History)
6 users (show)

See Also:


Attachments
Context menu empty (100.80 KB, image/png)
2017-01-23 16:02 EST, Wim Jongman CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2011-09-19 14:30:57 EDT
Latest nightly

"Import Projects..." should appear in "Git Repositories" view's context menu if multiple projects are selected in the view (inside the "Working directory").

Both from the context menu and via File > Import, the initial selection should correspond to the projects selected in the view, if any.
Comment 1 Wim Jongman CLA 2017-01-23 16:02:34 EST
Created attachment 266421 [details]
Context menu empty

I want to fix this. Does EGit want to accept this contribution?
Comment 2 Andrey Loskutov CLA 2017-01-23 16:10:14 EST
Wim, your screenshot shows multiple folders from *same* repository, which is different case, but yes, this would be nice to have too, and please create a dedicated bug for that.
Comment 3 Wim Jongman CLA 2017-01-23 16:33:45 EST
I don't see where it mentions multiple _repositories_ in this bug report so I think this one is fine Andrey. Do you agree?
Comment 4 Andrey Loskutov CLA 2017-01-23 16:35:09 EST
Sure, I misread the title.
Comment 5 Matthias Sohn CLA 2017-01-23 16:41:34 EST
(In reply to Wim Jongman from comment #1)
> Created attachment 266421 [details]
> Context menu empty
> 
> I want to fix this. Does EGit want to accept this contribution?

+1
Comment 6 Wim Jongman CLA 2017-01-23 18:58:51 EST
Mickael, it seems that the SmartImportWizard is now the way forward for EGit. However, I see that it only accepts a single file (directory) or an archive file. I think we need to fix the wizard so that it can accept a bunch of directories in one form or another.

One option would be to supply a list in a text file and make a special archive case. What do you think?
Comment 7 Mickael Istria CLA 2017-01-24 00:59:34 EST
(In reply to Wim Jongman from comment #6)
> Mickael, it seems that the SmartImportWizard is now the way forward for
> EGit. However, I see that it only accepts a single file (directory) or an
> archive file. I think we need to fix the wizard so that it can accept a
> bunch of directories in one form or another.
> One option would be to supply a list in a text file and make a special
> archive case. What do you think?

Another solution, more consistent with the wizard IMO, would be to open the wizard on the Git repo root and pre-select in the directories section the directories that were selected by the user in the Git repo view.
Comment 8 Wim Jongman CLA 2017-01-24 05:25:30 EST
(In reply to Mickael Istria from comment #7)
> 
> Another solution, more consistent with the wizard IMO, would be to open the
> wizard on the Git repo root and pre-select in the directories section the
> directories that were selected by the user in the Git repo view.

In theory they might not come from the same directory.

I filed Bug 510932 for this.
Comment 9 Wim Jongman CLA 2017-01-25 18:19:45 EST
(In reply to Mickael Istria from comment #7)
> 
> Another solution, more consistent with the wizard IMO, would be to open the
> wizard on the Git repo root and pre-select in the directories section the
> directories that were selected by the user in the Git repo view.

That turned out to be the best approach. I implemented it in the standard git wizard:

/**
 * Add a list of regular expressions that may match projects that this
 * wizard can show. If no filter is set or if the filter is empty then
 * projects will not be hidden. If a non empty filter is set and no projects
 * match then the wizard will not show any projects.
 *
 * @param pFilter
 *            a list of regular expressions (or plain path names)
 */
public void setFilter(List<String> pFilter) {
	fFilter = pFilter;
}

/**
 * Gets the list of projects that filter in a subset of all eligible
 * projects. 
 *
 * @return an unmodifiable list of projects which could be empty but never
 *         null. 
 * @see #setFilter(List)
 */
public List<String> getFilter() {
	if (fFilter == null) {
		return Collections.emptyList();
	}
	return Collections.unmodifiableList(fFilter);
}
Comment 10 Wim Jongman CLA 2017-01-25 18:42:42 EST
video to show implementation in EGit default wizard.

https://www.youtube.com/watch?v=aorw7Xo4S0E
Comment 11 Wim Jongman CLA 2017-01-28 16:13:41 EST
Fixed.
Comment 13 Eclipse Genie CLA 2017-02-12 03:13:27 EST
New Gerrit change created: https://git.eclipse.org/r/90888
Comment 14 Andrey Loskutov CLA 2017-02-12 03:14:39 EST
(In reply to Eclipse Genie from comment #13)
> New Gerrit change created: https://git.eclipse.org/r/90888

(In reply to Matthias Sohn from comment #12)
> Gerrit change https://git.eclipse.org/r/#/c/89611/ was merged: Commit:
> http://git.eclipse.org/c/egit/egit.git/commit/
> ?id=76acd28a6f4d0f38a8a6f5a8c3c347155917ff26

This broke default "Git import wizard", which now fails to find ANY project in the file system, due:

java.lang.ClassCastException: org.eclipse.egit.ui.internal.clone.GitImportWizard cannot be cast to org.eclipse.egit.ui.internal.clone.GitCreateProjectViaWizardWizard
	at org.eclipse.egit.ui.internal.clone.GitProjectsImportPage$8.isSelected(GitProjectsImportPage.java:444)
	at org.eclipse.egit.ui.internal.clone.GitProjectsImportPage$8.run(GitProjectsImportPage.java:427)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:119)

I have a trivial patch.
Comment 15 Eclipse Genie CLA 2017-02-12 03:37:15 EST
Gerrit change https://git.eclipse.org/r/90888 was merged to [master].
Commit: http://git.eclipse.org/c/egit/egit.git/commit/?id=6f9a419139f018f8b1d3b3970cd9608ed40c71db