how to better use of eclipse code templates (PHP)?

Posted by pocketfullofcheese on Stack Overflow See other posts from Stack Overflow or by pocketfullofcheese
Published on 2010-04-04T19:41:01Z Indexed on 2010/04/12 4:53 UTC
Read the original article Hit count: 396

One particular problem I was having was using ${word_selection} in an Eclipse PDT template.

I was recently trying to use some code templates with Eclipse PDT 2.1 to speed up some common tasks. We use a lot of getters/setters, so I wrote the following template.

function get${word_selection}() {
return $$this->getData('${word_selection}');
}

function set${word_selection}($$${word_selection}) {
$$this->setData('${word_selection}', $$${word_selection});
}

I named the template "getset" and the only way I know to use the Code Assist is to type: "getset" then hit my code assist keys (I have it set to Esc, but I think the default was Ctrl+Space). The problem is, this doesn't actually let me select a word to be used by the ${word_selection}.

how do I type in my template name, hit the key combo, and have a word selected all at the same time?

I also want to know what kinds of templates people have set up and any other tips for using templates to speed of programming.

© Stack Overflow or respective owner

Related posts about eclipse

Related posts about eclipse-pdt