Thursday, 28 October 2010

Opening Drupal PHP files in Eclipse

By default, some Drupal files will not open in the proper editor (they will just be treated as plain text). Assuming you have PDT installed for PHP development, you can specify which filetypes contain PHP code and hence should be opened in the PHP editor.

Look in Windows > Preferences > General > Content Types > Text > PHP Content Type, and add each of the following associations:
*.engine
*.theme
*.install
*.inc
*.module
*.profile
*.test

PROBLEM
If when you then try opening one of these files, you get an error along the lines of:
Unable to create editor ID org.eclipse.php.editor: org.eclipse.core.internal.filebuffers.SynchronizableDocument cannot be cast to org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument

SOLUTION
Restart eclipse.


References: http://drupal.org/node/75242

2 comments: