Automatic comment generation in Eclipse

When I create a new class, I'd like Eclipse to automatically inser

Page 1 of 1

3 Replies - 12942 Views - Last Post: 05 June 2006 - 02:21 AM Rate Topic: -----

#1 moerl  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 30
  • Joined: 02-June 06

Automatic comment generation in Eclipse

Posted 04 June 2006 - 01:45 AM

The title and description pretty much say it all.. I was looking for an IDE forum here at dream.in.code but didn't find one, so I'm posting this in the Java forum as that's the most appropriate place I could think of, considering I'm coding in Java and using Eclipse to do so.

Here's an example of what I'd like to have in each new class I open:

package edu.[domain name].cs111.students.[my username].hw[#];

/**
 *	Course: CS111
 *	Homework: [#]
 *	Date: [MM/DD/YYYY]
 *	Username: [username]
 *	Name: [my full name]
 *	Description: (sample description from a program I did actually write)
 *		This program prompts the user to enter a URL
 *		(general form: www.xyz.com). It then extracts
 *		the domain name and the domain type
 *		(general form: edu, com, org, etc.) and prints
 *		those to the screen. Next, it prompts the user
 *		to enter a username and then generates an email
 *		address based on the collected data.
 */

import java.util.Scanner;

public class whatever
{
	public static void main(String[] args)
	{



The block comment part is what I am talking about. I am taking a Java class and each time I create a new class in Eclipse, I have to open a previous class I've written to copy/paste the block comment over. While that's no big deal at all, of course, I am wondering if there is a way to set up Eclipse to insert that block comment automatically on each new class I create.

Anyone?

Thanks in advance.

This post has been edited by moerl: 04 June 2006 - 01:46 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Automatic comment generation in Eclipse

#2 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,506
  • Joined: 12-July 02

Re: Automatic comment generation in Eclipse

Posted 04 June 2006 - 03:33 PM

Hmm....I don't have the latest Eclipse installed, but in older versions, you could use templates for this effect...at the very least, you could write an editor template, which is a bit like a macro, to insert common blocks.

See #9
http://benpryor.com/...ipse-Users.html

Of course, an Eclipse user could likely better comment... :)
Was This Post Helpful? 0
  • +
  • -

#3 moerl  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 30
  • Joined: 02-June 06

Re: Automatic comment generation in Eclipse

Posted 04 June 2006 - 11:58 PM

View PostAmadeus, on 4 Jun, 2006 - 04:25 PM, said:

Hmm....I don't have the latest Eclipse installed, but in older versions, you could use templates for this effect...at the very least, you could write an editor template, which is a bit like a macro, to insert common blocks.

See #9
http://benpryor.com/...ipse-Users.html

Of course, an Eclipse user could likely better comment... :)

As I said, it's not really that big a deal, but it would be a nice thing to have. And hey, that's a really nice link!! Thanks a lot for that one :). I can use all the tips I can get for Eclipse. I learned about some new editing-related keyboard shortcuts and the keyboard shortcut for displaying keyboard shortcuts (CTRL + SHIFT + L) and love the stuff I can do. Selecting entire lines, copying whole lines or segments of code up or down relative to the selection or cursor position.. deleting lines.. etc. It's pretty cool. I'm still a bit confused about the difference between Quick Fix and Code Assist but use both whenever I can. I can certainly appreciate good "tips and tricks" listings for it :)

Thanks! And since you don't use Eclipse anymore, (why, anyway, if I may ask?), what is it you use? I hear nothing but excellent things about IntelliJ's IDEA, but of course that's not for a learning Java greenhorn. More for the experienced Java veteran whose work depends on Java programming, I'd say. If for no other factor, the price speaks volumes about why the last statement is true :)
Was This Post Helpful? 0
  • +
  • -

#4 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,506
  • Joined: 12-July 02

Re: Automatic comment generation in Eclipse

Posted 05 June 2006 - 02:21 AM

Well, it's not so much that I have forsaken Eclipse...I do use it on occasion...it's that I generally don't use an IDE for programming at all for the most part. When I do, Eclipse is one I will use, as well as kdevelop.

I do wholeheartedly recommend Eclipse to anyone, however...it's a fantastic project.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1