Actions

Chunk

Difference between revisions of "Configuring Eclipse IDE for PHP development - Configuration"

From Joomla! Documentation

(Code folding)
(Installing more extensions)
Line 8: Line 8:
 
*On Eclipse go to: "Toolbar --> help --> install new software"
 
*On Eclipse go to: "Toolbar --> help --> install new software"
 
*You are now on the "Install" window, click the drop-down list  "Work with" and set it to "--All Available Sites--"
 
*You are now on the "Install" window, click the drop-down list  "Work with" and set it to "--All Available Sites--"
*In the search box type the following keywords and select all the results in the list below:
+
*In the list expand the nodes and find the following packages to install:
Note: Be patient in this part for some reason Eclipse got slow and hangs for short periods of time when you type new keywords in the search box
+
Note: You can also use the search box, but for some reason (maybe a bug) Eclipse IDE hangs for few seconds on every search.
**subversive
+
 
**Remote Development Support
+
** goto "Web, XML, and Java EE Development" and select
**php
+
*** PHP Development Tools (PDT) SDK Feature
**xml editors
+
*** JavaScript Development Tools
**xsl editors
+
*** Eclipse XML Editors and Tools
**javascript
+
*** Eclipse Web Developer Tools
**Remote System Explorer
+
** goto "General Purpose Tools" and select
**Eclipse Web Developer Tools
+
***Remote System Explorer End-User Runtime
**Web Page Editor
+
 
 
*Press "Next>" and follow the installation wizard and restart Eclipse if needed
 
*Press "Next>" and follow the installation wizard and restart Eclipse if needed
  
Those are all the extension to install for now, they should be enough to work with local and remote PHP and development of Joomla projects, nonetheless you can experiment and tray all the extensions you like.
+
Those are all the extension to install for now, they should be enough to do local and remote PHP development, nonetheless you can experiment and tray all the extensions you want.
  
 
=== Configuring the perspectives and views ===
 
=== Configuring the perspectives and views ===

Revision as of 09:58, 29 October 2012

Contents

Configuration

Installing more extensions

For your Eclipse IDE you will need to install more extension for PHP development and other tools to help you in your project development journey, follow this steps and indications:

  • On Eclipse go to: "Toolbar --> help --> install new software"
  • You are now on the "Install" window, click the drop-down list "Work with" and set it to "--All Available Sites--"
  • In the list expand the nodes and find the following packages to install:

Note: You can also use the search box, but for some reason (maybe a bug) Eclipse IDE hangs for few seconds on every search.

    • goto "Web, XML, and Java EE Development" and select
      • PHP Development Tools (PDT) SDK Feature
      • JavaScript Development Tools
      • Eclipse XML Editors and Tools
      • Eclipse Web Developer Tools
    • goto "General Purpose Tools" and select
      • Remote System Explorer End-User Runtime
  • Press "Next>" and follow the installation wizard and restart Eclipse if needed

Those are all the extension to install for now, they should be enough to do local and remote PHP development, nonetheless you can experiment and tray all the extensions you want.

Configuring the perspectives and views

In this case we need to configure Eclipse for PHP development, so you should add the following perspectives:

  • Go to: "Toolbar --> windows --> open perspective --> others --> debug"
  • Go to: "Toolbar --> windows --> open perspective --> others --> php"
  • Switch to the "PHP perspective"
  • Go to: "Toolbar --> windows --> show view --> others --> remote systems"
  • Drag the view from the tab and drop it next to the "PHP explorer" view

Now you can explore local and remote PHP project, how to configure this tools will be explained in this series of articles, but for now leave it for the future.

Configuring the editors

These are some of the configuration you can do to your editors to improve the user experience:

Display white spaces

Some people like to see the white spaces represented in the editor to do so:

  • Go to "Toolbar --> window --> preferences --> general --> editors --> text editors"
  • Set "show whitespace characters" to check

Colors

To highlight some the parts of the code with stronger colors, follow this steps:

  • Go to "Toolbar --> window --> preferences --> general --> editors --> text editors --> annotations "
    • On the list find "java scrip occurrences" and set the color value to "#FFFF5A"
    • On the list find "matching tags" and set the color value to "#FFFF5A"
    • On the list find "php elements read occurrences" and set the color value to "#FFFF5A"
  • Go to "Toolbar --> window --> preferences --> general --> editors --> structured text editor"
    • Find the list "Appearance color options"
    • On the list find "Matching brackets highlight" and set the color value to "#0000FF"
  • Go to "Toolbar --> window --> preferences --> javascript --> editor"
    • Find the list "Appearance color options"
    • On the list find "Matching brackets highlight" and set the color value to "#0000FF"
  • Go to "Toolbar --> window --> preferences --> javascript --> editor --> syntax coloring"
    • Find the list "Element"
    • On the list find "javascript --> functions" enable the option and set the color value to "#1E90FF"
    • On the list find "javascript --> function declarations" enable the option and set the color value to "#1E90FF"
    • On the list find "javascript --> local variable declaration" enable the option and set the color value to "#A52A2A"
    • On the list find "javascript --> local variable references" enable the option and set the color value to "#A52A2A"
    • On the list find "javascript --> parameter variables" enable the option and set the color value to "#A52A2A"
  • Go to "Toolbar --> window --> preferences --> php --> editor --> syntax coloring"
    • Find the list "Syntax element"
    • On the list find "functions" and set the color value to "#1E90FF"
    • On the list find "methods" and set the color value to "#1E90FF"
    • On the list find "variable" and set the color value to "#A52A2A"

Spell checking

If you want that eclipse assist you on check the grammar of your text, enable this option.

  • Go to "Toolbar --> window --> preferences --> general --> editors --> spelling"
    • Find and enable "enable spell checking

Code folding

Code folding is a nice feature of some editor, it allow you to fold the code in certain data structures like functions, classes and other structures such as classes, conditionals and iterators, we are going to fold all the possible except classes content to be able to check and study PHP files quickly

  • Go to "Toolbar --> window --> preferences --> general --> editors --> structured text editors"
    • Clink on the tab "appearance"
    • Find and enable "enable folding"
  • Go to "Toolbar --> window --> preferences --> javascript --> editor --> folding"
    • Find and enable "enable folding"
    • Find and enable "comments"
    • Find and enable "header comments"
    • Find and enable "members"
  • Go to "Toolbar --> window --> preferences --> php --> editor --> code folding"
    • Find and enable "enable folding"
    • Find and enable "functions"
    • Find and enable "phpdoc"
    • Find and enable "header phpdoc"

code cleaning

Eclipse provides some nice utilities to automatically clean the source code of some extra garbage such as cleaning empty lines, deleting unnecessary trials spaces, formatting to the code and more. To activate some of this features follow these instructions:

  • Go to "Toolbar --> window --> preferences --> javascript --> editor --> content assist --> save actions"
    • Find and enable "Additional actions"
    • Press the button "Configure"
    • Find the tab "code organizing"
    • Find and enable "remove trailing whitespaces" and also select "all lines"
    • Press the button "ok"
  • Go to "Toolbar --> window --> preferences --> php --> editor --> save actions"
    • Find and enable "Remove trailing whitespaces" and also select "all lines"