The Drupal Quickstart virtual machine ships with multiple code editors to edit project files such as PHP, CSS, HTML, and JS (JavaScript). The Eclipse IDE packaged with Quickstart requires some minor configuration to work a little more flawlessly with Git and Drupal projects nicely. Launch Quickstart and Eclipse then follow along.

Add Git support to Eclipse

Install the EGit plug-in through the Eclipse Marketplace. In Eclipse, choose the "Help" menu, then "Eclipse Marketplace". Search for "EGit" and install the plug-in. Eclipse will need to restart after installation.

Activate Git client support on a project

Open the Project Explorer View in Eclipse. Right-click the project name, and choose Team > Share Project. Pick Git as the service, and on the next screen do one of the following:
- If you already have tied a project to a Git repo then check the box that says "Use or create project in existing parent folder." This lets Eclipse know there is already a local .git folder within the project folder.
- If no Git connection was made outside of Eclipse then continue with the standard steps of the wizard.

Once Eclipse knows Git is used on the project the Team contextual menu options change to support commands and features suck as Branch, Add, Commit, Push, Pull, Fetch, Merge, Rebase, Tags, and so on.

Adding Quickstart sites to Eclipse

By default, the Quickstart workspace for Eclipse is the "websites" folder so when someone tries to add an existing site using the "New PHP Project" wizard and error the desired folder is already in the workspace. The solutions are somewhat simple but not apparent.

Option A: Use proper workspace name (a.k.a. stop choosing "existing folder")

The key to adding an existing Quickstart site in Eclipse is not to choose the project to have an existing source. Leave the selection to use the default workspace and type in the EXACT name of the Quickstart site or domain as the project name. If you get an empty project folder in Eclipse then you didn't type the site name properly. To add the example site that comes with Quickstart, add a "New PHP Project" and type "example.dev" as the project name. Click Finish.

NOTE: If you remove a project in Eclipse and choose to delete the files, Quickstart will retain the domain and database for that site. Instead, use Drush to remove a Quickstart site; it's a better option and strongly recommended.

Option B: Move or delete the default Workspace path

Click Window > Preferences, then choose General > Workspace > Startup & Shutdown. Choose the Quickstart default workspace that points to the "websites" folder, and choose "Remove", then "Apply", then "Ok". You can choose to add or change the path here or just restart Eclipse and let it ask you where you want the new default workspace folder to be - make sure it's not the "websites" folder. Tell Eclipse to stop bugging you and get back to work.

Comments

royepperson’s picture

I'm trying to install EGit into Helios Release 2 and get the following error message:

Cannot complete the install because one or more required items could not be found.
Software being installed: Eclipse EGit 2.2.0.201212191850-r (org.eclipse.egit.feature.group 2.2.0.201212191850-r)
Missing requirement: Git Team Provider UI 2.2.0.201212191850-r (org.eclipse.egit.ui 2.2.0.201212191850-r) requires 'bundle org.eclipse.core.runtime [3.7.0,4.0.0)' but it could not be found
Cannot satisfy dependency:
From: Eclipse EGit 2.2.0.201212191850-r (org.eclipse.egit.feature.group 2.2.0.201212191850-r)
To: org.eclipse.egit.ui [2.2.0.201212191850-r]

I'm searching the Eclipse forums for a solution but not finding one. I've run the Eclipse update and it is current

drangon’s picture

Did u find the solution ? . I am facing the same problem.
Please write up the solution if you find out.

Thanks

speculees’s picture

i dunno, works great on Eclipse Juno :/ ...try switching to that for test