Eclipse - New Class Boiler Plate
I am looking at using Eclipse for a project and there are several copy paste requirements for each class, to fit the project requirements.
I have looked in Window > Preferences > Java > Editor > Templates, and a few other seemingly related areas of the preferences with no luck so far.
When I create a new class, say A for example, Eclipse creates the following code:
Code java:
/**
*
*/
package packagename;
/**
* @author jps
*
*/
public class A {
}
What I would like to have is the following code:
Code java:
/** nameThisFileIsSavedAs.Extension */
package packagename;
/**
* @author jps
*
*/
public class A {
/* Comment 1 */
/* Comment 2 */
/* Comment 3 */
/* Comment 4 */
}
Question #1: How do I get the saved file name and the Comments 1-4 to be generated by eclipse? -or is it not possible?
Question #2: Is there a way to make the first comment, where the file name goes, appear all on one line (as shown in my desired code sample)?
Re: Eclipse - New Class Boiler Plate
Have you tried playing around in Window > Preferences > Java > Code Style, and either Code Template or Formatter?
In Code Template, you could probably make some changes to Code > Class body for the 4 comments, and Comments > Files for the file name at the top. I have no idea what tags to use to make those things show up, but you can probably figure it out with a bit of tinkering.
Re: Eclipse - New Class Boiler Plate
For the comments in the body:
Window > Preferences > Java > Code Style > Code Templates > Code > Class Body > Edit
/* Comment */
For the file name:
Window > Preferences > Java > Code Style > Code Templates > Comments > File > Edit
/** ${file_name} */
${file_name} is the variable, but one does not need to know what to type, you can select what you want from a list.
Everything turned out as expected, thanks aussiemcgr