Bastian Feder, Papaya Software GmbH
Nils Langner, Gruner + Jahr
Sven Kiera, TWT Interactive GmbH

Advanced Eclipse Worksho...
Who are we?

    Bastian Feder              Nils Langner

    Application developer     Qualitätsmanagement
    PHP sin...
Who are you?
Installation
Start the engines
Set current language
       System -> Systemverwaltung -> Sprachunterstützung



Open
       Anwendungen...
Eclipse - Basics
 Workspace
   The workspace is the physical location (file path) you are working in. You can
    choose...
Your Choice …
 External Tools
 SVN and PDT
 Shortcuts
 Templates
 PTI (PHP Tool Integration)
 Validators
 Xdebug
Eclipse - Shortcuts
Shortcut          Description
CTRL-ALT-Cursor   Copy the current line

CTRL-Left/Right   Jump to previ...
Templates
Contextual predefined code snippets
Configure at Preferences > PHP > Templates
File Templates

Creating a prefilled file
when using the „new PHP
File“ dialog


Window -> Preferences -> PHP -> Editor ->...
Code Templates
Eases typing of complex code structures
  (e.g. foreach statement)

 Activation key: <CTRL> + space
Validators

Validators are plugins that
  can analyse files and set
  markers (e.g. Warnings,
  Errors)

 They can be swi...
PTI & Dynamic Language Toolkit
 Eclipse Plugins für Eclipse PDT 2.x und Zend Studio 7.x
 Ziel: Direkte Nutzung von PHP T...
Creating a Validator
The dynamic language validator will run
a php script and interprets the outfit by
matching against an...
Subversion                               (client configuration)


 Set        „auto-properties“
       WinXp:           ...
Subversive (installation)
•   Eclipse update site
    http://download.eclipse.org/technology/subversive/0.7/update-site/
Subversion      (client configuration)


•   SVN connector
•   SVN properties for new files
•   Customize label decorations
Subversion & Subversive
 Setup
 Common      handling
   Checkout
   Commit / revert changes
 Conflict
         handli...
External Tools
Running external tools
inside Eclipse




                         Run -> External Tools -> External Tools ...
Build Script
Running a script that creates the PHPDoc
documentation files


                 <project name="Workshop" base...
Code Beautifier
The one missing thing in PDT
Debugging
 Debugging   techniques
 Xdebug
 How   to enable Eclipse for debugging
Debugging techniques
Local debugging
Debugging techniques   (II)



•   Remote debugging
Debugging techniques        (III)



•   Multi-User Debugging
     – Only possible using Remote
        Debugging
     – D...
Xdebug
 Debugging for PHP by Derick Rethans
  (http://www.xdebug.org)
 Provides profiling, tracing, code coverage,
  …
...
Obtaining Xdebug
 PECL
 Download    from xdebug.org
    Installation support at
     http://xdebug.org/find-binary.php
...
Xdebug configuration
Add to php.ini (e.g. on Mac)

 [XDebug]
 ;; Only Zend OR (!) XDebug
 zend_extension="/usr/lib/php/php...
Xdebug configuration                                                        (II)



.htaccess - file

   #----------------...
Xdebug




         Hands on
Preferences – Basic setup
General settings
 Debug   Port
 Multisession

 DBGp    Proxy settings
Preferences – Basic setup
Preferences – PHP servers
                
                 Remote debugging
                
                 Mapping b...
Configuration for remote
debugging
Configuration for remote
debugging (II)
Configuration for remote
debugging (III)
Start a remote debugging
session
Start a local debugging
Configure „autostart“ options
 Accept    JIT
     Localhost
   Any

   Prompt
Debug CLI scripts
    #> export XDEBUG_CONFIG=“idekey=ECLIPSE_DBGP“↵

    #> php myScript.php ↵

    #> export XDEBUG_CONF...
Debugging made easy!
Firefox Add-on
„Xdebug Helper“
Questions?




             Further questions? Ask us at:

             php@bastian-feder.de

             nils@phphatesme...
Contact'n Rate
•    Contact
    – Websites:
           •   http://www.phphatesme.com
           •   http://blog.bastian-fe...
License
This set of slides and the source code
    included in the download package is
    licensed under the

   Creative...
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Upcoming SlideShare
Loading in …5
×

Advanced Eclipse Workshop (held at IPC2010 -spring edition-)

3,501
-1

Published on

So wie sich PHP weiterentwickelt, so entwickelt sich auch die Art der Programmierung weiter. Die Zeiten sind vorbei, in denen PHP nur von Hobbyprogrammierern genutzt wurde. Doch mit dem Anspruch an die Projekte steigt auch der Anspruch bei der Entwicklung. Schnell wird hierbei auf eine leistungsstarke IDE wie Eclipse PDT, Zend Studio oder Netbeans zurückgegriffen. Doch wie sieht eine anspruchsvolle Entwicklung mit solch einer IDE aus? Dieser Workshop wird Ihnen am Beispiel von der IDE Eclipse PDT demonstrieren, wie solch eine Entwicklung aussehen kann. Im Detail wird Ihnen gezeigt, wie Sie mittels SVN und Subversive Ihren Code mit mehreren Leuten gemeinsam pflegen und entwickeln und wie Sie die Entwicklungsumgebung Ihren Bedürfnissen anpassen, um z.B. mittels phing eigene Build-Prozesse anstoßen zu können. Damit Sie direkt eigene Erfahrungen sammeln können, würden wir Ihnen herzlich anraten, Ihren Laptop mitzubringen. Um zeitraubenden Installationen vorzubeugen, wird Ihnen ein Ubuntu in Form einer Live-CD bereitgestellt. Teilnehmer mit bestehender Linux-Installation und entsprechenden Rechten können ihr System während des Workshops direkt für den täglichen Gebrauch einrichten.

Published in: Technology
0 Comments
7 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,501
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
56
Comments
0
Likes
7
Embeds 0
No embeds

No notes for slide

Advanced Eclipse Workshop (held at IPC2010 -spring edition-)

  1. 1. Bastian Feder, Papaya Software GmbH Nils Langner, Gruner + Jahr Sven Kiera, TWT Interactive GmbH Advanced Eclipse Workshop IPC spring edition 2010 30.06.2010
  2. 2. Who are we? Bastian Feder Nils Langner Application developer Qualitätsmanagement PHP since 2001 PHP since 2002 Open Source addict Founder www.phphatesme.com Sven Kiera Web developer PHP and Java since 1998 Author of PHP Tool Integration (PTI)
  3. 3. Who are you?
  4. 4. Installation
  5. 5. Start the engines Set current language System -> Systemverwaltung -> Sprachunterstützung Open Anwendungen -> Zubehör -> Terminal #> cd IPC09_Workshop ¶ #> sudo chown -R ubuntu:ubuntu workspace ¶ #> ./bin/eclipse/eclipse ¶
  6. 6. Eclipse - Basics  Workspace  The workspace is the physical location (file path) you are working in. You can choose the workspace during startup of eclipse or via the menu (File-> Switch Workspace-> Others).  All your projects, sources files, images and other artifacts will be stored and saved in your workspace.  Perspective  A perspective is a visual container for a set of views and editors.  Views  Viewport providing specific information and/or functionality  Working Sets  Group elements for display in views or for operations on a set of elements.
  7. 7. Your Choice …  External Tools  SVN and PDT  Shortcuts  Templates  PTI (PHP Tool Integration)  Validators  Xdebug
  8. 8. Eclipse - Shortcuts Shortcut Description CTRL-ALT-Cursor Copy the current line CTRL-Left/Right Jump to previous/next courser position CTRL-Up/Down Move marked text SHIFT-ALT-A Toggle block edit and normal mode STRG-SHIFT-T Open the „Open Type“ box STRG-SHIFT-C Comment the marked text using „//“ ALT-ENTER Maximize Editor To edit the shortscuts Window -> Preferences -> General -> Keys
  9. 9. Templates Contextual predefined code snippets Configure at Preferences > PHP > Templates
  10. 10. File Templates Creating a prefilled file when using the „new PHP File“ dialog Window -> Preferences -> PHP -> Editor -> Tempalates
  11. 11. Code Templates Eases typing of complex code structures (e.g. foreach statement)  Activation key: <CTRL> + space
  12. 12. Validators Validators are plugins that can analyse files and set markers (e.g. Warnings, Errors)  They can be switched off!  Validators can be run manual or on build  Most native PDT validators are syntax checkers  It is possible to add validators written in PHP Window -> Preferences -> Validation
  13. 13. PTI & Dynamic Language Toolkit  Eclipse Plugins für Eclipse PDT 2.x und Zend Studio 7.x  Ziel: Direkte Nutzung von PHP Tools in Eclipse PDT  Aktuelle Unterstützung:  PHP_CodeSniffer  PHPDepend  PHPUnit  PHP Copy / Paste Detector  PEAR Verwaltung inkl. aktueller PEAR Bibliothek  Erweitert Eclipse DLTK External Checker um direkte Nutzung von PHP Skripten  Open Source (EPL)
  14. 14. Creating a Validator The dynamic language validator will run a php script and interprets the outfit by matching against an regular expression We are going to build the incredible echo-instead-of-print Validator Window -> Preferences -> Dynamic Languages -> Validators -> Add
  15. 15. Subversion (client configuration)  Set „auto-properties“  WinXp: C:Dokumente & Einstellungen<USER>AnwendungsdatenSubversionconfig  MacOs / Linux: ~/.subversionconfig [miscellany] global-ignores = *.o *.lo *.la #*# .*.rej *.rej .*~ *~ .#* .DS_Store .project .cache .settings enable-auto-props = yes [auto-props] *.js = svn:eol-style=LF;svn:keywords=Id LastChangedDate LastChangedRevision URL *.css = svn:eol-style=LF;svn:keywords=Id LastChangedDate LastChangedRevision URL *.php = svn:eol-style=LF;svn:keywords=Id LastChangedDate LastChangedRevision URL *.html = svn:eol-style=LF;svn:mime-type=text/html;svn:keywords=LastChangedDate LastChangedRevision URL *.htm = svn:eol-style=LF;svn:mime-type=text/html;svn:keywords=LastChangedDate LastChangedRevision URL *.xsl = svn:eol-style=LF *.xml = svn:eol-style=LF *.xsd = svn:eol-style=LF
  16. 16. Subversive (installation) • Eclipse update site http://download.eclipse.org/technology/subversive/0.7/update-site/
  17. 17. Subversion (client configuration) • SVN connector • SVN properties for new files • Customize label decorations
  18. 18. Subversion & Subversive  Setup  Common handling  Checkout  Commit / revert changes  Conflict handling  Extended usage  Branching, tagging, merging, patching
  19. 19. External Tools Running external tools inside Eclipse Run -> External Tools -> External Tools Configuration
  20. 20. Build Script Running a script that creates the PHPDoc documentation files <project name="Workshop" basedir="." default="build"> <description> simple example build file </description> <target name="documentation"> <exec executable="phpdoc"> <arg value="-s wp-content/Plugins/PushWP/ -d docs" /> </exec> </target> <target name="build" depends="documentation" /> </project>
  21. 21. Code Beautifier The one missing thing in PDT
  22. 22. Debugging  Debugging techniques  Xdebug  How to enable Eclipse for debugging
  23. 23. Debugging techniques Local debugging
  24. 24. Debugging techniques (II) • Remote debugging
  25. 25. Debugging techniques (III) • Multi-User Debugging – Only possible using Remote Debugging – DBGp Proxy necessary
  26. 26. Xdebug  Debugging for PHP by Derick Rethans (http://www.xdebug.org)  Provides profiling, tracing, code coverage, …  Cross platform
  27. 27. Obtaining Xdebug  PECL  Download from xdebug.org  Installation support at http://xdebug.org/find-binary.php  Package system of Linux distribution
  28. 28. Xdebug configuration Add to php.ini (e.g. on Mac) [XDebug] ;; Only Zend OR (!) XDebug zend_extension="/usr/lib/php/php5/extensions/no-debug-non-zts-20060613/xdebug.so" xdebug.remote_enable=true xdebug.remote_host=127.0.0.1 ;if debugging on remote server, put client IP here xdebug.remote_port=9000 xdebug.remote_handler=dbgp ;; profiler xdebug.profiler_enable=Off xdebug.profiler_enable_trigger=On xdebug.profiler_output_dir=/data_lokal/temp/xdebug/profiling
  29. 29. Xdebug configuration (II) .htaccess - file #-------------------------------# # xDebug section # #-------------------------------# php_value xdebug.remote_enable 1 php_value xdebug.remote_handler bdgp php_value xdebug.remote_host 127.0.0.1 ;if debugging on remote server, put client IP here ;; php_value xdebug.allowed_clients <client IP address> php_value xdebug.remote_port 9000 # profiler php_value xdebug.profiler_enable_trigger 1 php_value xdebug.profiler_enable 0 php_value xdebug.profiler_output_dir "/data_lokal/temp/xdebug/profiling"
  30. 30. Xdebug Hands on
  31. 31. Preferences – Basic setup
  32. 32. General settings  Debug Port  Multisession  DBGp Proxy settings
  33. 33. Preferences – Basic setup
  34. 34. Preferences – PHP servers  Remote debugging  Mapping between IDE and Xdebug
  35. 35. Configuration for remote debugging
  36. 36. Configuration for remote debugging (II)
  37. 37. Configuration for remote debugging (III)
  38. 38. Start a remote debugging session
  39. 39. Start a local debugging
  40. 40. Configure „autostart“ options  Accept JIT  Localhost  Any  Prompt
  41. 41. Debug CLI scripts #> export XDEBUG_CONFIG=“idekey=ECLIPSE_DBGP“↵ #> php myScript.php ↵ #> export XDEBUG_CONFIG=““ ↵ Preconditions  JIT configured  Breakpoint set or 'Break at first line' active Debug cronjobs, PHPUnit tests, etc.
  42. 42. Debugging made easy! Firefox Add-on „Xdebug Helper“
  43. 43. Questions? Further questions? Ask us at: php@bastian-feder.de nils@phphatesme.com sven@kiera.de
  44. 44. Contact'n Rate • Contact – Websites: • http://www.phphatesme.com • http://blog.bastian-feder.de • http://www.phpsrc.org • Rate the workshop @ http://joind.in/talk/view/1749
  45. 45. License This set of slides and the source code included in the download package is licensed under the Creative Commons Attribution- Noncommercial-Share Alike 2.0 Generic License http://creativecommons.org/licenses/by-nc-sa/2.0/deed
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×