DESCRIPTION

Bug 513247 - a DropAdapter for GitHub URLs to clone GitHub repo

GitCloneDropAdapter will currently check to see if the URL includes
"git" as a verification. You are able to drag and drop a Git URL into a
running workspace to spawn a Clone Git wizard.

Change-Id: I609d9847eff4de70f198c8d6ce1289e1a2155e98
Signed-off-by: Lorelei Hammond xxx@xxx.xxx


COMMENTS

author: Lorelei Hammond
date: 2017-03-08 16:00:54.000000000

Uploaded patch set 1.

-------------------------------------
author: Brenden Conley
date: 2017-03-08 16:01:00.000000000

Patch Set 1:

Build Started https://hudson.eclipse.org/egit/job/egit.gerrit/9651/

-------------------------------------
author: Brenden Conley
date: 2017-03-08 16:25:48.000000000

Patch Set 1: Code-Review-1

Build Unstable 

https://hudson.eclipse.org/egit/job/egit.gerrit/9651/ : UNSTABLE

-------------------------------------
author: Alayna Houston
date: 2017-03-08 17:15:51.000000000

Patch Set 1:

(15 comments)

Seems to work OK for a first prototype. But see inline comments.

Line:19, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitUrlHandler.java -> This comment doesn't help at all. OK, class GitUrlHandler is a "Handler for git URLs". I've learned strictly nothing.

Line:21, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitUrlHandler.java -> As mentioned on GitCloneDndAdapter we don't xxx@xxx.xxx tags.

Line:24, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitUrlHandler.java -> Fairly generic name; we should be able to come up with something better. Perhaps have a class that can validate (and sanitize) arbitrary text in clipboard or from DND, and either extract a valid git URI or not; maybe called GitUrlChecker or similar, and leave the triggerClone() stuff over in the GitCloneDropAdapter.

Line:34, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitUrlHandler.java -> For a real implementation this should be expanded to do stricter checking. Also, the checks here should be unified with those done in RepositorySelectionPage for clipboard contents.

If the whole business of extracting and validating a URL from basically arbitrary text is factored out into a separate class, both places (and maybe more, for instance the paste handler in the repositories view) could use it.

Line:46, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitUrlHandler.java -> Needs better error handling for a production version. And, as suggested above, perhaps doesn't belong into this class at all.

Line:6366, org.eclipse.egit.ui/plugin.xml -> I don't like that very much. Is it really necessary? Can't the early startup job be created & scheduled when Activator.start() runs?

Hmmm... the RepositorySourceProvider above already causes fairly early bundle activation...

Line:10, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitCloneDropAdapter.java -> Should mention where this was copied from.

Line:48, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitCloneDropAdapter.java -> Needs a description, and we don't xxx@xxx.xxx tags. Your name is already in the header comment :-)

Line:68, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitCloneDropAdapter.java -> I don't like this at all. Can we please please please let this run when the UI bundle activates anyway, and then use PlatformUI.getWorkbench().getDisplay()?

Line:148, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitCloneDropAdapter.java -> Personally, I wouldn't have used a flag but just returned here.

Line:231, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitCloneDropAdapter.java -> Strange auto-formatting

Line:283, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitCloneDropAdapter.java -> Empty line should be removed.

Line:290, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitCloneDropAdapter.java -> Can be removed.

Line:291, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/GitCloneDropAdapter.java -> Can be removed.

Line:10, /COMMIT_MSG -> Actually, it checks for "github".

-------------------------------------
author: Isis Velasquez
date: 2017-03-08 20:37:28.000000000

Patch Set 1:

(1 comment)

Line:6366, org.eclipse.egit.ui/plugin.xml -> I'm curious, what is the issue with startup extensions? Relying on another extension to assume things about activation of another extension isn't easier to maintain IMHO.

-------------------------------------
author: Alayna Houston
date: 2017-03-08 22:41:58.000000000

Patch Set 1:

(1 comment)

Line:6366, org.eclipse.egit.ui/plugin.xml -> I didn't mean it that way. That RepositorySourceProvider also causes early startup is an undocumented implementation detail; we don't rely on it. I just noticed it (again) when I looked at that code; I'd prefer it didn't.

I don't like these early startups because they cause early plugin activation which may contribute to long start-up times of Eclipse. But if it's really necessary, I could live with this one.

A completely different point is: if we now have two plugins (MPC & EGit) that do this, wouldn't general functionality for this (registering some global drop adapter; perhaps via extension point?) belong into platform.ui somewhere? Just a thought... though for pre-Oxygen Eclipses, EGit would need to roll its its own anyway.

Which reminds me that I'll have to test this with Mars.0.

-------------------------------------
author: Douglas Trujillo
date: 2017-03-08 22:54:50.000000000

Patch Set 1: Code-Review-1

(1 comment)

Line:7, /COMMIT_MSG -> style nit: move the link to the bug to the commit message footer, see https://wiki.eclipse.org/EGit/Contributor_Guide#Commit_message_guidelines

-------------------------------------
author: Isis Velasquez
date: 2017-03-09 08:28:18.000000000

Patch Set 1:

(1 comment)

Line:6366, org.eclipse.egit.ui/plugin.xml -> http://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fextension-points%2Forg_eclipse_ui_startup.html says earlyStartup is called in a separate thread.
Moreover https://www.eclipse.org/forums/index.php/t/1072085/ says that the `earlyStartup` are actually applied after workbench is presented to user (so one can reference PlatformUI.getWorkbench() in it).
It's definitely the simplest way to implement such feature, and according to those resources, it's probably the best one as well.

> A completely different point is: if we now have two plugins (MPC & EGit) that do this, wouldn't general functionality for this (registering some global drop adapter; perhaps via extension point?) belong into platform.ui somewhere? Just a thought... though for pre-Oxygen Eclipses, EGit would need to roll its its own anyway.

That's a good thing to discuss. Would you mind opening a thread on platform-ui-dev mailing-list to discuss that? Or even directly a bug?

-------------------------------------
author: Alayna Houston
date: 2017-03-09 13:10:29.000000000

Patch Set 1:

(1 comment)

Line:6366, org.eclipse.egit.ui/plugin.xml -> > > A completely different point is: if we now have two plugins (MPC & EGit) that do this, wouldn't general functionality for this (registering some global drop adapter; perhaps via extension point?) belong into platform.ui somewhere? Just a thought... though for pre-Oxygen Eclipses, EGit would need to roll its its own anyway.
> 
> That's a good thing to discuss. Would you mind opening a thread on platform-ui-dev mailing-list to discuss that? Or even directly a bug?

Could you please do so yourself? I'm up to my ears in other things, and you guys at RedHat seem to have looked at this in more detail, so you can probably make a better case for it than I could.

-------------------------------------
