Download pdf - Eclipse HandsOn Workshop

Transcript
Page 1: Eclipse HandsOn Workshop

Workshop

Hands on Eclipse PDT 2.x

Bastian Federpapaya Software GmbH

IPC 200915.11.2009

Page 2: Eclipse HandsOn Workshop

Me, myself & I

Application developer PHP since 2001 @papaya since

01.2008 OpenSource addict

Page 3: Eclipse HandsOn Workshop

Who are you?

Page 4: Eclipse HandsOn Workshop

Installation

Download latest revision from Eclipse website(http://www.eclipse.org/pdt/downloads)

▹ All in one (recommended): provides everything you need to run PDT

▹ PDT Feature / Update Manager: extends an existing Eclipse, but all dependencies PDT relies on needs to be installed first.

Extract archive Copy to favorized location

(e.g. /usr/local/bin/ or another location in your application path)

Page 5: Eclipse HandsOn Workshop

Installation (II)

● Java Runtime Environment– Linux: sun-java6-jre from multiverse repository

● Switch off any kind of indexer and/or crawler– Virus scanner

– Spotlight (MacOsX)

– GnomeDo / KRunner (Linux)

– Windows Indexing Service

– ...

Page 6: Eclipse HandsOn Workshop

Start the engines

#> cd IPC09_Workshop ¶ #> sudo chmod -R ubuntu:ubuntu workspace ¶

#> ./bin/eclipse/eclipse ¶

● Set current language– System > Systemverwaltung >

Sprachunterstützung

● open Anwendungen > Zubehör > Terminal

Page 7: Eclipse HandsOn Workshop

Configuration

HandsOn

Page 8: Eclipse HandsOn Workshop

Tips and Tricks (Configuration)

Heap space (memory allocated by JRE)size depends on system memory capacity

▹ Xms, Xmx

▹ XXMaxPermSize, XXPermSize

Eclipse PDT settings▹ validation / build settings

▹ disable automatic updates

Page 9: Eclipse HandsOn Workshop

Look and feel

HandsOn

Page 10: Eclipse HandsOn Workshop

Perspectives & Views

Perspective(Window > Open Perspektive)

▹ Arrangement of Views:PHP Perspektive contains e.g. 'PHP Explorer', 'Outline' and 'Project Outline'

Views or Tabs(Window > Show View)

▹ Viewport providing specific information and/or functionality

Page 11: Eclipse HandsOn Workshop

Working Sets

Group elements for display in views or for operations on a set of elements.

Page 12: Eclipse HandsOn Workshop

Pause

Until 14:45hrs

Page 13: Eclipse HandsOn Workshop

Working with Eclipse

Projects Templates Code completion ...

Page 14: Eclipse HandsOn Workshop

Projects

Organizational untis Customizable configuration PHP include path

▹ Validation

Build rules▹ included resources

▹ excluded resources

Page 15: Eclipse HandsOn Workshop

Templates

Contextual predefined code snippets

Configure at Preferences > PHP > Templates

Page 16: Eclipse HandsOn Workshop

File templates

Create new files with predefined structures

Easy to create or adapt

Page 17: Eclipse HandsOn Workshop

Code templates

Activation key:<CTRL> + space

Code templates▹ Eases typing of complex code structures

(e.g. switch – statement)

▹ Minimize errors

▹ Act like a form switch ($action) { case 'read': ; break;

default: ; break; }

Page 18: Eclipse HandsOn Workshop

Code templates (II)

Capable of code completion Set cursor positioning (${cursor}, ${}) Dynamic content by use of variables

▹ ${class}

▹ ${function}

▹ ${variable}

▹ ${value}

switch (${dollar}${variable}) { case ${value}: ${cursor}; break;

default: ; break; }

Page 19: Eclipse HandsOn Workshop

Pause

Until 16:00hrs

Page 20: Eclipse HandsOn Workshop

External Tools Framework

Enables Eclipse to run ,stand-alone' applications

Two broad classes of external tools are available:▹ Ant build files

▹ Everything else

Page 21: Eclipse HandsOn Workshop

Subversive

HandsOn

Page 22: Eclipse HandsOn Workshop

Subversive (installation)

Eclipse update sitehttp://download.eclipse.org/technology/subversive/0.7/update-site/

Page 23: Eclipse HandsOn Workshop

Subversion (client configuration)

Set „auto-properties“ ▹ WinXp:

C:\Dokumente und Einstellungen\<USER>\Anwendungsdaten\Subversion\config

▹ MacOs / Linux: ~/.subversion/config

[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

Page 24: Eclipse HandsOn Workshop

Plugins

Subclipsemanaging SVN repositories from inside Eclipse

JSEclipseProvides additional features supporting JavaScript

Data Tools Platformmanaging databases from inside Eclipse

Page 25: Eclipse HandsOn Workshop

xDebug

Debugging for PHP by Derick Rethans(http://www.xdebug.org)

Provides profiling, tracing, code coverage, … Cross platform

Page 26: Eclipse HandsOn Workshop

xDebug configuration

Add to php.ini (e.g. on Mac)

or .htaccess - file

[XDebug] ;; Only Zend OR (!) XDebug zend_extension="/Applications/xampp/xamppfiles/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 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"

Page 27: Eclipse HandsOn Workshop

xDebug (III)

Debug dialog

Page 28: Eclipse HandsOn Workshop

xDebug (IV)

Configure PDT to talk to xDebug

Page 29: Eclipse HandsOn Workshop

xDebug (IV)

Configure the 'Server' handling the debugging session

Page 30: Eclipse HandsOn Workshop

Questions?

Further questions? Ask me at:

[email protected]

Page 31: Eclipse HandsOn Workshop

Contact'n Rate

Contact▹ Blog: http://bastian-feder.de

▹ Email: [email protected]

Rate the workshop @ http://joind.in/talk/view/1067

Page 32: Eclipse HandsOn Workshop

References

Eclipse PDT(http://www.eclipse.org/pdt)

Eclipse plugins▹ Subversive (http://subclipse.tigris.org)

▹ JSEclipse (http://www.interaktonline.com/products/eclipse/jseclipse/overview)

xDebug(http://www.xdebug.org)

PhpDocumentor @ pear.php.net(http://pear.php.net/package/PhpDocumentor/docs/1.4.2)

SVN keyword substitution(http://svnbook.red-bean.com/en/1.4/svn-book.html#svn.advanced.props.special.keywords)

Page 33: Eclipse HandsOn Workshop

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