tags:

views:

170

answers:

3

Hello,

I am getting frustrated with PDT. I want the .phtml files to be opened as HTML BUT .phtml is "locked" to PHP Content Type and there is no way to unlock it!

Opening the .phtml files in HTML would make more sense (for Zend Framework users) because .phtml contain more HTML and some Javascript than PHP code.

The question is, wtf would the Eclipse developers lock certain file types? Is there any way to "unlock" this?

If I right click on the file and select Open With -> HTML Editor, then I get this error:

Could not open the editor: org.eclipse.wst.sse.ui.internal.StructuredTextViewer cannot be cast to org.eclipse.php.internal.ui.editor.PHPStructuredTextViewe

Help anyone?

Much appreciated, Wenbert

A: 

That looks like bug 241468, and it has been fixed late 2008 for PDT2.0.0

So what PDT version are you using? The latest one (2.1 with eclipse3.5) should not have this issue anymore.

VonC
I'm with a PDT 2.2 build and it still happens..
zvikico
Should you file the bug or should I?
wenbert
+2  A: 

This is caused by a bug in the PHP code folding. Turn off PHP code folding as a workaround, under Preferences, PHP -> Editor -> Code Folding.

zvikico
Interesting. +1. Has this been reported as a bug in the eclipse bugzilla system?
VonC
The bug you pointed out seems accurate, but it doesn't look solved to me (not with PDT 2.1 or 2.2). It should be reopened.
zvikico
Thanks for this. nWire from Twitter also gave me this solution. Credits to him also. http://twitter.com/nwire/status/5790056187
wenbert
That’s me, thanks :-)
zvikico
A: 

I could be misjudging your question, but I think what you're actually asking is how to remove the "locked" flag from a content type in Eclipse/PDT instead of getting a code folding error. Those content types are locked to a particular extension if they're defined in the plugin.xml file that defines that content type. Here's a snippet very similar to what you're looking for:

<!-- PHP Content Type declaration -->  
<extension  
    point="org.eclipse.core.contenttype.contentTypes">  
    <content-type  
        base-type="org.eclipse.core.runtime.text"  
        file-extensions="php,php3,php4,php5,phtml,inc,phps"  
        id="phpsource"  
        name="%content-type.name.0"  
        priority="high">  

If you notice the file-extensions line, just delete phtml from that list and restart eclipse (possibly with the -clean flag) and it should no longer be locked. The trick is finding the right XML file, especially if they're often inside .jar archives as well.

fentie