advanced eclipse workshop (held at ipc2010 -spring edition-)
Post on 01-Sep-2014
4.191 Views
Preview:
DESCRIPTION
TRANSCRIPT
Advanced Eclipse Workshop
Bastian Feder, Papaya Software GmbH
Nils Langner, Gruner + Jahr
Sven Kiera, TWT Interactive GmbH
IPC spring edition 201030.06.2010
Who are we?
Bastian Feder
Application developer
PHP since 2001
Open Source addict
Nils Langner
Qualitätsmanagement
PHP since 2002
Founder
www.phphatesme.com
Sven Kiera
Web developer
PHP and Java since 1998
Author of PHP Tool
Integration (PTI)
Start the engines
#> cd IPC09_Workshop ¶ #> sudo chown -R ubuntu:ubuntu workspace ¶
#> ./bin/eclipse/eclipse ¶
System -> Systemverwaltung -> Sprachunterstützung
Anwendungen -> Zubehör -> Terminal
Set current language
Open
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.
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
File Templates
Creating a prefilled file when using the „new PHP File“ dialog
Window -> Preferences -> PHP -> Editor -> Tempalates
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 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 PHPWindow -> Preferences -> Validation
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)
PTI & Dynamic Language Toolkit
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
[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
Subversion (client configuration)
Set „auto-properties“ WinXp:
MacOs / Linux:
C:\Dokumente & Einstellungen\<USER>\Anwendungsdaten\Subversion\config
~/.subversion\config
Subversive (installation)
• Eclipse update sitehttp://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 handlingExtended usage
Branching, tagging, merging, patching
External Tools
Running external tools inside Eclipse
Run -> External Tools -> External Tools Configuration
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>
Debugging techniques (III)
• Multi-User Debugging– Only possible using Remote
Debugging– DBGp Proxy necessary
Xdebug
Debugging for PHP by Derick Rethans(http://www.xdebug.org)
Provides profiling, tracing, code coverage, …
Cross platform
Obtaining Xdebug
PECLDownload from xdebug.org
Installation support at http://xdebug.org/find-binary.php
Package system of Linux distribution
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
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"
Debug CLI scripts
Preconditions
JIT configured
Breakpoint set or 'Break at first line' active
Debug cronjobs, PHPUnit tests, etc.
#> export XDEBUG_CONFIG=“idekey=ECLIPSE_DBGP“↵
#> php myScript.php ↵
#> export XDEBUG_CONFIG=““ ↵
Questions?
Further questions? Ask us at:
php@bastian-feder.de
nils@phphatesme.com
sven@kiera.de
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
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.en
top related