In eclipse, can I customize the delegate method code template?

In Java code style → Code Templates, there is the option “Delegate Methods” under the comments, but not under the code. I tried to change the "Tester Body" template because I wanted to automatically create a bunch of delegated setter methods. However, for delegates this did not work.

So, can I add the Delegate Methods element to the code template code part, or do I need to do something else?

I am using Eclipse Indigo on Win 7.

+7
source share
2 answers

To create the getter and setter methods, select the field declaration and call Source -> Generate Getter and Setter.

If you use a name prefix or suffix, be sure to indicate this on the code style preference page (Window> Preferences> Java> Code Style).

Another way to create getters and setters is to use content help. Place the cursor in the body body between the members and press Ctrl + Space to get sentences that create the getter or setter method stub.

0
source

You can do this, but you need to develop a plugin using the eclipse refactoring API provided by the Java Development Tools (JDT) as follows:

 Anyone who supports a programming language in an Eclipse-based IDE will be asked sooner or later to offer automated refactorings - similar to what is provided by the Java Development Tools (JDT). Since the release of Eclipse 3.1, at least part of this task (which is by no means simple) is supported by a language neutral API:the Language Toolkit (LTK). But how is this API used? 

Check out this one for a start.

0
source

All Articles