Eclipse cheat sheet (using pdt & symfony)


Conflict handling

  • right click on the original file (not on myFile.mine or myFile.r123) and select "team -> edit conflicts"
  • (a two column diff editor opens)
  • all changes are resolved from the right side ("theirs") to the left side
  • non-conflicting changes are marked blue, conflicts are marked red
  • manualy resolve the conflicts (you can use the "arrow icons in the right top of the window", or click on the small sqares in the middle of the two columns)
  • save
  • right click on the original file and select "team -> Mark resolved"
  • submit


Example: merge an update (r123) in the trunk into a development branch

  • select the working copy where you want implement the changes (branch)
  • explorer: right click on the project -> team -> merge
  • From: enter the source URL (trunk)
  • From revision: enter the revision number before the last change was made (r122)
  • To: use "From:" URL
  • To revision: enter the revision where the last change was made (r123)
  • Click "unified diff" to verify the result
  • "Merge"


Find/Replace with regular expressions (regex)

Helpful to create the expression:

Example: remove all function calls of utf8_decode(otherstuff("foobar"))

  • Find: utf8_decode\(([^)]+)\)
  • Replace with: $1
  • Options - Regular expression: check

Find matching brackets/braces

  • CtrlP

Split screen horizontally

  • Ctrl + _

Code completion / templates

  • In the editor: hit [CTRL]-[SPACE]


Show whitespace characters

  • right click in an empty area of the icon toolbar at the top -> customize perspective
  • tab "commands" -> check "Editor Presentation"


Show hidden files in the explorer

  • click on the small "down" arrow in the top left corner of the explorer -> Filters
  • uncheck "*.files"

Manual php type hints

Just add this line in your code:

$url = $helper->get('url');
/*@var $url sfUrlHelper*/ 


Code templates are especially handy in MVC "view" templates, like symfony templates.

Example for if/elseif/else:

  • In the main menu:
  • Window -> Preferences
  • Web and XML -> HTML Files -> Templates
  • Click "New"
  • Name: "php if"
  • Description "php if/elseif/else/endif"
  • Pattern:
    • <?php if(${dollar}${expression}): ?>
      <?php elseif(${dollar}${expression2}): ?>
      <?php else: ?>
      <?php endif; ?>
  • Usage in the editor: hit [CTRL]-[SPACE] and select "php if" from the menu


Slow startup / indexing or much disk-space used

Solution: go to workspace/.metadata/plugins/org.eclipse.dltk.core.index.sql.h2 and delete the *.db files.
These are cache files which are rebuilt upon the next eclipse startup. Sometimes the are corrupted.


Charset / Encoding Detect Plugin

Note: both are not really working for autodetect:

Use cp1250

Go to Window > Pereferences > General > Workspace Type cp1250 into the dropdownbox (if not in the list, your have to type it!!)