How to Succesfully Incorporate Eclipse IDE into a Drupal Workflow

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
mpare's picture

I have successfully set up Eclipse IDE with the the Eclipse Web Tools Platform (WTP) and PHPeclipse. I have also followed the guides at http://dev.civicactions.net and the guide aimed at how to Configure Eclipse to use Drupal Coding Standards. Everything is running fine and I am using the new environment on my current project. But now what do I do?

I know that I can find a way to incorporate this into my workflow, but instead of using my trial and error method I would like someone with experience to show a successful proven method of implementation. I am not so much concerned with platform specific (os's) examples but I would be interested in how to incorporate Eclipse into my current workflow. Things such as incorporation with your current local host drupal sandbox, live site, and "private" team development for things like virtual companies would be absolutely wonderful. I have already set up Eclipse IDE to access Drupal CVS, but it is my understanding that there are some problems. Possible work arounds to these problems would be a plus. I am more than willing to create documentation of any lessons or instructions provided that provide a successful workflow so that others can benefit as well.

Comments

victorkane's picture

I have used Eclipse extensively with other projects, just for CVS or SVN integration it's great. And with Web Tools (editing, autocompletion, reference look up, error signalling, pretty pring formatting, great support for HTML, CSS, XML apart from PHP...) it's great; and free, of course. Haven't used it with Drupal, yet, though. But, fortunately, we are not alone, others have walked that road before, the IBM trio, here is the long list of articles:

http://www-128.ibm.com/developerworks/ibm/osource/implement.html

Specifically, these:

Part 3 (Windows): http://www.ibm.com/developerworks/edu/i-dw-i-osource3.html?S_TACT=105AGX...
Part 4 (Linux): http://www-128.ibm.com/developerworks/edu/i-dw-i-osource4.html?S_TACT=10...

speak about getting your environment up to speed with the Eclipse IDE, Apache, PHP5, MySQL 5, and of course, Drupal. How to create, for example, a virtual host alias thing so you can edit and have version control and debug in the browser all on the same code directory.

Victor Kane
http://awebfactory.com.ar

Those Are Good

mpare's picture

Yes, those are very good articles. I guess I should have listed those in my above post. I have read them and they do provide a basic setup but I feel like eclipse holds the potential for so much more than what is explained in those very brief setups. I will continue my quest for a great workflow with Eclipse and report back. Keep the links coming. I am going to continue with the trial and error and hopefully be able to assemble some text for others.

Peace,

Matthew Pare

Pare Technologies
info at paretech dot com

www.paretech.com

Peace,

-mpare

Pare Technologies
Drupal Consulting, Themeing, and Module Development
806.781.8324 | 806.733.3025
www.paretech.com

Figure Something Out? Document Your Success!

Very good idea

victorkane's picture

Yes, you must stick to your idea.
There's no road like the road itself!!!

We are currently assessing, on one project, the Zend IDE vs. this Eclipse setup, so will report back on that if you would like to hear our experiences.

Victor Kane
http://awebfactory.com.ar

No Fancy IDE - Just Plain Vanilla Xdebug with Lampp

momo18's picture

I'm using lampp with Ubuntu to develop Drupal applications on my localhost. Thankfully the only two lampp commands I've ever needed to use are lampp stop, and lampp start - and I don't want to change that.

I need to setup a debugger in order to follow a Drupal application on localhost. I have a standard plain vanila install of Ubuntu and of XAMPP, and I DON'T need any powerful IDE. I just want to set breakpoints and display the contents of variables. (I have setup eclipse - galileo but I found it buggy, a hassle to learn, and more than what I really need at this stage).

(PS: Perhaps there should be an interim stage - before installing a full blown IDE, because from what I have seen (read so far) quite a few people are having difficulty with it).

Nowhere can I find a simple and clear set of instructions on how to setup and install a debugger (xdebug - for arguments sake) on Ubuntu, running alongside Xampp straight out of the box. The IBM instructions I followed (see below) explained how to setup up everything from scratch, and again that's more than what most people probably need.

Surely this is a very common usage scenario that a huge volume of people would love to have, and I believe it SHOULD'NT require more than 10 simple steps to setup and start debugging away, as well as follow program flow, etc.!

I can't figure out why this option is not available? If someone knows the way, could they PLEASE possibly present the steps?

Bye the way, I have used gdb (debugger) in the past, where you can connect to an application using the process ID from the command line of an Xterm terminal window (without any requirements for an IDE). Could anyone make any suggestions?

Thanks!

Technical Writing Services
http://www.itwrite.com

I'm using eclipse Helios PDT

Sylvain Lecoy's picture

I'm using eclipse Helios PDT with Zend Server and their debugger extension, plus a Drupal plugin written by myself, and I have no troubles.

Where do you find buggy the debugger ? I may help if you need.

Another Great Article I'm Sure

mpare's picture

Thanks Mikey, I didn't know that they had already released Article 13. I will read over this but a brief skim looks like this is the answer to my calling. I still intend to culminate all these articles together to help others. Sometimes all these links, formats and voices can get in the way of what one is trying to accomplish.

Peace,

Matthew Pare

Pare Technologies
info at paretech dot com

www.paretech.com

Peace,

-mpare

Pare Technologies
Drupal Consulting, Themeing, and Module Development
806.781.8324 | 806.733.3025
www.paretech.com

Figure Something Out? Document Your Success!

WOA! Those guys are great...

victorkane's picture

That's incredible, and right bang on topic they are!!! :)
In any case, don't forget to see the discussion in the other articles (after 3 and 4) on how they write their drupal module in the Eclipse environment.

But, when we are trying to fit together stuff for those who come later, the best is the right place to start, so I think these 13 articles should be cited for a long time to come!

Victor Kane
http://awebfactory.com.ar

Lullabot Podcast on Development Tools

mpare's picture

Here is a link to the Lullabot podcast talking about several Apps that make developing easier. They talk a lot about Eclipse IDE and how it stands up to other applications available. Also there is a decent mention to Drupal-Dojo.

Peace,

Matthew Pare

Pare Technologies
info at paretech dot com

www.paretech.com

Peace,

-mpare

Pare Technologies
Drupal Consulting, Themeing, and Module Development
806.781.8324 | 806.733.3025
www.paretech.com

Figure Something Out? Document Your Success!

Eclipse PDT vs phpEclipse

starbow's picture

I recently moved from phpEclipse to Eclipse PDT, so I could use XDebug. I wrote about it here:

http://www.starbowconsulting.com/blog/tao/setting-eclipse-pdt-and-xdebug

Overall, PDT isn't quite as good (it just at 0.7 RC2), but it's worth it for the ease of debugging.

Eclipse in the Handbook

alpritt's picture

Yes, kudos to all the cited articles. But, we really need to get this stuff in the handbooks.

I've made a start on drafting up my notes into an installation guide (it took me at least 2 days solid work trying to get everything running fine, so I bet other people have the same difficulty). If we then also add details about using the software specifically for Drupal development, I think we can save a lot of people a lot of time. Even by introducing them to another form of debugging other than print_r().

One of the difficulties is that there are different plug-ins for Eclipse as well as different platforms that it runs on. I'm using the Zend plugin, for example, rather than PHPeclipse. I think a setup guide should reflect these different choices and clearly show the differences to aid making a choice.

I'm also thinking that there should be a parent page in the handbook listing other alternatives as well as pointing out some of the best software for use with programming Drupal. Introduce people to Firebug, for example.

Has anyone made any progress with documentation already? Is there an issue in the documentation queue? If not I'll make a start on this, and then hopefully others can build from there.

Best,

Alan

-
www.alanpritt.com

I would appreciate this

magdelaine's picture

being added to the Handbook. CVS and how to implement it seems quite arcane to me.

learn one, teach one, do one

yes indeed - a few resources exist

greggles's picture

In response to both alpritt and magedlaine:

Don't forget that there are many existing resources on these:

If/when you find problems with those, edit them (or add a comment with your proposed edits).

Yay for better docs!

--
Knaddisons Denver Life | mmm Free Range Burritos

Yep,

alpritt's picture

I had discovered them already. I've not delved into Eclipse CVS yet, so I don't know about those four pages. I ran through the coding standards page, and that seems fine.

Issue created

alpritt's picture

I've amended an existing related issue for this. It's in regards to creating a new handbook chapter about setting up a development environment for Drupal. The Eclipse section will be part of this wider chapter. I'm going to start by creating a first draft and then hopefully people will help add to it as there will be lots of gaps to fill. Issue is here... http://drupal.org/node/118977

Alan

Discrete Module Development/Debugging in EclipsePDT

not.used.906's picture

I appreciate all the good comments and information above and realize that it has been quite a while since any activity has occurred here, but I'll give it a shot.

Let me provide a description of what I am used to and see if anyone has a solution or suggestion.

I come from another open source project on the Microsoft .NET Framework platform. In Visual Studio .Net I would create a solution, similar to a workspace in Eclipse. In the solution I would add the core application framework project as a project. In this case that would be a project just for the Drupal standard core application files.

Then for each module I was developing for, I would create individual projects. One for each module that development was going to take place. The location of these projects was in the correct module directory of the core application. In this case /drupal/sites/all/modules/.

Drupal Project
/drupal/

CustomModule1
/drupal/sites/all/modules/custommodule1/

Then I would create a reference in the Custom Module 1 project definition to the core application framework library. (/drupal) This way the module project has access to all the classes, functions, constants, etc... form the core application framework.

I think I have a way to make this work in Eclipse. What I am still missing is how to get a debug launch in the customModule1 project to execute the index.php of the core application framework (/drupal).

By using this type of setup I can keep each module under it's own version control and packaging solution as needed.

Any thoughts are greatly appreciated.

Blessings...

Bump... anyone have resources for this?

spyderboy's picture

Brand new to Eclipse PDT, and already I can see great potential. I want to use this to fix an old buggy D5 install I have inherited. I'm having trouble pinpointing the troublesome modules with Eclipse though. I can step through Drupal, starting with index.php, but even if that eventually took me through my buggy modules code, it seems like there MUST be a better way.

Been searching on Google for tutorials on Module creation and debugging with Eclipse, but no luck. Help?

Pain in life is necessary. Suffering is optional.

Good question

redben's picture

Uptill now i have been doing the all-in-one project approach it's a bit confusing so i think i'll begin to separate core - contrib and dev each in there own. Idealy, an "drupal plugin for eclipse" would offer a mean to reference dependencies on drupal core and contrib as libraries (like dlls or jars)

Instant FTP support?

chrisshattuck_test's picture

I like a lot about Eclipse, but one thing I really need is the ability to upload files instantly to the right place via FTP. Dreamweaver and PhpEd do this, but Komodo and Eclipse don't seem to have that feature (and they seem to be the most popular around here). I'm just curious if maybe I'm missing something, or if there's another workflow that people use to manage their sites.

I typically have a local site on which I test, and then a remote site I upload to when the changes are ready. The instant FTP uploading is a huge time and sanity saver, and it means I don't have to fish around on the remote server each time I need something.

Any suggestions?

Thanks!
Chris

try looking for "deployment"

rolfkleef's picture

hi Chris, I thought I had something that allowed me to specify a "publish to server" property for a project in the past - but can't find it anymore... I'm only using CVS and SVN these days

But maybe check http://eclipse-plugins.info/eclipse/plugins.jsp?category=Deployment (eg: Eclipse DeployerFTP). Alternatively, the Zend Studio for Eclipse comes with the remote system explorer of the "target management" project (http://www.eclipse.org/dsdp/tm/tutorial/), and some people have built Ant files to upload projects via ftp as part of the build process.

HTH - rolf

FTP extension

Chris Charlton's picture

Eclipse does have a plug-in for FTP support, and Aptana, as mentioned, has FTP support as well.

Chris Charlton, Author & Drupal Community Leader, Enterprise Level Consultant

I teach you how to build Drupal Themes http://tinyurl.com/theme-drupal and provide add-on software at http://xtnd.us

Best FTP plugin I've found

ussher's picture

Best FTP plugin I've found for eclipse is this one jcraft FTP and WebDav. Add this url to your install repositories http://eclipse.jcraft.com/

Then you can use the synchronize panel to synchronize working sets to the server. Works both ways so you can tell if anything has changed.

Has anybody tried the Aptana

chrisroditis's picture

Has anybody tried the Aptana IDE? It is Eclipse based and supports php, javascript, html,css and it can synchronize files between local and ftp locations.
OpenMusic, a network of Drupal based music social communities

A healthy disregard for the impossible.

I find it is far to slow. I

tjholowaychuk's picture

I find it is far to slow. I prefer PhpED in alot of ways, I do of course like the whole open source idea of the IDE(s) but still just way to slow for me.

vision media
350designs
Print Huge Edmonton Printing Services
Design Inspiration Gallery

I found this article

clemens.tolboom's picture

@stompeer

I found this article www.eclipse.org/projects/slides/DSDP-TM_Europa_Review.pdf about target management.

This tool provides ssh, ftp, ...

Add http://download.eclipse.org/dsdp/tm/updates/2.0/

It is a big download ... it needs cdt which i got through 'europe discovery site'

It seems a huge install.

I only tested the ssh connection. Looks great.

Vendor branch concept

ineation's picture

I am actually trying ot set-up a dev. environment base on Eclipse and PDT.

I am trying to implement the Vendor Branch concept to be able to update core and contrib easily while having version control for my own website projects. The problem is that I have difficulties implementing the process in Eclipse.

I would like to share my thinkings with you in order to have feedback and suggestion.

Software used : Eclipse ide with included CVS support, PDT plugin (Php), Subversive plugin (SVN).
I have created a svn repo on a server to host my projects.

I have read many things about the vendor branch process, and it seems to be the right way to work with 3rd party module such as Drupal and any other contrib modules. In theory it enables to update easily the core and the modules

SVN repository structure :

Project X :
- Trunk
- Branch
- Tag

Vendor :
- Drupal
- Contrib :
- Module 1
- Module 2

The process :

I checkout (CVS) the last version of Drupal.
I checkout (CVS) each module.
I copy them in the svn repo (initial SVN comit) :
Drupal goes in Vendor / Drupal
Modules goes in vendor / contrib / X
I tag Drupal and each module 1-0
Then I have to copy Drupal to the trunk and the module in sites/all (how can I do that in Eclipse?)
I checkout the trunk to my eclipse workspace.

There I have a working copy of drupal in Eclipse and i can do all modification i want.

Then imagine there is a new Drupal version :

I check out (CVS) the new Drupal Version.
I import it (SVN) into my repo in Vendor/drupal and tag it 1-1

and then : "I don't know" ! What should i do to merge Drupal1-1 with my trunk in Eclipse ?

Thanks for yout help and suggestions, especially on the way to do that inside Eclipse...

Alex
www.ineation.com

question

Pasqualle's picture

Do you hack core or any conrib module?

I may have to hack core (of

ineation's picture

I may have to hack core (of course if no other way is possible), and contrib module.
This is why the "vendor branch" process (see : http://svnbook.red-bean.com/en/1.1/ch07s05.html) seems a great way to handle that.

Alex
www.ineation.com

Correction for the end of

ineation's picture

Correction for the end of the process.

It would be :

SVN repository structure :

Project X :
- Trunk
- Branch
- Tag

Vendor :
- Drupal
- Current
- Contrib :
- Module 1
- Module 2

The process :

I checkout (CVS) the last version of Drupal.
I checkout (CVS) each module.
I copy them in the svn repo (initial SVN comit) :
Drupal goes in Vendor / Drupal / Current
Modules goes in vendor / contrib / X / Current
I tag Drupal and each module 1-0
Then I have to copy Drupal to the trunk and the module in sites/all (team/copy)
I checkout the trunk to my eclipse workspace.

There I have a working copy of drupal in Eclipse and i can do all modification i want.

Then imagine there is a new Drupal version :

I check out (CVS) the new Drupal Version.
I check out (SVN) the current version of drupal from the vendor/current directory
On this working copy, I overwrite all the files with the new release.
I handle fille addition or deletion.
I commit the modified working copy to Vendor/drupal/current
I tag the new version as 1-1

Then on the working version, I merge change between 1-0 and 1-1 (--> how to do that in Eclipse ?)

Edit : answer to the question : simply by doing Team/merge and selecting the right tags

Alex
www.ineation.com

CVS files

j0hn-smith's picture

How do you get rid of the CVS files (CVS/Entries.Log etc) before you do the initial SVN commit?

Or do you check them in to SVN? If so how do you prevent them ending up in your production site?

Thanks

On unix/linux (prbly mac)

phoolish's picture

On unix/linux (prbly mac) command line. Within the base cvs checkout.
find . -type d -name 'CVS' -exec rm -rf {} \;
Another option is to tell svn to ignore CVS on a global level. Can't remember the config file location, but I am sure a quick search in your favorite search engine can help with that.

Thanks, I worked out a

j0hn-smith's picture

Thanks, I worked out a similar solution

rm -rf find . -name 'CVS'

-type d is a useful addition though.

I'm new to SVN and hadn't though of getting it to ignore CVS folders.

Please don't ignore CVS folders

Senpai's picture

Ok, so now you've committed your site to the prod server, and it doesn't have any CVS folders in it. Now you hire me to upgrade your site to the next version of Drupal, and I perform a checkout of your code only to find that I cannot update the core code via CVS as I'd hoped I could.

There's nothing wrong with having CVS folders on your servers. Those of you that see this as a hindrance probably also organize the forks in your drawers according to the level of tarnish on the silver. Don't you? ;)
______
Senpai


Joel Farris | my 'certified to rock' score
Transparatech
http://transparatech.com
619.717.2805

I do a similar thing and

mrfelton's picture

I do a similar thing and wrote about it here a while back. This system has been working very well for me. Upgrading modules and pushing out changes to Staging and Live environment is a doddle. Combine it with dbscripts and your away.

--
Tom
www.systemseed.com - drupal development. drupal training. drupal support.

Eclipse PDT templates

AltaVida's picture

I've been using PDT for a while now. I've tried Komodo, PHPEclipse and Zend IDE.

PDT had been frustrating me for a long while but now that the 2.x version is somewhat stable, I'm really starting to enjoy it.

Anyways, I've built up a massive collection of Drupal (6) code templates, including all hooks and forms array elements.

One great thing is that each hook template has a general description and includes the phpdoc @link to the relevent api.drupal.org page. It's great when you're coding and need to quickly refresh yourself on the ins and outs of a certain hook... with a simple ctrl-click you can get all the info you need.

For those who haven't used PDT templates you simply start typing (for example) hook_f and press code assist and you'll see a list of all hooks that start with hook_f*. Select the one you want (say hook_form_alter) and "fill in the blanks".

<?php
/**
* Implements hook_form_alter. Perform alterations before a form is rendered.
*
* @link http://api.drupal.org/api/function/hook_form_alter/6
*/
function hook_form_alter(&$form, $form_state, $form_id) {
 
//     ^^^^                  
  // PDT steps you through the template letting you specify your module name here.
}
?>

In this example PDT will let you replace 'element_name','title',default_value and 'element_description'.

<?php
$form
['element_name'] = array(
 
'#type' => 'textfield',
 
'#title' => t('title'),
 
'#default_value' => default_value,
 
'#description' => t('element_description.'),
);
?>

Anyhow, if there is sufficient interest I'd be happy to package the templates up and put available them for download on my site.

Excellent, indeed Eclipse

ineation's picture

Excellent, indeed Eclipse seems to have lot's of productivity tools (once you've mastered the basics). It would be cool to have a bunch of dedicated Drupal plugins, tools or snippet for Eclipse...

And of course, I would be interested in having a look at yout templates...

Alex
www.ineation.com

compile templates together

Chris Charlton's picture

I have a bunch as well, maybe instead of me trying to create a JAR of them, we should just compile them and distribute the XML file people can import as a temporary way to share code templates.

I have hooks, node module scaffolding, form API, and my latest were to be Actions. AltaVida, would you like to get these compiled together for us and the Drupal world?

Chris Charlton, Author & Drupal Community Leader, Enterprise Level Consultant

I teach you how to build Drupal Themes http://tinyurl.com/theme-drupal and provide add-on software at http://xtnd.us

Good idea. Why not create a

ineation's picture

Good idea.
Why not create a group specific to eclipse so that we can put all related material available for others?

Alex
www.ineation.com

It's a year later, so I don't

starbow's picture

It's a year later, so I don't know what the odds of getting a reply are, but I would love to get an export of your templates!

there is a link lower down in

ussher's picture

there is a link lower down in this thread to the templates. (which are excellent)
here it is again:
http://drupalcode.org/viewvc/drupal/contributions/sandbox/deekayen/eclip...

Thanks ussher, I missed the

starbow's picture

Thanks ussher, I missed the link when I was looking through the thread.

I have some other templates for Eclipse

Chris Charlton's picture

I have other templates for Eclipse that I've used since 2008. I am in the process of compiling templates into this Drupal Eclipse plug-in. I'd like to get permission to add the other templates mentioned in this thread.

Chris Charlton, Author & Drupal Community Leader, Enterprise Level Consultant

I teach you how to build Drupal Themes http://tinyurl.com/theme-drupal and provide add-on software at http://xtnd.us

GPL

deekayen's picture

Commits to the Drupal repository are bound by GPL v2. The permissions you have are limited to just that.

Sorry for the delay

AltaVida's picture

I can get those XML files posted soon, the only question is - should we start a new group for it?

If we do I would suggest making the group for any "Eclipse-based" PHP IDE's instead of any particular flavour (Like PDT). Most techniques, templates and such should be usable in any PHP IDE based on Eclipse for the most part.

Chris: I didn't know you could distribute code templates as JAR files, I've been simply using the import/export XML feature. I'm not really sure what the implications are of distributing as a JAR package (for example, can you edit/delete/export individual templates when the are part of a JAR package?).

Mark

On a side note..

AltaVida's picture

On a side note, I'm mostly new to Drupal Groups. Is there a way to disable the flashing read "Loading" message as the preview is updated?

For the love of earth, who in their right mind thought that would be good? What a terrible, terrible idea.

I am new to using Eclipse

joemoraca's picture

I think it is a good idea to create a new group to centralize the discussion for this topic.

Joe Moraca
http://www.moraca.org

Joe Moraca
WebDevGeeks.com

Agreed!

burningdog's picture

Start that group - I'm in!

Has anything been done on this?

phoolish's picture

I have been using templates in PDT for a year now (unstable as heck, but worth the fiddling... 2 seems very nice!), I have created my own templates for 4.7 and some 5 hooks and they work great for developing clients custom modules in a jiffy, but I have just started 6 and thought I might save some time by searching the interweb. Has the eclipse group been started and/or has anyone created templates for 6?

basic template

phoolish's picture

Had some free time this afternoon, so I created some basic Drupal 6 PDT templates. There is still a lot of work to be done, but a lot of basic hooks and module install/info. Take a gander and edit as necessary. Remove the txt extension before importing it.

B/w I am using Eclipse 3.4 with PDT 2.1, not sure how this effects template import files.

Thanks a lot, looks awesome

zeropaper's picture

I just import your template file and it seems to work really well.

Fully implemented

deekayen's picture

I modeled from your file, expanded to the entire list of hooks for Drupal 6, and uploaded it to my sandbox. The whole list took about 4 hours. It's for Eclipse 3.5 and PDT 2.1.

http://cvs.drupal.org/viewvc.py/drupal/contributions/sandbox/deekayen/ec...

I'm in too!!!

kehan's picture

I'm in too!!!

Got it!

davea's picture

Thanks for the great start on this!

+1 for getting a group

mrfelton's picture

+1 for getting a group together, and thanks for the templates!

Tom - www.kirkdesigns.co.uk

--
Tom
www.systemseed.com - drupal development. drupal training. drupal support.

As a Drupal dev and frequent

keesje76's picture

As a Drupal dev and frequent Eclipse user I'm in too.


Dekbedovertrek webshop

Subscribing to an Eclipse PDT with Drupal Group

momo18's picture

I'm also subscribing to an Eclipse PDT with Drupal group, but where is it?

We also need it to separate it from all the other options, because it's getting confusing otherwise.

Technical Writing Services
http://www.itwrite.com

hi. i downloaded eclipse

psi-borg's picture

hi. i downloaded eclipse with pdt and i have a few questions:
1. does it matter where workspace is stored (will it cause problems if its within the eclipse folder)?
2. how do you import the template file above? file->import dialog shows no import source labeled "template"
3. is there a way to have cvs automatically checkout drupal files whenever they've been updated, such that i can see which changes have been made and merge them with any changes i've made?
i'm trying to learn to develop drupal the right way... thanks for your help.

It doesn't matter. Windows

phoolish's picture
  1. It doesn't matter.
  2. Windows > Preferences > PHP Templates. You should see an import button. If you plan to use my template above, please remove the .txt before trying to import it.
  3. You can't get CVS to do it automatically, but you can be updated when there are new releases... you'll have to read through the cvs eclipse documentation for that.

To develop for drupal requires learning PHP and the API. Look at how others have developed their modules and take a look at the include folder for core info. Eclipse is just a great oven to bake in, it won't teach you Drupal =)...

Pref > PHP > Editor > Templates for my eclipse install

aenw's picture

FYI: With my install, I found the import button under Windows > Preferences > PHP > Editor > Templates
I'm using Eclipse version 3.5.1, PDT v.2.1.1 , and Aptana PHP Support v.1.1.0

Thanks for the info bubbasan and thanks for the templates to you and deekayen!

Fix to XML for Aptana

Mike_Waters's picture

Hi,

I tried to use deekayen's template (from cvs; it was the most recent); in order to get the template to load in Aptana (an awesome eclipse variant), you need to replace all instances of context="php" with context="php_code" in the template xml. I have no idea why, the only google result is in russian. But it works.

I can see the file

ussher's picture

I can see the file at
http://cvs.drupal.org/viewvc/drupal/contributions/sandbox/deekayen/eclip...

but how do i download it? surely i don't have to set up CVS just to get one file?

tried just copy + paste, but all the indentation gets lost.

--edit--
sorry. found it. turns out its built into eclipse, just need to create a new project to house the downloaded file. step-by-step here:
http://drupal.org/node/37615

Web interface got updated

deekayen's picture

Looks like someone upgraded viewvc and now it doesn't have a download option that just gives you the file contents without all the markup.

I guess you'd have to do something like this at the command line, though Eclipse should work as well, or tortoisecvs, or (other cvs gui here).

cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout -d eclipse contributions/sandbox/deekayen/eclipse/

Save link as...

ezeedub's picture

To download, just right-click the Download link and Save link as (or words to that effect).

Thanks for the templates, they're fantastic!

PDT 2.1 SR-1, Mac | Can't install Template

R-H's picture

In my install PDT 2.1 SR-1, Mac I see the import button under

Preferences > PHP > Code Style > Code Templates

I click the Import button and select the file "Eclipse_PDT_Drupal_6_hook_templates.xml"

and then nothing happens.

I downloaded the file here:

http://drupalcode.org/viewvc/drupal/contributions/sandbox/deekayen/eclip...

Any ideas?

your system hangs or just nothing is ever read in?

aenw's picture

when you say "nothing happens" do you mean that Eclipse hangs (becomes unresponsive) or that nothing seems to be read in?
If nothing seems to be read in when you try to import that file, then see what happens when you do a simple test. Make a copy of that .xml file, and edit it so that there is only one template in there (e.g. just one ... item).
See if you can import that simple files successfully and then let us know how that goes.

If Ecplise becomes totally unresponsive... then I'm not sure. Perhaps you have a bad install.

Nothing read in

R-H's picture

Nothing seems to be read into Eclipse.

I did your test and imported this:

<?xml version="1.0" encoding="UTF-8"?>
/**
* Implementation of hook_access().
*
* @param $$op Operation to be performed.
* @param $$node The node on which the operation is to be performed, or, if it does not yet exist, the type of node to be created.
* @param $$account A user object representing the user for whom the operation is to be performed.
* @return TRUE if the operation is to be allowed; FALSE if the operation is to be denied; NULL to not override the settings in the node_access table, or access control modules.
*/
function ${module_name}_access($$op, $$node, $$account) {

switch ($$op) {
case "create" :
return;
case "delete" :
return;
case "update" :
return;
case "view" :
return;
}
}

I click the import button, locate the file, but nothing appears. By default there are 2 categories of code templates in Eclipse: Comments and Code. I'm assuming this xml file would create something called hook_access under Code. Right?

Not sure why it isn't importing.

BTW: why can't I attach images to this thread? Would be nice.

Found the problem, not the solution

R-H's picture

I exported a working template and compared this. If the ID attribute is attached to the tag it imports fine.

I was only able to get it to work with if the value of the ID attribute was the same as the test template I used. If I try a different value for the ID then it doesn't work.

Here's the working tag:

Here's the original tag from the xml document I downloaded:

Nothing to see

deekayen's picture

The tags didn't show up for me to see what's wrong with what is in my sandbox. Wrap them in <code> tags?

The missing tags

R-H's picture

Sorry, that's strange.

Here's the code template that works. The key here is the id attribute.

<?xml version="1.0" encoding="UTF-8" standalone="no"?><templates><template autoinsert="false" context="php" deleted="false" description="print an expression" enabled="true" id="org.eclipse.php.ui.editor.templates.php.print" name="pr">print ${};
${cursor}</template></templates>

Wrong Location to Insert Template

axiom3279's picture

The templates that require the id are in the code style section go to the editor drop down under preferences, click on Templates, Import.

@axiom - You're a genius!

brycesenz's picture

@axiom - You're a genius! Thank you!

I was facing the same issue with the code templates not importing (though I'm running Windows), and I was stuck on this for days. For anyone who couldn't follow the solution, here's where I got stuck:

I was going to Preferences->PHP->Code Style->Code Templates to try to import these code templates. Fail. Where I needed to go to import the Code Templates is Preferences->PHP->Editor->Templates.

I don't know why Eclipse makes that so confusing...

PDT 2.1 SR-1, Mac | Pref Config

R-H's picture

I'm told on the Configuring Eclipse Drupal Handbook page that I need to configure

• Text File Encode for "Other" to "UTF-8"
• New Text File Line Delimiter for "Other" to "Unix"

Where the heck is that setting. The Handbook says it's at:

General -> Editors -> Text Editors

I don' see it there.

Thx

Ok

R-H's picture

It's under General > Workspace. Would be great to update that article in the handbook.

problem with that handbook page

aenw's picture

There's some weird problem with that page of the handbook: Not everyone is able to edit the page. For example, I do not see an "Edit" tab for that page. I was able to get around this by emailing someone on the documentation team; I wrote the changes, then she posted them and updated the page.
Otherwise, of course, someone could have just changed the page with this improvement.
NyRy -- if, like me, you don't see an "edit" tab, then perhaps you can go to the Revisions page and email someone that has been able to change the page. You can ask them to make the change for you.

Seems that we also need to file a bug report so that someone can take a look at why that particular page cannot be editted by everyone. I'll do that shortly.

Thanks

R-H's picture

You're right aenw, I didn't see the edit page. In the future I will look for someone who can edit it.

Thanks for your help.

Zend 7.2

craigmc's picture

FYI downloaded the XML file from: http://drupalcode.org/viewvc/drupal/contributions/sandbox/deekayen/eclip...

Import under PHP->Editor->Templates

Using Zend 7.2 on Mac OS X 10.6.3

Los Angeles, CA

Eclipse PDT, xDebug and Drupal .tpl.php files

momo18's picture

I am an Eclipse PDT newbie, so apologies if my questions are basic.

THE ENVIRONMENT

I have set up Eclipse PDT 2.1.3 with xDebug and I am trying to debug a Drupal application with LAMPP on Ubuntu via my localhost. I have installed the Drupal Plugin for Eclipse.

I have set breakpoints in page-front.tpl.php and page.tpl.php and the debugger stops as expected.

THE PROBLEM

However, I have set a breakpoint in a node-product.tpl.php file (derived from node.tpl.php) but when I click Run > Resume and I navigate to the correct page in the browser window, the debugger just refuses to stop execution in it. At this point under Run, the only command highlighted is Terminate, so I don't know where in the application I am at present.

If the application is still executing, how do I break out of the loop and get back control so I can start debugging?

Also, my Firefox browser opens, but there doesn't seem to be a relationship between Run > Step Over (F6) and what I see in the browser window. The browser is expecting user input. How do I coordinate between the browser and the Eclipse IDE so it's interactive between the two? An action in one makes it pause or continue in the other. That means, when I click in browser window, it should show me where I am in the debugger.

I have one more question. When I start a Drupal debugging session most people set up the Run > Run Configurations to start at index.php. My question is can I start a debug session at some arbitrary URL address or does it always have to begin with a .php file? How about a .tpl.php file located not in the htdocs folder, but in the theme folder itself? Should it be a .tpl.php file, or can it be a URL address?

I know these are basic questions, but any leads would be appreciated.

Technical Writing Services
http://www.itwrite.com

you have a couple options in Eclipse IDE

Chris Charlton's picture

You can debug a single URL, you must change the project settings (right-click > properties). You can save multiple "web servers" in a project, so you can have one for index.php and one for any other URL you're concentrating on.

When debugging a template you must visit a node to see it in action, usually.

Chris Charlton, Author & Drupal Community Leader, Enterprise Level Consultant

I teach you how to build Drupal Themes http://tinyurl.com/theme-drupal and provide add-on software at http://xtnd.us

i'm trying to get remote

jaypark's picture

i'm trying to get remote drupal/php debugging working with eclipse pdt locally. i'm running the latest eclipse pdt helios all in one, php 5.2, and the latest xdebug is setup and working on a remote server, live to the internet. remote debugging on a live server is important for debugging some modules that depend on integrating widely used 3rd party apis.

i've looked through several pages (most of the top google results are dated 2008) but most of docs are for xdebug running on a localhost. the one doc i found http://www.rymland.org/en/blogs/boaz/3_mar_08/using-pdt-xdebug-debugging... for remote xdebug debugging includes installing esftp for file syncing - this eclipse pluging hasn't been revised - you guessed it - since 2008.

is remote debugging with xdebug a lost cause?

@chris charlton: i tried your eclipse plugin, but other than including drupal file extensions to be recognized by the php editor, not sure what it's for... what am i missing?

templates url?

netw3rker's picture

any idea where the templates have gone now that drupal has moved from cvs to git?

it took me awhile to find

bdone's picture

it took me awhile to find them too, but here they are:
http://drupal.org/project/eclipse

I also use Eclipse Helios to

decibel.places's picture

I also use Eclipse Helios to manage Drupal projects, with the Subclipse plugin for SVN, and the Drupal configuration for file extensions .info .tpl.php etc

However, I use my tried and true EditPlus text editor for coding, probably because I am used to it, but the files are still managed within the Eclipse project.

Using Eclipse, I can sync better with the SVN repository, diff files for conflict resolution, and roll and apply patches.

This works for me!

FWIW my friend swears by NetBeans - as long as the tools are good, the artisan can accomplish excellent work!

Check out my blog post on how

pwaterz's picture

Check out my blog post on how to set it up using eclipse indigo http://www.patrickjwaters.com/blog/2011-07-24/how-setup-eclipse-php-pdt-...

Very nice

spideep's picture

Very nice


Alexis Rengifo