Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough

Eclipse Configuration for Drupal Development

Parent Feed: 

Submitted by MikeKeran on Tue, 01/08/2013 - 1:27pm

These configuration steps used to reside in my Drupal Developer's Setup for Windows post. But I've since switched to Sublime Text 2 so the steps in that post changed drastically. I've archived the Eclipse/Aptana settings here, just in case they are still of use to anyone.

  1. Set Window –> Preferences –> General –> Editors –> Text Editor –> Displayed tab width to 2 and check the Insert spaces for tabs option
  2. Navigate to General –> Editors –> File Associations in the left-hand pane
    1. Click the Add… button next to the File types list (the top Add button) type *.module in the File type text box
    2. Click the Add… button next to the Associated editors list (the bottom Add button), select PHP Source Editor from the list and click OK
    3. Repeat steps 1 and 2 for each of these file types:
      *.engine
      *.inc
       (may already be associated with the PHP editor)
      *.theme
      *.install
      *.profile
      *.test
  3. When you first start Aptana, you may get a Windows Firewall alert. If so, allow access as you see fit.
  • Install XDebug. Aptana finally has support for XDebug, but you’ll need to grab a build greater than 3.2.0.201203202318. Obviously this is an optional step, but if you’ve been debugging your Drupal sites with a liberal sprinkling of dsm() calls, consider doing these steps. The time saved the first time you use the debugger will make it all worth it or your money back…
    1. Check your Eclipse version (Help –> About Aptana Studio 3). Once Aptana 3.2 is released, this is will no longer be necessary.
      1. From Windows –> Preferences –> Install/Update –> Available Software Sites, click Add, point the new update site to http://preview.appcelerator.com/aptana/studio3/standalone/update/nightly/, and OK the dialog.
      2. Close Aptana. Right-click on the Aptana icon in the Taskbar, right-click on the AptanaStudio 3 option, and select Run as administrator. This gives Aptana permissions to update itself.
      3. In Aptana, Help –> Check for updates and follow the instructions for updating Aptana Studio.
    2. Get the debugger plugin for Aptana. Note: Once Aptana 3.2 is released, the debugger plugin should come included and these steps will no longer be needed.
      1. Go to this issue in the Aptana issue queue and download the zip file in the Attachments section.
      2. Unzip the file and place the contents in a directory on your local machine.
      3. In Aptana, Help –> Install new software, click the Add button, click the Local button, and navigate to the directory with the unzipped files.
      4. Click OK and follow the instructions to install the debugger.
    3. Edit your php.ini file (click the WAMP Manager icon, select PHP –> php.ini) and scroll to the XDebug section. Change/Add the following values then restart Apache. You can verify the changes by creating a one-line PHP file with <?php phpinfo(); ?> and verify that with XDebug v. 2.1.2 Copyright… etc. appears just above the PHP Credits link.
      xdebug.remote_enable=1
      xdebug.remote_host=127.0.0.1
      xdebug.remote_port=9000
      xdebug.remote_handler="dbgp"
      
    4. You can setup Debug Configurations in Aptana (Run –> Debug Configurations…), but I find it easier to use Chrome’s XDebug Helper or Firefox’s easy XDebug plugins to tell Aptana when I want to break into the debugger. I know that Chrome’s can be set so the option is only available for some sites (eg: local.*) so it’s not cluttering my day-to-day browsing. I also like remapping the keyboard shortcuts for Step Over and Step Into to F10 and F11 to match what I’m used to from other debuggers. All I have to do is set a breakpoint in my code, then go to Chrome and make sure the “bug” at the end of the URL bar is green. I navigate to a page that will trip the breakpoint, switch to Aptana and it’s already waiting for me to step through the code!
Author: 
Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web